From 1242be25d0e3cc3d639f3d8b2e4cc685ba4b57e1 Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Sun, 13 Oct 2013 19:44:29 +0200 Subject: [PATCH] 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. --- dmd2/aggregate.h | 6 +++--- dmd2/attrib.h | 4 ++-- dmd2/declaration.h | 12 +++++------ dmd2/dsymbol.h | 4 ++-- dmd2/enum.h | 2 +- dmd2/module.h | 3 +-- dmd2/mtype.c | 11 ---------- dmd2/mtype.h | 6 ------ dmd2/template.h | 4 ++-- driver/main.cpp | 7 ++----- gen/declarations.cpp | 27 ++++++++++++------------ gen/llvmhelpers.cpp | 10 ++++----- gen/module.cpp | 10 +++------ gen/naked.cpp | 2 +- gen/target.cpp | 18 ++++++++-------- gen/toir.cpp | 6 +++--- gen/typinf.cpp | 8 ++++---- ir/ir.cpp | 49 -------------------------------------------- ir/ir.h | 40 ------------------------------------ ir/iraggr.h | 1 - ir/irdsymbol.cpp | 1 - ir/irdsymbol.h | 1 + ir/irfunction.h | 1 - ir/irfuncty.h | 2 +- ir/irlandingpad.h | 1 - ir/irmodule.h | 8 +++++--- ir/irvar.h | 2 +- 27 files changed, 64 insertions(+), 182 deletions(-) delete mode 100644 ir/ir.cpp delete mode 100644 ir/ir.h diff --git a/dmd2/aggregate.h b/dmd2/aggregate.h index 518cae13..603d9774 100644 --- a/dmd2/aggregate.h +++ b/dmd2/aggregate.h @@ -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 }; diff --git a/dmd2/attrib.h b/dmd2/attrib.h index 42ca18ae..760d3ed0 100644 --- a/dmd2/attrib.h +++ b/dmd2/attrib.h @@ -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 }; diff --git a/dmd2/declaration.h b/dmd2/declaration.h index a503a20d..ee57cdfd 100644 --- a/dmd2/declaration.h +++ b/dmd2/declaration.h @@ -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 diff --git a/dmd2/dsymbol.h b/dmd2/dsymbol.h index 585aae33..a10a46e9 100644 --- a/dmd2/dsymbol.h +++ b/dmd2/dsymbol.h @@ -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; diff --git a/dmd2/enum.h b/dmd2/enum.h index b9e2255c..8efabeaa 100644 --- a/dmd2/enum.h +++ b/dmd2/enum.h @@ -76,7 +76,7 @@ struct EnumDeclaration : ScopeDsymbol #endif #if IN_LLVM - void codegen(Ir*); + void codegen(IRState*); #endif }; diff --git a/dmd2/module.h b/dmd2/module.h index c2365545..7d616e61 100644 --- a/dmd2/module.h +++ b/dmd2/module.h @@ -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; } diff --git a/dmd2/mtype.c b/dmd2/mtype.c index 89690046..dbea4b6c 100644 --- a/dmd2/mtype.c +++ b/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; diff --git a/dmd2/mtype.h b/dmd2/mtype.h index c61b0ba1..7aa4075f 100644 --- a/dmd2/mtype.h +++ b/dmd2/mtype.h @@ -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 }; diff --git a/dmd2/template.h b/dmd2/template.h index ddb2a5b5..12d0783f 100644 --- a/dmd2/template.h +++ b/dmd2/template.h @@ -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 }; diff --git a/driver/main.cpp b/driver/main.cpp index f349cc4a..ee3d8b12 100644 --- a/driver/main.cpp +++ b/driver/main.cpp @@ -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(); diff --git a/gen/declarations.cpp b/gen/declarations.cpp index 87faaf59..64de6ec8 100644 --- a/gen/declarations.cpp +++ b/gen/declarations.cpp @@ -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) { diff --git a/gen/llvmhelpers.cpp b/gen/llvmhelpers.cpp index de034092..e2cef943 100644 --- a/gen/llvmhelpers.cpp +++ b/gen/llvmhelpers.cpp @@ -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); diff --git a/gen/module.cpp b/gen/module.cpp index e894912b..3974b1e9 100644 --- a/gen/module.cpp +++ b/gen/module.cpp @@ -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(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; } diff --git a/gen/naked.cpp b/gen/naked.cpp index 7850dc6e..0e598091 100644 --- a/gen/naked.cpp +++ b/gen/naked.cpp @@ -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); } ////////////////////////////////////////////////////////////////////////////////////////// diff --git a/gen/target.cpp b/gen/target.cpp index f4babdfa..6c2b8f39 100644 --- a/gen/target.cpp +++ b/gen/target.cpp @@ -10,14 +10,10 @@ #include #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)); } /****************************** diff --git a/gen/toir.cpp b/gen/toir.cpp index 6106dff2..2f3acc09 100644 --- a/gen/toir.cpp +++ b/gen/toir.cpp @@ -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; diff --git a/gen/typinf.cpp b/gen/typinf.cpp index bb99c1ce..561cb516 100644 --- a/gen/typinf.cpp +++ b/gen/typinf.cpp @@ -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 diff --git a/ir/ir.cpp b/ir/ir.cpp deleted file mode 100644 index 8cf64d92..00000000 --- a/ir/ir.cpp +++ /dev/null @@ -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) -{ -} diff --git a/ir/ir.h b/ir/ir.h deleted file mode 100644 index 505b23de..00000000 --- a/ir/ir.h +++ /dev/null @@ -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 - -struct IRState; -struct IrFunction; - -class Ir -{ -public: - Ir(); - - void setState(IRState* p) { irs = p; } - IRState* getState() { return irs; } - -private: - IRState* irs; - - std::deque functionbodies; -}; - -#endif diff --git a/ir/iraggr.h b/ir/iraggr.h index 87e53764..99d88d67 100644 --- a/ir/iraggr.h +++ b/ir/iraggr.h @@ -15,7 +15,6 @@ #ifndef LDC_IR_IRAGGR_H #define LDC_IR_IRAGGR_H -#include "ir/ir.h" #include "llvm/ADT/SmallVector.h" #include #include diff --git a/ir/irdsymbol.cpp b/ir/irdsymbol.cpp index d16565e6..9a2dded0 100644 --- a/ir/irdsymbol.cpp +++ b/ir/irdsymbol.cpp @@ -9,7 +9,6 @@ #include "gen/llvm.h" #include "gen/logger.h" -#include "ir/ir.h" #include "ir/irdsymbol.h" #include "ir/irvar.h" diff --git a/ir/irdsymbol.h b/ir/irdsymbol.h index 546b7891..62131628 100644 --- a/ir/irdsymbol.h +++ b/ir/irdsymbol.h @@ -25,6 +25,7 @@ struct IrParameter; struct IrField; struct IrVar; struct Dsymbol; +struct Module; namespace llvm { class Value; diff --git a/ir/irfunction.h b/ir/irfunction.h index 7bfa1423..55727ef4 100644 --- a/ir/irfunction.h +++ b/ir/irfunction.h @@ -17,7 +17,6 @@ #define LDC_IR_IRFUNCTION_H #include "gen/llvm.h" -#include "ir/ir.h" #include "ir/irlandingpad.h" #include #include diff --git a/ir/irfuncty.h b/ir/irfuncty.h index 43a468fa..66efc566 100644 --- a/ir/irfuncty.h +++ b/ir/irfuncty.h @@ -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 class DValue; +struct Type; struct ABIRewrite; namespace llvm { class Type; diff --git a/ir/irlandingpad.h b/ir/irlandingpad.h index c70a1ded..b1116ea8 100644 --- a/ir/irlandingpad.h +++ b/ir/irlandingpad.h @@ -16,7 +16,6 @@ #define LDC_IR_IRLANDINGPADINFO_H #include "statement.h" -#include "ir/ir.h" #include #include diff --git a/ir/irmodule.h b/ir/irmodule.h index e69545e2..bf5ee250 100644 --- a/ir/irmodule.h +++ b/ir/irmodule.h @@ -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 diff --git a/ir/irvar.h b/ir/irvar.h index 50ab184a..d4b00663 100644 --- a/ir/irvar.h +++ b/ir/irvar.h @@ -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 {