Small code modifications to Ir-Classes.

Adds some constructors and moves the code to the header file. Uses some of the new constructors.

A big problem with the source are the different strategies used for otherwise similar classes.
E.g. a IrField registers itself with the VarDeclaration. Same is required for IrParameter, but
in this case it is done by the caller.
This commit is contained in:
kai 2013-11-05 10:31:14 +01:00
parent 8d7f0bf0eb
commit 6fe28e1660
5 changed files with 46 additions and 88 deletions

View file

@ -1121,8 +1121,7 @@ void DtoVarDeclaration(VarDeclaration* vd)
*/
else if (gIR->func()->retArg && gIR->func()->decl->nrvo_can && gIR->func()->decl->nrvo_var == vd) {
assert(!isSpecialRefVar(vd) && "Can this happen?");
vd->ir.irLocal = new IrLocal(vd);
vd->ir.irLocal->value = gIR->func()->retArg;
vd->ir.irLocal = new IrLocal(vd, gIR->func()->retArg);
}
// normal stack variable, allocate storage on the stack if it has not already been done
else {
@ -1339,8 +1338,7 @@ LLValue* DtoRawVarDeclaration(VarDeclaration* var, LLValue* addr)
assert(!var->ir.isSet());
assert(addr);
var->ir.irLocal = new IrLocal(var);
var->ir.irLocal->value = addr;
var->ir.irLocal = new IrLocal(var, addr);
}
// return the alloca