mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-07 19:36:06 +03:00
Remove unused, empty Ir type.
The codegen parameter was changed to IRState instead of removing it to set the stage for an eventual eradication of the gIR global.
This commit is contained in:
parent
c6cf35a012
commit
1242be25d0
27 changed files with 64 additions and 182 deletions
|
@ -209,7 +209,7 @@ struct StructDeclaration : AggregateDeclaration
|
|||
StructDeclaration *isStructDeclaration() { return this; }
|
||||
|
||||
#if IN_LLVM
|
||||
void codegen(Ir*);
|
||||
void codegen(IRState*);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -337,7 +337,7 @@ struct ClassDeclaration : AggregateDeclaration
|
|||
ClassDeclaration *isClassDeclaration() { return (ClassDeclaration *)this; }
|
||||
|
||||
#if IN_LLVM
|
||||
virtual void codegen(Ir*);
|
||||
virtual void codegen(IRState*);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -367,7 +367,7 @@ struct InterfaceDeclaration : ClassDeclaration
|
|||
InterfaceDeclaration *isInterfaceDeclaration() { return this; }
|
||||
|
||||
#if IN_LLVM
|
||||
void codegen(Ir*);
|
||||
void codegen(IRState*);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ struct AttribDeclaration : Dsymbol
|
|||
#endif
|
||||
|
||||
#if IN_LLVM
|
||||
virtual void codegen(Ir*);
|
||||
void codegen(IRState*);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -161,7 +161,7 @@ struct PragmaDeclaration : AttribDeclaration
|
|||
#endif
|
||||
|
||||
#if IN_LLVM
|
||||
void codegen(Ir*);
|
||||
void codegen(IRState*);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ struct TupleDeclaration : Declaration
|
|||
#if IN_LLVM
|
||||
void semantic3(Scope *sc);
|
||||
/// Codegen traversal
|
||||
void codegen(Ir* ir);
|
||||
void codegen(IRState* ir);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -251,7 +251,7 @@ struct TypedefDeclaration : Declaration
|
|||
|
||||
#if IN_LLVM
|
||||
/// Codegen traversal
|
||||
void codegen(Ir* ir);
|
||||
void codegen(IRState* ir);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -357,7 +357,7 @@ struct VarDeclaration : Declaration
|
|||
|
||||
#if IN_LLVM
|
||||
/// Codegen traversal
|
||||
virtual void codegen(Ir* ir);
|
||||
void codegen(IRState* ir);
|
||||
|
||||
/// Index into parent aggregate.
|
||||
/// Set during type generation.
|
||||
|
@ -450,7 +450,7 @@ struct TypeInfoDeclaration : VarDeclaration
|
|||
|
||||
#if IN_LLVM
|
||||
/// Codegen traversal
|
||||
void codegen(Ir* ir);
|
||||
void codegen(IRState* ir);
|
||||
virtual void llvmDefine();
|
||||
#endif
|
||||
};
|
||||
|
@ -482,7 +482,7 @@ struct TypeInfoClassDeclaration : TypeInfoDeclaration
|
|||
// __ClassZ/__InterfaceZ symbols instead of a TypeInfo_….init one. DMD also
|
||||
// generates them for SomeInterface.classinfo access, so we can't just
|
||||
// distinguish between them using tinfo and thus need to override codegen().
|
||||
void codegen(Ir* p);
|
||||
void codegen(IRState* ir);
|
||||
void llvmDefine();
|
||||
#endif
|
||||
};
|
||||
|
@ -919,7 +919,7 @@ struct FuncDeclaration : Declaration
|
|||
IrFuncTy irFty;
|
||||
|
||||
/// Codegen traversal
|
||||
void codegen(Ir* ir);
|
||||
void codegen(IRState* ir);
|
||||
|
||||
// vars declared in this function that nested funcs reference
|
||||
// is this is not empty, nestedFrameRef is set and these VarDecls
|
||||
|
|
|
@ -95,7 +95,7 @@ struct TYPE;
|
|||
#endif
|
||||
|
||||
#if IN_LLVM
|
||||
class Ir;
|
||||
class IRState;
|
||||
namespace llvm
|
||||
{
|
||||
class Value;
|
||||
|
@ -287,7 +287,7 @@ struct Dsymbol : Object
|
|||
virtual ClassInfoDeclaration* isClassInfoDeclaration() { return NULL; }
|
||||
|
||||
/// Codegen traversal
|
||||
virtual void codegen(Ir* ir);
|
||||
virtual void codegen(IRState* p);
|
||||
|
||||
// llvm stuff
|
||||
int llvmInternal;
|
||||
|
|
|
@ -76,7 +76,7 @@ struct EnumDeclaration : ScopeDsymbol
|
|||
#endif
|
||||
|
||||
#if IN_LLVM
|
||||
void codegen(Ir*);
|
||||
void codegen(IRState*);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ class Library;
|
|||
|
||||
// Back end
|
||||
#if IN_LLVM
|
||||
class Ir;
|
||||
class DValue;
|
||||
typedef DValue elem;
|
||||
namespace llvm {
|
||||
|
@ -196,7 +195,7 @@ struct Module : Package
|
|||
|
||||
#if IN_LLVM
|
||||
// LDC
|
||||
llvm::Module* genLLVMModule(llvm::LLVMContext& context, Ir* sir);
|
||||
llvm::Module* genLLVMModule(llvm::LLVMContext& context);
|
||||
void buildTargetFiles(bool singleObj);
|
||||
File* buildFilePath(const char* forcename, const char* path, const char* ext);
|
||||
Module *isModule() { return this; }
|
||||
|
|
11
dmd2/mtype.c
11
dmd2/mtype.c
|
@ -50,9 +50,6 @@
|
|||
#include "aggregate.h"
|
||||
#include "hdrgen.h"
|
||||
|
||||
#if IN_LLVM
|
||||
Ir* Type::sir = NULL;
|
||||
#endif
|
||||
|
||||
FuncDeclaration *hasThis(Scope *sc);
|
||||
|
||||
|
@ -197,11 +194,7 @@ char Type::needThisPrefix()
|
|||
return 'M'; // name mangling prefix for functions needing 'this'
|
||||
}
|
||||
|
||||
#if IN_LLVM
|
||||
void Type::init(Ir* _sir)
|
||||
#else
|
||||
void Type::init()
|
||||
#endif
|
||||
{
|
||||
stringtable._init(1543);
|
||||
Lexer::initKeywords();
|
||||
|
@ -353,10 +346,6 @@ void Type::init()
|
|||
Tptrdiff_t = Tint32;
|
||||
}
|
||||
|
||||
#if IN_LLVM
|
||||
sir = _sir;
|
||||
#endif
|
||||
|
||||
tsize_t = basic[Tsize_t];
|
||||
tptrdiff_t = basic[Tptrdiff_t];
|
||||
thash_t = tsize_t;
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#if IN_LLVM
|
||||
#include "../ir/irfuncty.h"
|
||||
namespace llvm { class Type; }
|
||||
class Ir;
|
||||
class IrType;
|
||||
#endif
|
||||
|
||||
|
@ -247,11 +246,7 @@ struct Type : Object
|
|||
int covariant(Type *t, StorageClass *pstc = NULL);
|
||||
char *toChars();
|
||||
static char needThisPrefix();
|
||||
#if IN_LLVM
|
||||
static void init(Ir*);
|
||||
#else
|
||||
static void init();
|
||||
#endif
|
||||
|
||||
#define SIZE_INVALID (~(d_uns64)0)
|
||||
d_uns64 size();
|
||||
|
@ -371,7 +366,6 @@ struct Type : Object
|
|||
virtual TypeBasic *isTypeBasic();
|
||||
|
||||
#if IN_LLVM
|
||||
static Ir* sir;
|
||||
IrType* irtype;
|
||||
#endif
|
||||
};
|
||||
|
|
|
@ -356,7 +356,7 @@ struct TemplateInstance : ScopeDsymbol
|
|||
bool ignore; // true if the instance must be ignored when codegen'ing
|
||||
Module* emittedInModule; // which module this template instance has been emitted in
|
||||
|
||||
void codegen(Ir*);
|
||||
void codegen(IRState*);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -386,7 +386,7 @@ struct TemplateMixin : TemplateInstance
|
|||
TemplateMixin *isTemplateMixin() { return this; }
|
||||
|
||||
#if IN_LLVM
|
||||
void codegen(Ir*);
|
||||
void codegen(IRState*);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -614,9 +614,6 @@ int main(int argc, char **argv)
|
|||
if (global.errors)
|
||||
fatal();
|
||||
|
||||
// create a proper target
|
||||
Ir ir;
|
||||
|
||||
// Set up the TargetMachine.
|
||||
ExplicitBitness::Type bitness = ExplicitBitness::None;
|
||||
if ((m32bits || m64bits) && (!mArch.empty() || !mTargetTriple.empty()))
|
||||
|
@ -669,7 +666,7 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
// Initialization
|
||||
Type::init(&ir);
|
||||
Type::init();
|
||||
Id::initialize();
|
||||
Module::init();
|
||||
Target::init();
|
||||
|
@ -987,7 +984,7 @@ int main(int argc, char **argv)
|
|||
printf("code %s\n", m->toChars());
|
||||
if (global.params.obj)
|
||||
{
|
||||
llvm::Module* lm = m->genLLVMModule(context, &ir);
|
||||
llvm::Module* lm = m->genLLVMModule(context);
|
||||
if (!singleObj)
|
||||
{
|
||||
m->deleteObjFile();
|
||||
|
|
|
@ -22,20 +22,19 @@
|
|||
#include "gen/logger.h"
|
||||
#include "gen/tollvm.h"
|
||||
#include "gen/utils.h"
|
||||
#include "ir/ir.h"
|
||||
#include "ir/irtype.h"
|
||||
#include "ir/irvar.h"
|
||||
|
||||
/* ================================================================== */
|
||||
|
||||
void Dsymbol::codegen(Ir*)
|
||||
void Dsymbol::codegen(IRState *)
|
||||
{
|
||||
IF_LOG Logger::println("Ignoring Dsymbol::codegen for %s", toPrettyChars());
|
||||
}
|
||||
|
||||
/* ================================================================== */
|
||||
|
||||
void InterfaceDeclaration::codegen(Ir* p)
|
||||
void InterfaceDeclaration::codegen(IRState *p)
|
||||
{
|
||||
IF_LOG Logger::println("InterfaceDeclaration::codegen: '%s'", toPrettyChars());
|
||||
LOG_SCOPE
|
||||
|
@ -70,7 +69,7 @@ void InterfaceDeclaration::codegen(Ir* p)
|
|||
|
||||
/* ================================================================== */
|
||||
|
||||
void StructDeclaration::codegen(Ir* p)
|
||||
void StructDeclaration::codegen(IRState *p)
|
||||
{
|
||||
IF_LOG Logger::println("StructDeclaration::codegen: '%s'", toPrettyChars());
|
||||
LOG_SCOPE
|
||||
|
@ -104,7 +103,7 @@ void StructDeclaration::codegen(Ir* p)
|
|||
|
||||
/* ================================================================== */
|
||||
|
||||
void ClassDeclaration::codegen(Ir* p)
|
||||
void ClassDeclaration::codegen(IRState *p)
|
||||
{
|
||||
IF_LOG Logger::println("ClassDeclaration::codegen: '%s'", toPrettyChars());
|
||||
LOG_SCOPE
|
||||
|
@ -146,7 +145,7 @@ void ClassDeclaration::codegen(Ir* p)
|
|||
|
||||
/* ================================================================== */
|
||||
|
||||
void TupleDeclaration::codegen(Ir* p)
|
||||
void TupleDeclaration::codegen(IRState *p)
|
||||
{
|
||||
IF_LOG Logger::println("TupleDeclaration::codegen(): '%s'", toPrettyChars());
|
||||
LOG_SCOPE
|
||||
|
@ -169,7 +168,7 @@ void TupleDeclaration::codegen(Ir* p)
|
|||
|
||||
/* ================================================================== */
|
||||
|
||||
void VarDeclaration::codegen(Ir* p)
|
||||
void VarDeclaration::codegen(IRState *p)
|
||||
{
|
||||
IF_LOG Logger::println("VarDeclaration::codegen(): '%s'", toPrettyChars());
|
||||
LOG_SCOPE;
|
||||
|
@ -258,7 +257,7 @@ void VarDeclaration::codegen(Ir* p)
|
|||
|
||||
/* ================================================================== */
|
||||
|
||||
void TypedefDeclaration::codegen(Ir*)
|
||||
void TypedefDeclaration::codegen(IRState *)
|
||||
{
|
||||
IF_LOG Logger::println("TypedefDeclaration::codegen: '%s'", toPrettyChars());
|
||||
LOG_SCOPE;
|
||||
|
@ -277,7 +276,7 @@ void TypedefDeclaration::codegen(Ir*)
|
|||
|
||||
/* ================================================================== */
|
||||
|
||||
void EnumDeclaration::codegen(Ir*)
|
||||
void EnumDeclaration::codegen(IRState *)
|
||||
{
|
||||
IF_LOG Logger::println("Ignoring EnumDeclaration::codegen: '%s'", toPrettyChars());
|
||||
|
||||
|
@ -289,7 +288,7 @@ void EnumDeclaration::codegen(Ir*)
|
|||
|
||||
/* ================================================================== */
|
||||
|
||||
void FuncDeclaration::codegen(Ir* p)
|
||||
void FuncDeclaration::codegen(IRState *p)
|
||||
{
|
||||
// don't touch function aliases, they don't contribute any new symbols
|
||||
if (!isFuncAliasDeclaration())
|
||||
|
@ -300,7 +299,7 @@ void FuncDeclaration::codegen(Ir* p)
|
|||
|
||||
/* ================================================================== */
|
||||
|
||||
void TemplateInstance::codegen(Ir* p)
|
||||
void TemplateInstance::codegen(IRState *p)
|
||||
{
|
||||
IF_LOG Logger::println("TemplateInstance::codegen: '%s'", toPrettyChars());
|
||||
LOG_SCOPE
|
||||
|
@ -319,7 +318,7 @@ void TemplateInstance::codegen(Ir* p)
|
|||
|
||||
/* ================================================================== */
|
||||
|
||||
void TemplateMixin::codegen(Ir* p)
|
||||
void TemplateMixin::codegen(IRState *p)
|
||||
{
|
||||
IF_LOG Logger::println("TemplateInstance::codegen: '%s'", toPrettyChars());
|
||||
LOG_SCOPE
|
||||
|
@ -338,7 +337,7 @@ void TemplateMixin::codegen(Ir* p)
|
|||
|
||||
/* ================================================================== */
|
||||
|
||||
void AttribDeclaration::codegen(Ir* p)
|
||||
void AttribDeclaration::codegen(IRState *p)
|
||||
{
|
||||
Array *d = include(NULL, NULL);
|
||||
|
||||
|
@ -353,7 +352,7 @@ void AttribDeclaration::codegen(Ir* p)
|
|||
|
||||
/* ================================================================== */
|
||||
|
||||
void PragmaDeclaration::codegen(Ir* p)
|
||||
void PragmaDeclaration::codegen(IRState *p)
|
||||
{
|
||||
if (ident == Id::lib)
|
||||
{
|
||||
|
|
|
@ -1210,7 +1210,7 @@ DValue* DtoDeclarationExp(Dsymbol* declaration)
|
|||
// static
|
||||
if (vd->isDataseg())
|
||||
{
|
||||
vd->codegen(Type::sir);
|
||||
vd->codegen(gIR);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1222,19 +1222,19 @@ DValue* DtoDeclarationExp(Dsymbol* declaration)
|
|||
else if (StructDeclaration* s = declaration->isStructDeclaration())
|
||||
{
|
||||
Logger::println("StructDeclaration");
|
||||
s->codegen(Type::sir);
|
||||
s->codegen(gIR);
|
||||
}
|
||||
// function declaration
|
||||
else if (FuncDeclaration* f = declaration->isFuncDeclaration())
|
||||
{
|
||||
Logger::println("FuncDeclaration");
|
||||
f->codegen(Type::sir);
|
||||
f->codegen(gIR);
|
||||
}
|
||||
// class
|
||||
else if (ClassDeclaration* e = declaration->isClassDeclaration())
|
||||
{
|
||||
Logger::println("ClassDeclaration");
|
||||
e->codegen(Type::sir);
|
||||
e->codegen(gIR);
|
||||
}
|
||||
// typedef
|
||||
else if (TypedefDeclaration* tdef = declaration->isTypedefDeclaration())
|
||||
|
@ -1482,7 +1482,7 @@ LLConstant* DtoTypeInfoOf(Type* type, bool base)
|
|||
type->getTypeInfo(NULL);
|
||||
TypeInfoDeclaration* tidecl = type->vtinfo;
|
||||
assert(tidecl);
|
||||
tidecl->codegen(Type::sir);
|
||||
tidecl->codegen(gIR);
|
||||
assert(tidecl->ir.irGlobal != NULL);
|
||||
assert(tidecl->ir.irGlobal->value != NULL);
|
||||
LLConstant* c = isaConstant(tidecl->ir.irGlobal->value);
|
||||
|
|
|
@ -326,7 +326,7 @@ static LLFunction* build_module_reference_and_ctor(LLConstant* moduleinfo)
|
|||
return ctor;
|
||||
}
|
||||
|
||||
llvm::Module* Module::genLLVMModule(llvm::LLVMContext& context, Ir* sir)
|
||||
llvm::Module* Module::genLLVMModule(llvm::LLVMContext& context)
|
||||
{
|
||||
bool logenabled = Logger::enabled();
|
||||
if (llvmForceLogging && !logenabled)
|
||||
|
@ -363,8 +363,6 @@ llvm::Module* Module::genLLVMModule(llvm::LLVMContext& context, Ir* sir)
|
|||
// reset all IR data stored in Dsymbols
|
||||
IrDsymbol::resetAll();
|
||||
|
||||
sir->setState(&ir);
|
||||
|
||||
// set target triple
|
||||
ir.module->setTargetTriple(global.params.targetTriple.str());
|
||||
|
||||
|
@ -395,7 +393,7 @@ llvm::Module* Module::genLLVMModule(llvm::LLVMContext& context, Ir* sir)
|
|||
for (unsigned k=0; k < members->dim; k++) {
|
||||
Dsymbol* dsym = static_cast<Dsymbol*>(members->data[k]);
|
||||
assert(dsym);
|
||||
dsym->codegen(sir);
|
||||
dsym->codegen(&ir);
|
||||
}
|
||||
|
||||
// for singleobj-compilation, fully emit all seen template instances
|
||||
|
@ -405,7 +403,7 @@ llvm::Module* Module::genLLVMModule(llvm::LLVMContext& context, Ir* sir)
|
|||
{
|
||||
IRState::TemplateInstanceSet::iterator it, end = ir.seenTemplateInstances.end();
|
||||
for (it = ir.seenTemplateInstances.begin(); it != end; ++it)
|
||||
(*it)->codegen(sir);
|
||||
(*it)->codegen(&ir);
|
||||
ir.seenTemplateInstances.clear();
|
||||
}
|
||||
}
|
||||
|
@ -426,8 +424,6 @@ llvm::Module* Module::genLLVMModule(llvm::LLVMContext& context, Ir* sir)
|
|||
Logger::disable();
|
||||
}
|
||||
|
||||
sir->setState(NULL);
|
||||
|
||||
return ir.module;
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ void ExpStatement::toNakedIR(IRState *p)
|
|||
|
||||
// make sure the symbols gets processed
|
||||
// TODO: codegen() here is likely incorrect
|
||||
d->declaration->codegen(Type::sir);
|
||||
d->declaration->codegen(p);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -10,14 +10,10 @@
|
|||
#include <assert.h>
|
||||
|
||||
#include "target.h"
|
||||
#include "gen/irstate.h"
|
||||
#include "mars.h"
|
||||
#include "mtype.h"
|
||||
|
||||
unsigned GetTypeAlignment(Type* t);
|
||||
unsigned GetPointerSize();
|
||||
unsigned GetTypeStoreSize(Type* t);
|
||||
unsigned GetTypeAllocSize(Type* t);
|
||||
|
||||
int Target::ptrsize;
|
||||
int Target::realsize;
|
||||
int Target::realpad;
|
||||
|
@ -25,10 +21,12 @@ int Target::realalignsize;
|
|||
|
||||
void Target::init()
|
||||
{
|
||||
ptrsize = GetPointerSize();
|
||||
realsize = GetTypeAllocSize(Type::basic[Tfloat80]);
|
||||
realpad = realsize - GetTypeStoreSize(Type::basic[Tfloat80]);
|
||||
realalignsize = GetTypeAlignment(Type::basic[Tfloat80]);
|
||||
ptrsize = gDataLayout->getPointerSize(ADDRESS_SPACE);
|
||||
|
||||
llvm::Type* real = DtoType(Type::basic[Tfloat80]);
|
||||
realsize = gDataLayout->getTypeAllocSize(real);
|
||||
realpad = realsize - gDataLayout->getTypeStoreSize(real);
|
||||
realalignsize = gDataLayout->getABITypeAlignment(real);
|
||||
}
|
||||
|
||||
/******************************
|
||||
|
@ -39,7 +37,7 @@ unsigned Target::alignsize (Type* type)
|
|||
{
|
||||
assert (type->isTypeBasic());
|
||||
if (type->ty == Tvoid) return 1;
|
||||
return GetTypeAlignment(type);
|
||||
return gDataLayout->getABITypeAlignment(DtoType(type));
|
||||
}
|
||||
|
||||
/******************************
|
||||
|
|
|
@ -2551,7 +2551,7 @@ DValue* DelegateExp::toElem(IRState* p)
|
|||
owner = owner->toParent();
|
||||
if (owner->isTemplateInstance() || owner == p->dmodule)
|
||||
{
|
||||
func->codegen(Type::sir);
|
||||
func->codegen(p);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2800,7 +2800,7 @@ DValue* FuncExp::toElem(IRState* p)
|
|||
|
||||
// We need to actually codegen the function here, as literals are not added
|
||||
// to the module member list.
|
||||
fd->codegen(Type::sir);
|
||||
fd->codegen(p);
|
||||
assert(fd->ir.irFunc->func);
|
||||
|
||||
if (fd->isNested()) {
|
||||
|
@ -2869,7 +2869,7 @@ LLConstant* FuncExp::toConstElem(IRState* p)
|
|||
|
||||
// We need to actually codegen the function here, as literals are not added
|
||||
// to the module member list.
|
||||
fd->codegen(Type::sir);
|
||||
fd->codegen(p);
|
||||
assert(fd->ir.irFunc->func);
|
||||
|
||||
return fd->ir.irFunc->func;
|
||||
|
|
|
@ -152,7 +152,7 @@ Expression *Type::getTypeInfo(Scope *sc)
|
|||
}
|
||||
else // if in obj generation pass
|
||||
{
|
||||
t->vtinfo->codegen(sir);
|
||||
t->vtinfo->codegen(gIR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -317,10 +317,10 @@ void DtoResolveTypeInfo(TypeInfoDeclaration* tid)
|
|||
|
||||
// TypeInfo instances (except ClassInfo ones) are always emitted as weak
|
||||
// symbols when they are used.
|
||||
tid->codegen(Type::sir);
|
||||
tid->codegen(gIR);
|
||||
}
|
||||
|
||||
void TypeInfoDeclaration::codegen(Ir*)
|
||||
void TypeInfoDeclaration::codegen(IRState* p)
|
||||
{
|
||||
Logger::println("TypeInfoDeclaration::codegen(%s)", toPrettyChars());
|
||||
LOG_SCOPE;
|
||||
|
@ -728,7 +728,7 @@ void TypeInfoStructDeclaration::llvmDefine()
|
|||
|
||||
/* ========================================================================= */
|
||||
|
||||
void TypeInfoClassDeclaration::codegen(Ir* p)
|
||||
void TypeInfoClassDeclaration::codegen(IRState *p)
|
||||
{
|
||||
// For classes, the TypeInfo is in fact a ClassInfo instance and emitted
|
||||
// as a __ClassZ symbol. For interfaces, the __InterfaceZ symbol is
|
||||
|
|
49
ir/ir.cpp
49
ir/ir.cpp
|
@ -1,49 +0,0 @@
|
|||
//===-- ir.cpp ------------------------------------------------------------===//
|
||||
//
|
||||
// LDC – the LLVM D compiler
|
||||
//
|
||||
// This file is distributed under the BSD-style LDC license. See the LICENSE
|
||||
// file for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if LDC_LLVM_VER >= 303
|
||||
#include "llvm/IR/DataLayout.h"
|
||||
#elif LDC_LLVM_VER == 302
|
||||
#include "llvm/DataLayout.h"
|
||||
#else
|
||||
#include "llvm/Target/TargetData.h"
|
||||
#endif
|
||||
|
||||
#include "gen/irstate.h"
|
||||
#include "gen/tollvm.h"
|
||||
#include "gen/functions.h"
|
||||
|
||||
#include "ir/ir.h"
|
||||
#include "ir/irfunction.h"
|
||||
|
||||
|
||||
unsigned GetTypeAlignment(Type* t)
|
||||
{
|
||||
return gDataLayout->getABITypeAlignment(DtoType(t));
|
||||
}
|
||||
|
||||
unsigned GetPointerSize()
|
||||
{
|
||||
return gDataLayout->getPointerSize(ADDRESS_SPACE);
|
||||
}
|
||||
|
||||
unsigned GetTypeStoreSize(Type* t)
|
||||
{
|
||||
return gDataLayout->getTypeStoreSize(DtoType(t));
|
||||
}
|
||||
|
||||
unsigned GetTypeAllocSize(Type* t)
|
||||
{
|
||||
return gDataLayout->getTypeAllocSize(DtoType(t));
|
||||
}
|
||||
|
||||
Ir::Ir()
|
||||
: irs(NULL)
|
||||
{
|
||||
}
|
40
ir/ir.h
40
ir/ir.h
|
@ -1,40 +0,0 @@
|
|||
//===-- ir/ir.h - Base definitions for codegen metadata ---------*- C++ -*-===//
|
||||
//
|
||||
// LDC – the LLVM D compiler
|
||||
//
|
||||
// This file is distributed under the BSD-style LDC license. See the LICENSE
|
||||
// file for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Declares the base class for all codegen info classes and the top-level Ir
|
||||
// class.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
||||
#ifndef LDC_IR_IR_H
|
||||
#define LDC_IR_IR_H
|
||||
|
||||
#include "root.h"
|
||||
#include "ir/irforw.h"
|
||||
#include <deque>
|
||||
|
||||
struct IRState;
|
||||
struct IrFunction;
|
||||
|
||||
class Ir
|
||||
{
|
||||
public:
|
||||
Ir();
|
||||
|
||||
void setState(IRState* p) { irs = p; }
|
||||
IRState* getState() { return irs; }
|
||||
|
||||
private:
|
||||
IRState* irs;
|
||||
|
||||
std::deque<IrFunction*> functionbodies;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -15,7 +15,6 @@
|
|||
#ifndef LDC_IR_IRAGGR_H
|
||||
#define LDC_IR_IRAGGR_H
|
||||
|
||||
#include "ir/ir.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
#include "gen/llvm.h"
|
||||
#include "gen/logger.h"
|
||||
#include "ir/ir.h"
|
||||
#include "ir/irdsymbol.h"
|
||||
#include "ir/irvar.h"
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ struct IrParameter;
|
|||
struct IrField;
|
||||
struct IrVar;
|
||||
struct Dsymbol;
|
||||
struct Module;
|
||||
|
||||
namespace llvm {
|
||||
class Value;
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#define LDC_IR_IRFUNCTION_H
|
||||
|
||||
#include "gen/llvm.h"
|
||||
#include "ir/ir.h"
|
||||
#include "ir/irlandingpad.h"
|
||||
#include <map>
|
||||
#include <stack>
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#ifndef LDC_IR_IRFUNCTY_H
|
||||
#define LDC_IR_IRFUNCTY_H
|
||||
|
||||
#include "ir/ir.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#if LDC_LLVM_VER >= 303
|
||||
#include "llvm/IR/Attributes.h"
|
||||
|
@ -27,6 +26,7 @@
|
|||
#include <vector>
|
||||
|
||||
class DValue;
|
||||
struct Type;
|
||||
struct ABIRewrite;
|
||||
namespace llvm {
|
||||
class Type;
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#define LDC_IR_IRLANDINGPADINFO_H
|
||||
|
||||
#include "statement.h"
|
||||
#include "ir/ir.h"
|
||||
#include <deque>
|
||||
#include <stack>
|
||||
|
||||
|
|
|
@ -15,9 +15,11 @@
|
|||
#ifndef LDC_IR_IRMODULE_H
|
||||
#define LDC_IR_IRMODULE_H
|
||||
|
||||
#include "ir/ir.h"
|
||||
|
||||
struct Module;
|
||||
namespace llvm
|
||||
{
|
||||
class GlobalVariable;
|
||||
}
|
||||
|
||||
struct IrModule
|
||||
{
|
||||
|
@ -26,7 +28,7 @@ struct IrModule
|
|||
|
||||
Module* M;
|
||||
|
||||
LLGlobalVariable* fileName;
|
||||
llvm::GlobalVariable* fileName;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#ifndef LDC_IR_IRVAR_H
|
||||
#define LDC_IR_IRVAR_H
|
||||
|
||||
#include "ir/ir.h"
|
||||
#if LDC_LLVM_VER >= 303
|
||||
#include "llvm/IR/Type.h"
|
||||
#else
|
||||
|
@ -23,6 +22,7 @@
|
|||
#endif
|
||||
|
||||
struct IrFuncTyArg;
|
||||
struct VarDeclaration;
|
||||
|
||||
struct IrVar
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue