LLVM 3.3: class Attributes is renamed to Attribute.

Some other renamings took place in "llvm/Attributes.h" but only this causes
compile errors in LDC.
Also uses new location of "llvm/IRBuilder.h".
This commit is contained in:
kai
2012-12-21 17:32:17 +01:00
parent 9d9f827efb
commit 5f37ae30cf
11 changed files with 170 additions and 38 deletions

View File

@@ -72,7 +72,10 @@ IrFunction::IrFunction(FuncDeclaration* fd)
void IrFunction::setNeverInline()
{
#if LDC_LLVM_VER >= 302
#if LDC_LLVM_VER >= 303
assert(!func->getFnAttributes().hasAttribute(llvm::Attribute::AlwaysInline) && "function can't be never- and always-inline at the same time");
func->addFnAttr(llvm::Attribute::NoInline);
#elif LDC_LLVM_VER == 302
assert(!func->getFnAttributes().hasAttribute(llvm::Attributes::AlwaysInline) && "function can't be never- and always-inline at the same time");
func->addFnAttr(llvm::Attributes::NoInline);
#else
@@ -83,7 +86,10 @@ void IrFunction::setNeverInline()
void IrFunction::setAlwaysInline()
{
#if LDC_LLVM_VER >= 302
#if LDC_LLVM_VER >= 303
assert(!func->getFnAttributes().hasAttribute(llvm::Attribute::NoInline) && "function can't be never- and always-inline at the same time");
func->addFnAttr(llvm::Attribute::AlwaysInline);
#elif LDC_LLVM_VER == 302
assert(!func->getFnAttributes().hasAttribute(llvm::Attributes::NoInline) && "function can't be never- and always-inline at the same time");
func->addFnAttr(llvm::Attributes::AlwaysInline);
#else

View File

@@ -17,7 +17,11 @@
#include "gen/llvm.h"
#include "gen/tollvm.h"
#if LDC_LLVM_VER >= 303
IrFuncTyArg::IrFuncTyArg(Type* t, bool bref, llvm::Attribute a) : type(t)
#else
IrFuncTyArg::IrFuncTyArg(Type* t, bool bref, llvm::Attributes a) : type(t)
#endif
{
ltype = t != Type::tvoid && bref ? DtoType(t->pointerTo()) : DtoType(t);
attrs = a;
@@ -25,7 +29,11 @@ IrFuncTyArg::IrFuncTyArg(Type* t, bool bref, llvm::Attributes a) : type(t)
rewrite = NULL;
}
#if LDC_LLVM_VER >= 302
#if LDC_LLVM_VER >= 303
bool IrFuncTyArg::isInReg() const { return attrs.hasAttribute(llvm::Attribute::InReg); }
bool IrFuncTyArg::isSRet() const { return attrs.hasAttribute(llvm::Attribute::StructRet); }
bool IrFuncTyArg::isByVal() const { return attrs.hasAttribute(llvm::Attribute::ByVal); }
#elif LDC_LLVM_VER == 302
bool IrFuncTyArg::isInReg() const { return attrs.hasAttribute(llvm::Attributes::InReg); }
bool IrFuncTyArg::isSRet() const { return attrs.hasAttribute(llvm::Attributes::StructRet); }
bool IrFuncTyArg::isByVal() const { return attrs.hasAttribute(llvm::Attributes::ByVal); }

View File

@@ -44,7 +44,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 >= 303
llvm::Attribute 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
@@ -67,7 +71,9 @@ 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 >= 302
#if LDC_LLVM_VER >= 303
IrFuncTyArg(Type* t, bool byref, llvm::Attribute a = llvm::Attribute());
#elif LDC_LLVM_VER == 302
IrFuncTyArg(Type* t, bool byref, llvm::Attributes a = llvm::Attributes());
#else
IrFuncTyArg(Type* t, bool byref, llvm::Attributes a = llvm::Attribute::None);