From 5139008207000d7eeb226236c2545bf4297f96d0 Mon Sep 17 00:00:00 2001 From: Kai Nacke Date: Tue, 31 Dec 2013 16:43:54 +0100 Subject: [PATCH 1/3] Add missing forward declations to gen/utils.h --- gen/utils.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gen/utils.h b/gen/utils.h index b2c57b24..4ef77bc5 100644 --- a/gen/utils.h +++ b/gen/utils.h @@ -73,6 +73,11 @@ struct ArrayIter } }; +// From dsymbol.h / declaration.h +struct Dsymbol; +struct FuncDeclaration; +struct VarDeclaration; + // some aliases typedef ArrayIter DsymbolIter; typedef ArrayIter FuncDeclarationIter; From 1619b18f733ca033791447f96e28570ba10fe67a Mon Sep 17 00:00:00 2001 From: Kai Nacke Date: Tue, 31 Dec 2013 17:09:08 +0100 Subject: [PATCH 2/3] Small cleanup of attribute mess. --- gen/functions.cpp | 42 +++++++++++++----------------------------- 1 file changed, 13 insertions(+), 29 deletions(-) diff --git a/gen/functions.cpp b/gen/functions.cpp index 0bc62414..cccb84e6 100644 --- a/gen/functions.cpp +++ b/gen/functions.cpp @@ -36,8 +36,11 @@ #include "llvm/Support/CFG.h" #include -#if LDC_LLVM_VER < 302 -using namespace llvm::Attribute; +#if LDC_LLVM_VER == 302 +namespace llvm +{ + typedef llvm::Attributes Attribute; +} #endif llvm::FunctionType* DtoFunctionType(Type* type, IrFuncTy &irFty, Type* thistype, Type* nesttype, bool isMain, bool isCtor) @@ -76,7 +79,7 @@ llvm::FunctionType* DtoFunctionType(Type* type, IrFuncTy &irFty, Type* thistype, #if LDC_LLVM_VER >= 302 llvm::AttrBuilder attrBuilder; #else - llvm::Attributes a = None; + llvm::Attributes a = llvm::Attribute::None; #endif // sret return @@ -97,8 +100,8 @@ llvm::FunctionType* DtoFunctionType(Type* type, IrFuncTy &irFty, Type* thistype, #endif ); #else - newIrFty.arg_sret = new IrFuncTyArg(rt, true, StructRet | NoAlias - ); + newIrFty.arg_sret = new IrFuncTyArg(rt, true, + llvm::Attribute::StructRet | llvm::Attribute::NoAlias); #endif rt = Type::tvoid; lidx++; @@ -173,7 +176,8 @@ llvm::FunctionType* DtoFunctionType(Type* type, IrFuncTy &irFty, Type* thistype, llvm::Attributes::get(gIR->context(), llvm::AttrBuilder().addAttribute(llvm::Attributes::NoAlias) .addAttribute(llvm::Attributes::NoCapture))); #else - newIrFty.arg_argptr = new IrFuncTyArg(Type::tvoid->pointerTo(), false, NoAlias | NoCapture); + newIrFty.arg_argptr = new IrFuncTyArg(Type::tvoid->pointerTo(), false, + llvm::Attribute::NoAlias | llvm::Attribute::NoCapture); #endif lidx++; } @@ -208,7 +212,7 @@ llvm::FunctionType* DtoFunctionType(Type* type, IrFuncTy &irFty, Type* thistype, #if LDC_LLVM_VER >= 302 llvm::AttrBuilder attrBuilder; #else - llvm::Attributes a = None; + llvm::Attributes a = llvm::Attribute::None; #endif // handle lazy args @@ -222,10 +226,8 @@ llvm::FunctionType* DtoFunctionType(Type* type, IrFuncTy &irFty, Type* thistype, // byval else if (abi->passByVal(byref ? argtype->pointerTo() : argtype)) { -#if LDC_LLVM_VER >= 303 +#if LDC_LLVM_VER >= 302 if (!byref) attrBuilder.addAttribute(llvm::Attribute::ByVal); -#elif LDC_LLVM_VER == 302 - if (!byref) attrBuilder.addAttribute(llvm::Attributes::ByVal); #else if (!byref) a |= llvm::Attribute::ByVal; #endif @@ -366,13 +368,7 @@ LLFunction* DtoInlineIRFunction(FuncDeclaration* fdecl) LLFunction* fun = gIR->module->getFunction(mangled_name); fun->setLinkage(llvm::GlobalValue::LinkOnceODRLinkage); -#if LDC_LLVM_VER >= 303 fun->addFnAttr(llvm::Attribute::AlwaysInline); -#elif LDC_LLVM_VER == 302 - fun->addFnAttr(llvm::Attributes::AlwaysInline); -#else - fun->addFnAttr(AlwaysInline); -#endif return fun; } @@ -630,7 +626,7 @@ static void set_param_attrs(TypeFunction* f, llvm::Function* func, FuncDeclarati #if LDC_LLVM_VER == 302 LLSmallVector attrptr(n, llvm::Attributes()); #else - LLSmallVector attrptr(n, None); + LLSmallVector attrptr(n, llvm::Attribute::None); #endif for (size_t k = 0; k < n; ++k) @@ -782,13 +778,7 @@ void DtoDeclareFunction(FuncDeclaration* fdecl) if (!fdecl->isIntrinsic()) { set_param_attrs(f, func, fdecl); if (global.params.disableRedZone) { -#if LDC_LLVM_VER >= 303 func->addFnAttr(llvm::Attribute::NoRedZone); -#elif LDC_LLVM_VER == 302 - func->addFnAttr(llvm::Attributes::NoRedZone); -#else - func->addFnAttr(NoRedZone); -#endif } } @@ -978,13 +968,7 @@ void DtoDefineFunction(FuncDeclaration* fd) // TODO: Find a better place for this. if (global.params.targetTriple.getArch() == llvm::Triple::x86_64) { -#if LDC_LLVM_VER >= 303 func->addFnAttr(llvm::Attribute::UWTable); -#elif LDC_LLVM_VER == 302 - func->addFnAttr(llvm::Attributes::UWTable); -#else - func->addFnAttr(UWTable); -#endif } std::string entryname("entry"); From 535221e16dcd00869707dea9689f0943c56bd25d Mon Sep 17 00:00:00 2001 From: Kai Nacke Date: Thu, 2 Jan 2014 15:57:49 +0100 Subject: [PATCH 3/3] Add llvm-config-3.5 to search list --- cmake/Modules/FindLLVM.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/Modules/FindLLVM.cmake b/cmake/Modules/FindLLVM.cmake index aabf08d4..f864a48d 100644 --- a/cmake/Modules/FindLLVM.cmake +++ b/cmake/Modules/FindLLVM.cmake @@ -27,7 +27,7 @@ # We also want an user-specified LLVM_ROOT_DIR to take precedence over the # system default locations such as /usr/local/bin. Executing find_program() # multiples times is the approach recommended in the docs. -set(llvm_config_names llvm-config-3.4 llvm-config-3.3 llvm-config-3.2 llvm-config-3.1 llvm-config) +set(llvm_config_names llvm-config-3.5 llvm-config-3.4 llvm-config-3.3 llvm-config-3.2 llvm-config-3.1 llvm-config) find_program(LLVM_CONFIG NAMES ${llvm_config_names} PATHS ${LLVM_ROOT_DIR}/bin NO_DEFAULT_PATH