mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-02-27 17:13:20 +01:00
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
This commit is contained in:
@@ -45,7 +45,7 @@ namespace llvm
|
||||
class ConstantStruct;
|
||||
class GlobalVariable;
|
||||
}
|
||||
struct IRStruct;
|
||||
struct IrStruct;
|
||||
struct DUnion;
|
||||
|
||||
struct AggregateDeclaration : ScopeDsymbol
|
||||
@@ -110,7 +110,7 @@ struct AggregateDeclaration : ScopeDsymbol
|
||||
llvm::Constant* llvmConstClass;
|
||||
bool llvmHasUnions;
|
||||
DUnion* llvmUnion;
|
||||
IRStruct* llvmIRStruct;
|
||||
IrStruct* llvmIrStruct;
|
||||
bool llvmClassDeclared;
|
||||
bool llvmClassDefined;
|
||||
|
||||
|
||||
@@ -549,12 +549,10 @@ VarDeclaration::VarDeclaration(Loc loc, Type *type, Identifier *id, Initializer
|
||||
onstack = 0;
|
||||
canassign = 0;
|
||||
value = NULL;
|
||||
llvmNestedIndex = -1;
|
||||
llvmFieldIndex = -1;
|
||||
llvmFieldIndexOffset = 0;
|
||||
llvmNeedsStorage = false;
|
||||
llvmConstInit = NULL;
|
||||
llvmIRGlobal = NULL;
|
||||
irGlobal = NULL;
|
||||
irLocal = NULL;
|
||||
irField = NULL;
|
||||
needsStorage = false;
|
||||
}
|
||||
|
||||
Dsymbol *VarDeclaration::syntaxCopy(Dsymbol *s)
|
||||
@@ -1060,7 +1058,7 @@ void VarDeclaration::checkNestedReference(Scope *sc, Loc loc)
|
||||
fdthis->getLevel(loc, fdv);
|
||||
nestedref = 1;
|
||||
fdv->nestedFrameRef = 1;
|
||||
fdv->llvmNestedVars.insert(this);
|
||||
fdv->nestedVars.insert(this);
|
||||
//printf("var %s in function %s is nested ref\n", toChars(), fdv->toChars());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,8 +24,11 @@
|
||||
namespace llvm {
|
||||
class Value;
|
||||
}
|
||||
struct IRFunction;
|
||||
struct IRGlobal;
|
||||
struct IrFunction;
|
||||
struct IrVar;
|
||||
struct IrGlobal;
|
||||
struct IrLocal;
|
||||
struct IrField;
|
||||
|
||||
struct Expression;
|
||||
struct Statement;
|
||||
@@ -261,12 +264,13 @@ struct VarDeclaration : Declaration
|
||||
VarDeclaration *isVarDeclaration() { return (VarDeclaration *)this; }
|
||||
|
||||
// LLVMDC
|
||||
int llvmNestedIndex;
|
||||
int llvmFieldIndex;
|
||||
size_t llvmFieldIndexOffset;
|
||||
bool llvmNeedsStorage;
|
||||
llvm::Constant* llvmConstInit;
|
||||
IRGlobal* llvmIRGlobal;
|
||||
IrGlobal* irGlobal;
|
||||
IrLocal* irLocal;
|
||||
IrField* irField;
|
||||
bool needsStorage;
|
||||
|
||||
IrVar* getIrVar();
|
||||
llvm::Value*& getIrValue();
|
||||
};
|
||||
|
||||
/**************************************************************/
|
||||
@@ -609,16 +613,9 @@ struct FuncDeclaration : Declaration
|
||||
FuncDeclaration *isFuncDeclaration() { return this; }
|
||||
|
||||
// llvmdc stuff
|
||||
bool llvmQueued;
|
||||
llvm::Value* llvmThisVar;
|
||||
std::set<VarDeclaration*> llvmNestedVars;
|
||||
llvm::Value* llvmNested;
|
||||
llvm::Value* llvmArguments;
|
||||
llvm::Value* llvmArgPtr;
|
||||
llvm::Constant* llvmDwarfSubProgram;
|
||||
bool llvmRunTimeHack;
|
||||
IRFunction* llvmIRFunc;
|
||||
llvm::Value* llvmRetArg;
|
||||
bool runTimeHack;
|
||||
IrFunction* irFunc;
|
||||
std::set<VarDeclaration*> nestedVars;
|
||||
};
|
||||
|
||||
struct FuncAliasDeclaration : FuncDeclaration
|
||||
|
||||
@@ -43,10 +43,12 @@ Dsymbol::Dsymbol()
|
||||
this->isym = NULL;
|
||||
this->loc = 0;
|
||||
this->comment = NULL;
|
||||
|
||||
this->llvmInternal = LLVMnone;
|
||||
this->llvmInternal1 = NULL;
|
||||
this->llvmInternal2 = NULL;
|
||||
this->llvmValue = NULL;
|
||||
|
||||
//this->llvmValue = NULL;
|
||||
this->llvmDModule = NULL;
|
||||
|
||||
this->llvmResolved = false;
|
||||
@@ -65,10 +67,12 @@ Dsymbol::Dsymbol(Identifier *ident)
|
||||
this->isym = NULL;
|
||||
this->loc = 0;
|
||||
this->comment = NULL;
|
||||
|
||||
this->llvmInternal = LLVMnone;
|
||||
this->llvmInternal1 = NULL;
|
||||
this->llvmInternal2 = NULL;
|
||||
this->llvmValue = NULL;
|
||||
|
||||
//this->llvmValue = NULL;
|
||||
this->llvmDModule = NULL;
|
||||
|
||||
this->llvmResolved = false;
|
||||
|
||||
@@ -220,7 +220,7 @@ struct Dsymbol : Object
|
||||
char* llvmInternal1;
|
||||
char* llvmInternal2;
|
||||
|
||||
llvm::Value* llvmValue;
|
||||
//llvm::Value* llvmValue;
|
||||
Module* llvmDModule;
|
||||
|
||||
bool llvmResolved;
|
||||
|
||||
@@ -3456,7 +3456,7 @@ Expression *SymOffExp::semantic(Scope *sc)
|
||||
if (v)
|
||||
{
|
||||
v->checkNestedReference(sc, loc);
|
||||
v->llvmNeedsStorage = true;
|
||||
v->needsStorage = true;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@@ -3601,7 +3601,7 @@ Expression *VarExp::modifiableLvalue(Scope *sc, Expression *e)
|
||||
if (v && v->canassign == 0 &&
|
||||
(var->isConst() || (global.params.Dversion > 1 && var->isFinal())))
|
||||
error("cannot modify final variable '%s'", var->toChars());
|
||||
v->llvmNeedsStorage = true;
|
||||
v->needsStorage = true;
|
||||
|
||||
if (var->isCtorinit())
|
||||
{ // It's only modifiable if inside the right constructor
|
||||
@@ -5887,7 +5887,7 @@ Expression *AddrExp::semantic(Scope *sc)
|
||||
}
|
||||
else if (v)
|
||||
{
|
||||
v->llvmNeedsStorage = true;
|
||||
v->needsStorage = true;
|
||||
}
|
||||
}
|
||||
else if (e1->op == TOKarray)
|
||||
|
||||
12
dmd/func.c
12
dmd/func.c
@@ -73,15 +73,9 @@ FuncDeclaration::FuncDeclaration(Loc loc, Loc endloc, Identifier *id, enum STC s
|
||||
nrvo_can = 1;
|
||||
nrvo_var = NULL;
|
||||
shidden = NULL;
|
||||
llvmQueued = false;
|
||||
llvmThisVar = NULL;
|
||||
llvmNested = NULL;
|
||||
llvmArguments = NULL;
|
||||
llvmArgPtr = NULL;
|
||||
llvmDwarfSubProgram = NULL;
|
||||
llvmRunTimeHack = false;
|
||||
llvmIRFunc = NULL;
|
||||
llvmRetArg = NULL;
|
||||
// llvmdc
|
||||
runTimeHack = false;
|
||||
irFunc = NULL;
|
||||
}
|
||||
|
||||
Dsymbol *FuncDeclaration::syntaxCopy(Dsymbol *s)
|
||||
|
||||
16
dmd/mtype.c
16
dmd/mtype.c
@@ -1514,7 +1514,7 @@ Expression *TypeArray::dotExp(Scope *sc, Expression *e, Identifier *ident)
|
||||
|
||||
nm = name[n->ty == Twchar];
|
||||
fd = FuncDeclaration::genCfunc(Type::tvoid->arrayOf(), nm);
|
||||
fd->llvmRunTimeHack = true;
|
||||
fd->runTimeHack = true;
|
||||
ec = new VarExp(0, fd);
|
||||
e = e->castTo(sc, n->arrayOf()); // convert to dynamic array
|
||||
arguments = new Expressions();
|
||||
@@ -1532,7 +1532,7 @@ Expression *TypeArray::dotExp(Scope *sc, Expression *e, Identifier *ident)
|
||||
|
||||
nm = name[n->ty == Twchar];
|
||||
fd = FuncDeclaration::genCfunc(Type::tvoid->arrayOf(), nm);
|
||||
fd->llvmRunTimeHack = true;
|
||||
fd->runTimeHack = true;
|
||||
ec = new VarExp(0, fd);
|
||||
e = e->castTo(sc, n->arrayOf()); // convert to dynamic array
|
||||
arguments = new Expressions();
|
||||
@@ -1551,7 +1551,7 @@ Expression *TypeArray::dotExp(Scope *sc, Expression *e, Identifier *ident)
|
||||
assert(size);
|
||||
dup = (ident == Id::dup);
|
||||
fd = FuncDeclaration::genCfunc(Type::tvoid->arrayOf(), dup ? Id::adDup : Id::adReverse);
|
||||
fd->llvmRunTimeHack = true;
|
||||
fd->runTimeHack = true;
|
||||
ec = new VarExp(0, fd);
|
||||
e = e->castTo(sc, n->arrayOf()); // convert to dynamic array
|
||||
arguments = new Expressions();
|
||||
@@ -1571,7 +1571,7 @@ Expression *TypeArray::dotExp(Scope *sc, Expression *e, Identifier *ident)
|
||||
|
||||
fd = FuncDeclaration::genCfunc(Type::tvoid->arrayOf(),
|
||||
(char*)(n->ty == Tbit ? "_adSortBit" : "_adSort"));
|
||||
fd->llvmRunTimeHack = true;
|
||||
fd->runTimeHack = true;
|
||||
ec = new VarExp(0, fd);
|
||||
e = e->castTo(sc, n->arrayOf()); // convert to dynamic array
|
||||
arguments = new Expressions();
|
||||
@@ -2273,7 +2273,7 @@ Expression *TypeAArray::dotExp(Scope *sc, Expression *e, Identifier *ident)
|
||||
Expressions *arguments;
|
||||
|
||||
fd = FuncDeclaration::genCfunc(Type::tsize_t, Id::aaLen);
|
||||
fd->llvmRunTimeHack = true;
|
||||
fd->runTimeHack = true;
|
||||
ec = new VarExp(0, fd);
|
||||
arguments = new Expressions();
|
||||
arguments->push(e);
|
||||
@@ -2289,7 +2289,7 @@ Expression *TypeAArray::dotExp(Scope *sc, Expression *e, Identifier *ident)
|
||||
|
||||
assert(size);
|
||||
fd = FuncDeclaration::genCfunc(Type::tvoid->arrayOf(), Id::aaKeys);
|
||||
fd->llvmRunTimeHack = true;
|
||||
fd->runTimeHack = true;
|
||||
ec = new VarExp(0, fd);
|
||||
arguments = new Expressions();
|
||||
arguments->push(e);
|
||||
@@ -2304,7 +2304,7 @@ Expression *TypeAArray::dotExp(Scope *sc, Expression *e, Identifier *ident)
|
||||
Expressions *arguments;
|
||||
|
||||
fd = FuncDeclaration::genCfunc(Type::tvoid->arrayOf(), Id::aaValues);
|
||||
fd->llvmRunTimeHack = true;
|
||||
fd->runTimeHack = true;
|
||||
ec = new VarExp(0, fd);
|
||||
arguments = new Expressions();
|
||||
arguments->push(e);
|
||||
@@ -2322,7 +2322,7 @@ Expression *TypeAArray::dotExp(Scope *sc, Expression *e, Identifier *ident)
|
||||
Expressions *arguments;
|
||||
|
||||
fd = FuncDeclaration::genCfunc(Type::tvoid->pointerTo(), Id::aaRehash);
|
||||
fd->llvmRunTimeHack = true;
|
||||
fd->runTimeHack = true;
|
||||
ec = new VarExp(0, fd);
|
||||
arguments = new Expressions();
|
||||
arguments->push(e->addressOf(sc));
|
||||
|
||||
@@ -1431,7 +1431,7 @@ Statement *ForeachStatement::semantic(Scope *sc)
|
||||
fdapply = FuncDeclaration::genCfunc(Type::tindex, "_aaApply2");
|
||||
else
|
||||
fdapply = FuncDeclaration::genCfunc(Type::tindex, "_aaApply");
|
||||
fdapply->llvmRunTimeHack = true;
|
||||
fdapply->runTimeHack = true;
|
||||
ec = new VarExp(0, fdapply);
|
||||
Expressions *exps = new Expressions();
|
||||
exps->push(aggr);
|
||||
@@ -1473,7 +1473,7 @@ Statement *ForeachStatement::semantic(Scope *sc)
|
||||
int j = sprintf(fdname, "_aApply%s%.*s%d", r, 2, fntab[flag], dim);
|
||||
assert(j < sizeof(fdname));
|
||||
fdapply = FuncDeclaration::genCfunc(Type::tindex, fdname);
|
||||
fdapply->llvmRunTimeHack = true;
|
||||
fdapply->runTimeHack = true;
|
||||
|
||||
ec = new VarExp(0, fdapply);
|
||||
Expressions *exps = new Expressions();
|
||||
|
||||
@@ -54,7 +54,7 @@ AggregateDeclaration::AggregateDeclaration(Loc loc, Identifier *id)
|
||||
llvmInProgress = false;
|
||||
llvmHasUnions = false;
|
||||
llvmUnion = NULL;
|
||||
llvmIRStruct = NULL;
|
||||
llvmIrStruct = NULL;
|
||||
llvmClassDeclared = false;
|
||||
llvmClassDefined = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user