comparison dmd/mtype.c @ 136:0e28624814e8 trunk

[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
author lindquist
date Thu, 17 Jan 2008 03:15:12 +0100
parents 5825d48b27d1
children 0ab29b838084
comparison
equal deleted inserted replaced
135:176bd52b3cf5 136:0e28624814e8
1512 char *nm; 1512 char *nm;
1513 static char *name[2] = { "_adReverseChar", "_adReverseWchar" }; 1513 static char *name[2] = { "_adReverseChar", "_adReverseWchar" };
1514 1514
1515 nm = name[n->ty == Twchar]; 1515 nm = name[n->ty == Twchar];
1516 fd = FuncDeclaration::genCfunc(Type::tvoid->arrayOf(), nm); 1516 fd = FuncDeclaration::genCfunc(Type::tvoid->arrayOf(), nm);
1517 fd->llvmRunTimeHack = true; 1517 fd->runTimeHack = true;
1518 ec = new VarExp(0, fd); 1518 ec = new VarExp(0, fd);
1519 e = e->castTo(sc, n->arrayOf()); // convert to dynamic array 1519 e = e->castTo(sc, n->arrayOf()); // convert to dynamic array
1520 arguments = new Expressions(); 1520 arguments = new Expressions();
1521 arguments->push(e); 1521 arguments->push(e);
1522 e = new CallExp(e->loc, ec, arguments); 1522 e = new CallExp(e->loc, ec, arguments);
1530 char *nm; 1530 char *nm;
1531 static char *name[2] = { "_adSortChar", "_adSortWchar" }; 1531 static char *name[2] = { "_adSortChar", "_adSortWchar" };
1532 1532
1533 nm = name[n->ty == Twchar]; 1533 nm = name[n->ty == Twchar];
1534 fd = FuncDeclaration::genCfunc(Type::tvoid->arrayOf(), nm); 1534 fd = FuncDeclaration::genCfunc(Type::tvoid->arrayOf(), nm);
1535 fd->llvmRunTimeHack = true; 1535 fd->runTimeHack = true;
1536 ec = new VarExp(0, fd); 1536 ec = new VarExp(0, fd);
1537 e = e->castTo(sc, n->arrayOf()); // convert to dynamic array 1537 e = e->castTo(sc, n->arrayOf()); // convert to dynamic array
1538 arguments = new Expressions(); 1538 arguments = new Expressions();
1539 arguments->push(e); 1539 arguments->push(e);
1540 e = new CallExp(e->loc, ec, arguments); 1540 e = new CallExp(e->loc, ec, arguments);
1549 int dup; 1549 int dup;
1550 1550
1551 assert(size); 1551 assert(size);
1552 dup = (ident == Id::dup); 1552 dup = (ident == Id::dup);
1553 fd = FuncDeclaration::genCfunc(Type::tvoid->arrayOf(), dup ? Id::adDup : Id::adReverse); 1553 fd = FuncDeclaration::genCfunc(Type::tvoid->arrayOf(), dup ? Id::adDup : Id::adReverse);
1554 fd->llvmRunTimeHack = true; 1554 fd->runTimeHack = true;
1555 ec = new VarExp(0, fd); 1555 ec = new VarExp(0, fd);
1556 e = e->castTo(sc, n->arrayOf()); // convert to dynamic array 1556 e = e->castTo(sc, n->arrayOf()); // convert to dynamic array
1557 arguments = new Expressions(); 1557 arguments = new Expressions();
1558 if (dup) 1558 if (dup)
1559 arguments->push(getTypeInfo(sc)); 1559 arguments->push(getTypeInfo(sc));
1569 FuncDeclaration *fd; 1569 FuncDeclaration *fd;
1570 Expressions *arguments; 1570 Expressions *arguments;
1571 1571
1572 fd = FuncDeclaration::genCfunc(Type::tvoid->arrayOf(), 1572 fd = FuncDeclaration::genCfunc(Type::tvoid->arrayOf(),
1573 (char*)(n->ty == Tbit ? "_adSortBit" : "_adSort")); 1573 (char*)(n->ty == Tbit ? "_adSortBit" : "_adSort"));
1574 fd->llvmRunTimeHack = true; 1574 fd->runTimeHack = true;
1575 ec = new VarExp(0, fd); 1575 ec = new VarExp(0, fd);
1576 e = e->castTo(sc, n->arrayOf()); // convert to dynamic array 1576 e = e->castTo(sc, n->arrayOf()); // convert to dynamic array
1577 arguments = new Expressions(); 1577 arguments = new Expressions();
1578 arguments->push(e); 1578 arguments->push(e);
1579 if (next->ty != Tbit) 1579 if (next->ty != Tbit)
2271 Expression *ec; 2271 Expression *ec;
2272 FuncDeclaration *fd; 2272 FuncDeclaration *fd;
2273 Expressions *arguments; 2273 Expressions *arguments;
2274 2274
2275 fd = FuncDeclaration::genCfunc(Type::tsize_t, Id::aaLen); 2275 fd = FuncDeclaration::genCfunc(Type::tsize_t, Id::aaLen);
2276 fd->llvmRunTimeHack = true; 2276 fd->runTimeHack = true;
2277 ec = new VarExp(0, fd); 2277 ec = new VarExp(0, fd);
2278 arguments = new Expressions(); 2278 arguments = new Expressions();
2279 arguments->push(e); 2279 arguments->push(e);
2280 e = new CallExp(e->loc, ec, arguments); 2280 e = new CallExp(e->loc, ec, arguments);
2281 e->type = fd->type->next; 2281 e->type = fd->type->next;
2287 Expressions *arguments; 2287 Expressions *arguments;
2288 int size = key->size(e->loc); 2288 int size = key->size(e->loc);
2289 2289
2290 assert(size); 2290 assert(size);
2291 fd = FuncDeclaration::genCfunc(Type::tvoid->arrayOf(), Id::aaKeys); 2291 fd = FuncDeclaration::genCfunc(Type::tvoid->arrayOf(), Id::aaKeys);
2292 fd->llvmRunTimeHack = true; 2292 fd->runTimeHack = true;
2293 ec = new VarExp(0, fd); 2293 ec = new VarExp(0, fd);
2294 arguments = new Expressions(); 2294 arguments = new Expressions();
2295 arguments->push(e); 2295 arguments->push(e);
2296 arguments->push(new IntegerExp(0, size, Type::tsize_t)); 2296 arguments->push(new IntegerExp(0, size, Type::tsize_t));
2297 e = new CallExp(e->loc, ec, arguments); 2297 e = new CallExp(e->loc, ec, arguments);
2302 Expression *ec; 2302 Expression *ec;
2303 FuncDeclaration *fd; 2303 FuncDeclaration *fd;
2304 Expressions *arguments; 2304 Expressions *arguments;
2305 2305
2306 fd = FuncDeclaration::genCfunc(Type::tvoid->arrayOf(), Id::aaValues); 2306 fd = FuncDeclaration::genCfunc(Type::tvoid->arrayOf(), Id::aaValues);
2307 fd->llvmRunTimeHack = true; 2307 fd->runTimeHack = true;
2308 ec = new VarExp(0, fd); 2308 ec = new VarExp(0, fd);
2309 arguments = new Expressions(); 2309 arguments = new Expressions();
2310 arguments->push(e); 2310 arguments->push(e);
2311 size_t keysize = key->size(e->loc); 2311 size_t keysize = key->size(e->loc);
2312 keysize = (keysize + 4 - 1) & ~(4 - 1); 2312 keysize = (keysize + 4 - 1) & ~(4 - 1);
2320 Expression *ec; 2320 Expression *ec;
2321 FuncDeclaration *fd; 2321 FuncDeclaration *fd;
2322 Expressions *arguments; 2322 Expressions *arguments;
2323 2323
2324 fd = FuncDeclaration::genCfunc(Type::tvoid->pointerTo(), Id::aaRehash); 2324 fd = FuncDeclaration::genCfunc(Type::tvoid->pointerTo(), Id::aaRehash);
2325 fd->llvmRunTimeHack = true; 2325 fd->runTimeHack = true;
2326 ec = new VarExp(0, fd); 2326 ec = new VarExp(0, fd);
2327 arguments = new Expressions(); 2327 arguments = new Expressions();
2328 arguments->push(e->addressOf(sc)); 2328 arguments->push(e->addressOf(sc));
2329 arguments->push(key->getInternalTypeInfo(sc)); 2329 arguments->push(key->getInternalTypeInfo(sc));
2330 e = new CallExp(e->loc, ec, arguments); 2330 e = new CallExp(e->loc, ec, arguments);