From e13b11558374e18ac5436089401525f07a569b29 Mon Sep 17 00:00:00 2001 From: kai Date: Sun, 29 Jul 2012 14:22:56 +0200 Subject: [PATCH] More unification work. --- dmd/mars.c | 2 +- dmd2/mars.c | 2 +- gen/tollvm.h | 4 ++++ ir/irfuncty.h | 11 +++++++++++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/dmd/mars.c b/dmd/mars.c index 9fb526cb..285412be 100644 --- a/dmd/mars.c +++ b/dmd/mars.c @@ -74,7 +74,7 @@ Global::Global() written = "written by Walter Bright and Tomas Lindquist Olsen"; version = "v1.074"; ldc_version = "LDC trunk"; - llvm_version = "LLVM 3.0"; + llvm_version = "LLVM "LDC_LLVM_VERSION_STRING; global.structalign = 8; // This should only be used as a global, so the other fields are diff --git a/dmd2/mars.c b/dmd2/mars.c index c4150149..9ccf07d7 100644 --- a/dmd2/mars.c +++ b/dmd2/mars.c @@ -104,7 +104,7 @@ Global::Global() version = "v2.059"; #if IN_LLVM ldc_version = "LDC trunk"; - llvm_version = "LLVM 3.0"; + llvm_version = "LLVM "LDC_LLVM_VERSION_STRING; #endif global.structalign = 8; diff --git a/gen/tollvm.h b/gen/tollvm.h index bfa237f1..7d1700cf 100644 --- a/gen/tollvm.h +++ b/gen/tollvm.h @@ -19,7 +19,11 @@ LLType* DtoTypeNotVoid(Type* t); bool DtoIsPassedByRef(Type* type); // should argument be zero or sign extended +#if LDC_LLVM_VER == 300 unsigned DtoShouldExtend(Type* type); +#else +llvm::Attributes DtoShouldExtend(Type* type); +#endif // tuple helper // takes a arguments list and makes a struct type out of them diff --git a/ir/irfuncty.h b/ir/irfuncty.h index 34aa28b0..bf59d08b 100644 --- a/ir/irfuncty.h +++ b/ir/irfuncty.h @@ -3,6 +3,9 @@ #include "ir/ir.h" #include "llvm/ADT/SmallVector.h" +#if LDC_LLVM_VER >= 301 +#include "llvm/Attributes.h" +#endif #include @@ -27,7 +30,11 @@ struct IrFuncTyArg : IrBase /** These are the final LLVM attributes used for the function. * Must be valid for the LLVM Type and byref setting */ +#if LDC_LLVM_VER == 300 unsigned attrs; +#else + llvm::Attributes attrs; +#endif /** 'true' if the final LLVM argument is a LLVM reference type. * Must be true when the D Type is a value type, but the final @@ -50,7 +57,11 @@ struct IrFuncTyArg : IrBase * @param byref Initial value for the 'byref' field. If true the initial * LLVM Type will be of DtoType(type->pointerTo()), instead * of just DtoType(type) */ +#if LDC_LLVM_VER == 300 IrFuncTyArg(Type* t, bool byref, unsigned a = 0); +#else + IrFuncTyArg(Type* t, bool byref, llvm::Attributes a = llvm::Attribute::None); +#endif }; // represents a function type