mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-03-02 10:33:13 +01:00
[svn r104] TONS OF FIXES.
Split up declaration, constant initializer gen and definition for globals, structs, classes and functions. Improved ClassInfo support (not complete), not in vtable yet. Fixed a bunch of forward reference problems. Much more. Major commit! :)
This commit is contained in:
@@ -43,8 +43,9 @@ namespace llvm
|
||||
class Value;
|
||||
class Constant;
|
||||
class ConstantStruct;
|
||||
class GlobalVariable;
|
||||
}
|
||||
|
||||
struct IRStruct;
|
||||
struct DUnion;
|
||||
|
||||
struct AggregateDeclaration : ScopeDsymbol
|
||||
@@ -101,12 +102,14 @@ struct AggregateDeclaration : ScopeDsymbol
|
||||
Symbol *toInitializer();
|
||||
|
||||
bool llvmInProgress;
|
||||
const llvm::Type* llvmType;
|
||||
llvm::Constant* llvmVtbl;
|
||||
llvm::GlobalVariable* llvmVtbl;
|
||||
llvm::ConstantStruct* llvmConstVtbl;
|
||||
llvm::Constant* llvmInitZ;
|
||||
llvm::GlobalVariable* llvmClass;
|
||||
llvm::Constant* llvmClassZ;
|
||||
bool llvmHasUnions;
|
||||
DUnion* llvmUnion;
|
||||
IRStruct* llvmIRStruct;
|
||||
|
||||
AggregateDeclaration *isAggregateDeclaration() { return this; }
|
||||
};
|
||||
|
||||
@@ -32,7 +32,6 @@ Declaration::Declaration(Identifier *id)
|
||||
storage_class = STCundefined;
|
||||
protection = PROTundefined;
|
||||
linkage = LINKdefault;
|
||||
llvmTouched = false;
|
||||
}
|
||||
|
||||
void Declaration::semantic(Scope *sc)
|
||||
@@ -553,6 +552,8 @@ VarDeclaration::VarDeclaration(Loc loc, Type *type, Identifier *id, Initializer
|
||||
llvmFieldIndex = -1;
|
||||
llvmFieldIndexOffset = 0;
|
||||
llvmNeedsStorage = false;
|
||||
llvmConstInit = NULL;
|
||||
llvmIRGlobal = NULL;
|
||||
}
|
||||
|
||||
Dsymbol *VarDeclaration::syntaxCopy(Dsymbol *s)
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
namespace llvm {
|
||||
class Value;
|
||||
}
|
||||
struct IRFunction;
|
||||
struct IRGlobal;
|
||||
|
||||
struct Expression;
|
||||
struct Statement;
|
||||
@@ -128,8 +130,6 @@ struct Declaration : Dsymbol
|
||||
Declaration *isDeclaration() { return this; }
|
||||
|
||||
virtual void toObjFile(); // compile to .obj file
|
||||
|
||||
bool llvmTouched;
|
||||
};
|
||||
|
||||
/**************************************************************/
|
||||
@@ -263,6 +263,8 @@ struct VarDeclaration : Declaration
|
||||
int llvmFieldIndex;
|
||||
size_t llvmFieldIndexOffset;
|
||||
bool llvmNeedsStorage;
|
||||
llvm::Constant* llvmConstInit;
|
||||
IRGlobal* llvmIRGlobal;
|
||||
};
|
||||
|
||||
/**************************************************************/
|
||||
@@ -293,6 +295,8 @@ struct ClassInfoDeclaration : VarDeclaration
|
||||
void emitComment(Scope *sc);
|
||||
|
||||
Symbol *toSymbol();
|
||||
|
||||
ClassInfoDeclaration* isClassInfoDeclaration() { return this; }
|
||||
};
|
||||
|
||||
struct ModuleInfoDeclaration : VarDeclaration
|
||||
@@ -558,6 +562,7 @@ struct FuncDeclaration : Declaration
|
||||
llvm::Value* llvmArgPtr;
|
||||
llvm::Constant* llvmDwarfSubProgram;
|
||||
bool llvmRunTimeHack;
|
||||
IRFunction* llvmIRFunc;
|
||||
};
|
||||
|
||||
struct FuncAliasDeclaration : FuncDeclaration
|
||||
|
||||
@@ -48,6 +48,7 @@ Dsymbol::Dsymbol()
|
||||
this->llvmInternal2 = NULL;
|
||||
this->llvmValue = NULL;
|
||||
this->llvmDModule = NULL;
|
||||
this->llvmTouched = false;
|
||||
}
|
||||
|
||||
Dsymbol::Dsymbol(Identifier *ident)
|
||||
@@ -65,6 +66,7 @@ Dsymbol::Dsymbol(Identifier *ident)
|
||||
this->llvmInternal2 = NULL;
|
||||
this->llvmValue = NULL;
|
||||
this->llvmDModule = NULL;
|
||||
this->llvmTouched = false;
|
||||
}
|
||||
|
||||
int Dsymbol::equals(Object *o)
|
||||
|
||||
@@ -67,6 +67,7 @@ struct Expression;
|
||||
struct DeleteDeclaration;
|
||||
struct HdrGenState;
|
||||
struct TypeInfoDeclaration;
|
||||
struct ClassInfoDeclaration;
|
||||
|
||||
#if IN_GCC
|
||||
union tree_node;
|
||||
@@ -212,6 +213,7 @@ struct Dsymbol : Object
|
||||
virtual SymbolDeclaration *isSymbolDeclaration() { return NULL; }
|
||||
virtual AttribDeclaration *isAttribDeclaration() { return NULL; }
|
||||
virtual TypeInfoDeclaration* isTypeInfoDeclaration() { return NULL; }
|
||||
virtual ClassInfoDeclaration* isClassInfoDeclaration() { return NULL; }
|
||||
|
||||
// llvm stuff
|
||||
int llvmInternal;
|
||||
@@ -220,6 +222,8 @@ struct Dsymbol : Object
|
||||
|
||||
llvm::Value* llvmValue;
|
||||
Module* llvmDModule;
|
||||
|
||||
bool llvmTouched;
|
||||
};
|
||||
|
||||
// Dsymbol that generates a scope
|
||||
|
||||
@@ -80,6 +80,7 @@ FuncDeclaration::FuncDeclaration(Loc loc, Loc endloc, Identifier *id, enum STC s
|
||||
llvmArgPtr = NULL;
|
||||
llvmDwarfSubProgram = NULL;
|
||||
llvmRunTimeHack = false;
|
||||
llvmIRFunc = NULL;
|
||||
}
|
||||
|
||||
Dsymbol *FuncDeclaration::syntaxCopy(Dsymbol *s)
|
||||
|
||||
11
dmd/mtype.h
11
dmd/mtype.h
@@ -21,11 +21,14 @@
|
||||
#include "arraytypes.h"
|
||||
#include "expression.h"
|
||||
|
||||
// LLVMDC
|
||||
namespace llvm
|
||||
{
|
||||
class Value;
|
||||
class Type;
|
||||
class Instruction;
|
||||
class Type;
|
||||
class PATypeHolder;
|
||||
class GlobalVariable;
|
||||
}
|
||||
|
||||
struct Scope;
|
||||
@@ -250,7 +253,7 @@ struct Type : Object
|
||||
virtual type *toCParamtype();
|
||||
virtual Symbol *toSymbol();
|
||||
|
||||
const llvm::Type* llvmType;
|
||||
llvm::PATypeHolder* llvmType;
|
||||
|
||||
// For eliminating dynamic_cast
|
||||
virtual TypeBasic *isTypeBasic();
|
||||
@@ -540,7 +543,7 @@ struct TypeStruct : Type
|
||||
|
||||
type *toCtype();
|
||||
|
||||
llvm::Constant* llvmInit;
|
||||
llvm::GlobalVariable* llvmInit;
|
||||
};
|
||||
|
||||
struct TypeEnum : Type
|
||||
@@ -638,7 +641,7 @@ struct TypeClass : Type
|
||||
|
||||
Symbol *toSymbol();
|
||||
|
||||
llvm::Constant* llvmInit;
|
||||
llvm::GlobalVariable* llvmInit;
|
||||
};
|
||||
|
||||
struct TypeTuple : Type
|
||||
|
||||
@@ -45,13 +45,15 @@ AggregateDeclaration::AggregateDeclaration(Loc loc, Identifier *id)
|
||||
sinit = NULL;
|
||||
scope = NULL;
|
||||
|
||||
llvmType = NULL;
|
||||
llvmVtbl = NULL;
|
||||
llvmConstVtbl = NULL;
|
||||
llvmInitZ = NULL;
|
||||
llvmClass = NULL;
|
||||
llvmClassZ = NULL;
|
||||
llvmInProgress = false;
|
||||
llvmHasUnions = false;
|
||||
llvmUnion = NULL;
|
||||
llvmIRStruct = NULL;
|
||||
}
|
||||
|
||||
enum PROT AggregateDeclaration::prot()
|
||||
|
||||
Reference in New Issue
Block a user