Attribute holds no longer multiple values in LLVM 3.3.

The solution is to replace Attribute with AttrBuilder in IrFuncTyArg.
Then the argument attributes can be easily manipulated and transformed
into the final AttributeSet.
This commit is contained in:
kai
2013-02-03 15:09:36 +01:00
parent 0ff8d2f9f1
commit f806ec0ed5
6 changed files with 58 additions and 46 deletions

View File

@@ -18,21 +18,20 @@
#include "gen/tollvm.h"
#if LDC_LLVM_VER >= 303
IrFuncTyArg::IrFuncTyArg(Type* t, bool bref, llvm::Attribute a) : type(t)
IrFuncTyArg::IrFuncTyArg(Type* t, bool bref, llvm::AttrBuilder a)
#else
IrFuncTyArg::IrFuncTyArg(Type* t, bool bref, llvm::Attributes a) : type(t)
IrFuncTyArg::IrFuncTyArg(Type* t, bool bref, llvm::Attributes a)
#endif
: type(t),
ltype(t != Type::tvoid && bref ? DtoType(t->pointerTo()) : DtoType(t)),
attrs(a), byref(bref), rewrite(0)
{
ltype = t != Type::tvoid && bref ? DtoType(t->pointerTo()) : DtoType(t);
attrs = a;
byref = bref;
rewrite = NULL;
}
#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); }
bool IrFuncTyArg::isInReg() const { return attrs.contains(llvm::Attribute::InReg); }
bool IrFuncTyArg::isSRet() const { return attrs.contains(llvm::Attribute::StructRet); }
bool IrFuncTyArg::isByVal() const { return attrs.contains(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); }

View File

@@ -49,7 +49,7 @@ 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;
llvm::AttrBuilder attrs;
#else
llvm::Attributes attrs;
#endif
@@ -76,7 +76,7 @@ struct IrFuncTyArg : IrBase
* LLVM Type will be of DtoType(type->pointerTo()), instead
* of just DtoType(type) */
#if LDC_LLVM_VER >= 303
IrFuncTyArg(Type* t, bool byref, llvm::Attribute a = llvm::Attribute());
IrFuncTyArg(Type* t, bool byref, llvm::AttrBuilder b = llvm::AttrBuilder());
#elif LDC_LLVM_VER == 302
IrFuncTyArg(Type* t, bool byref, llvm::Attributes a = llvm::Attributes());
#else