mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-08-28 17:20:04 +02:00
[svn r233] Added: -oq command line option for writing fully qualified object names.
Added: started support for x86 80bit floating point. Changed: aggregates passed by value now use the llvm 'byval' parameter attribute, also lays ground work for using other attributes. Changed: eliminated a lot more std::vectorS, these showed up pretty much at the top when profiling! Changed: performed other misc. cleanups. Changed: halt expression now call the new llvm trap intrinsic instead of an assert(0). Changed: dstress suite now passes -O0 by default, this only eliminates unreferenced globals, which speeds up linking quite a bit.
This commit is contained in:
27
gen/toir.cpp
27
gen/toir.cpp
@@ -618,7 +618,7 @@ DValue* AddExp::toElem(IRState* p)
|
||||
llvm::ConstantInt* cofs = llvm::cast<llvm::ConstantInt>(r->isConst()->c);
|
||||
|
||||
TypeStruct* ts = (TypeStruct*)e1next;
|
||||
std::vector<unsigned> offsets;
|
||||
DStructIndexVector offsets;
|
||||
LLValue* v = DtoIndexStruct(l->getRVal(), ts->sym, t->next, cofs->getZExtValue(), offsets);
|
||||
return new DFieldValue(type, v, true);
|
||||
}
|
||||
@@ -1018,7 +1018,11 @@ DValue* CallExp::toElem(IRState* p)
|
||||
|
||||
bool isInPlace = false;
|
||||
|
||||
// attrs
|
||||
llvm::PAListPtr palist;
|
||||
|
||||
// hidden struct return arguments
|
||||
// TODO: use sret param attr
|
||||
if (retinptr) {
|
||||
if (topexp && topexp->e2 == this) {
|
||||
assert(topexp->v);
|
||||
@@ -1167,6 +1171,10 @@ DValue* CallExp::toElem(IRState* p)
|
||||
Argument* fnarg = Argument::getNth(tf->parameters, i);
|
||||
DValue* argval = DtoArgument(fnarg, (Expression*)arguments->data[i]);
|
||||
llargs[j] = argval->getRVal();
|
||||
#if USE_BYVAL
|
||||
if (fnarg->llvmByVal)
|
||||
palist = palist.addAttr(j, llvm::ParamAttr::ByVal);
|
||||
#endif
|
||||
j++;
|
||||
}
|
||||
|
||||
@@ -1187,6 +1195,11 @@ DValue* CallExp::toElem(IRState* p)
|
||||
llargs[j] = DtoBitCast(llargs[j], llfnty->getParamType(j));
|
||||
}
|
||||
|
||||
#if USE_BYVAL
|
||||
if (fnarg && fnarg->llvmByVal)
|
||||
palist = palist.addAttr(j+1, llvm::ParamAttr::ByVal);
|
||||
#endif
|
||||
|
||||
// this hack is necessary :/
|
||||
if (dfn && dfn->func && dfn->func->runTimeHack) {
|
||||
if (llfnty->getParamType(j) != NULL) {
|
||||
@@ -1245,6 +1258,9 @@ DValue* CallExp::toElem(IRState* p)
|
||||
call->setCallingConv(DtoCallingConv(dlink));
|
||||
}
|
||||
|
||||
// param attrs
|
||||
call->setParamAttrs(palist);
|
||||
|
||||
return new DImValue(type, retllval, isInPlace);
|
||||
}
|
||||
|
||||
@@ -1311,7 +1327,7 @@ DValue* SymOffExp::toElem(IRState* p)
|
||||
varmem = p->ir->CreateBitCast(llvalue, llt, "tmp");
|
||||
}
|
||||
else {
|
||||
std::vector<unsigned> dst;
|
||||
DStructIndexVector dst;
|
||||
varmem = DtoIndexStruct(llvalue,vdt->sym, tnext, offset, dst);
|
||||
}
|
||||
}
|
||||
@@ -1429,7 +1445,7 @@ DValue* DotVarExp::toElem(IRState* p)
|
||||
|
||||
LLValue* src = l->getRVal();
|
||||
|
||||
std::vector<unsigned> vdoffsets;
|
||||
DStructIndexVector vdoffsets;
|
||||
arrptr = DtoIndexStruct(src, ts->sym, vd->type, vd->offset, vdoffsets);
|
||||
}
|
||||
else if (e1type->ty == Tclass) {
|
||||
@@ -1438,7 +1454,7 @@ DValue* DotVarExp::toElem(IRState* p)
|
||||
|
||||
LLValue* src = l->getRVal();
|
||||
|
||||
std::vector<unsigned> vdoffsets;
|
||||
DStructIndexVector vdoffsets;
|
||||
arrptr = DtoIndexClass(src, tc->sym, vd->type, vd->offset, vdoffsets);
|
||||
|
||||
/*std::vector<unsigned> vdoffsets(1,0);
|
||||
@@ -2255,7 +2271,8 @@ DValue* HaltExp::toElem(IRState* p)
|
||||
Logger::print("HaltExp::toElem: %s | %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
DtoAssert(&loc, NULL);
|
||||
// call the new (?) trap intrinsic
|
||||
p->ir->CreateCall(GET_INTRINSIC_DECL(trap),"");
|
||||
|
||||
new llvm::UnreachableInst(p->scopebb());
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user