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

@@ -534,7 +534,8 @@ void X86_64TargetABI::rewriteFunctionType(TypeFunction* tf) {
{
Logger::println("Putting 'this' in register");
#if LDC_LLVM_VER >= 303
fty.arg_this->attrs = llvm::Attribute::get(gIR->context(), llvm::AttrBuilder().addAttribute(llvm::Attribute::InReg));
fty.arg_this->attrs.clear();
fty.arg_this->attrs.addAttribute(llvm::Attribute::InReg);
#elif LDC_LLVM_VER == 302
fty.arg_this->attrs = llvm::Attributes::get(gIR->context(), llvm::AttrBuilder().addAttribute(llvm::Attributes::InReg));
#else
@@ -546,7 +547,8 @@ void X86_64TargetABI::rewriteFunctionType(TypeFunction* tf) {
{
Logger::println("Putting context ptr in register");
#if LDC_LLVM_VER >= 303
fty.arg_nest->attrs = llvm::Attribute::get(gIR->context(), llvm::AttrBuilder().addAttribute(llvm::Attribute::InReg));
fty.arg_nest->attrs.clear();
fty.arg_nest->attrs.addAttribute(llvm::Attribute::InReg);
#elif LDC_LLVM_VER == 302
fty.arg_nest->attrs = llvm::Attributes::get(gIR->context(), llvm::AttrBuilder().addAttribute(llvm::Attributes::InReg));
#else
@@ -560,8 +562,7 @@ void X86_64TargetABI::rewriteFunctionType(TypeFunction* tf) {
// sret and inreg are incompatible, but the ABI requires the
// sret parameter to be in RDI in this situation...
#if LDC_LLVM_VER >= 303
sret->attrs = llvm::Attribute::get(gIR->context(), llvm::AttrBuilder(sret->attrs).addAttribute(llvm::Attribute::InReg)
.removeAttribute(llvm::Attribute::StructRet));
sret->attrs.addAttribute(llvm::Attribute::InReg).removeAttribute(llvm::Attribute::StructRet);
#elif LDC_LLVM_VER == 302
sret->attrs = llvm::Attributes::get(gIR->context(), llvm::AttrBuilder(sret->attrs).addAttribute(llvm::Attributes::InReg)
.removeAttribute(llvm::Attributes::StructRet));
@@ -586,7 +587,7 @@ void X86_64TargetABI::rewriteFunctionType(TypeFunction* tf) {
if (xmmcount > 0) {
Logger::println("Putting float parameter in register");
#if LDC_LLVM_VER >= 303
arg.attrs = llvm::Attribute::get(gIR->context(), llvm::AttrBuilder(arg.attrs).addAttribute(llvm::Attribute::InReg));
arg.attrs.addAttribute(llvm::Attribute::InReg);
#elif LDC_LLVM_VER == 302
arg.attrs = llvm::Attributes::get(gIR->context(), llvm::AttrBuilder(arg.attrs).addAttribute(llvm::Attributes::InReg));
#else
@@ -603,7 +604,7 @@ void X86_64TargetABI::rewriteFunctionType(TypeFunction* tf) {
{
Logger::println("Putting byref parameter in register");
#if LDC_LLVM_VER >= 303
arg.attrs = llvm::Attribute::get(gIR->context(), llvm::AttrBuilder(arg.attrs).addAttribute(llvm::Attribute::InReg));
arg.attrs.addAttribute(llvm::Attribute::InReg);
#elif LDC_LLVM_VER == 302
arg.attrs = llvm::Attributes::get(gIR->context(), llvm::AttrBuilder(arg.attrs).addAttribute(llvm::Attributes::InReg));
#else
@@ -615,7 +616,7 @@ void X86_64TargetABI::rewriteFunctionType(TypeFunction* tf) {
{
Logger::println("Putting pointer parameter in register");
#if LDC_LLVM_VER >= 303
arg.attrs = llvm::Attribute::get(gIR->context(), llvm::AttrBuilder(arg.attrs).addAttribute(llvm::Attribute::InReg));
arg.attrs.addAttribute(llvm::Attribute::InReg);
#elif LDC_LLVM_VER == 302
arg.attrs = llvm::Attributes::get(gIR->context(), llvm::AttrBuilder(arg.attrs).addAttribute(llvm::Attributes::InReg));
#else
@@ -627,7 +628,7 @@ void X86_64TargetABI::rewriteFunctionType(TypeFunction* tf) {
{
Logger::println("Putting integral parameter in register");
#if LDC_LLVM_VER >= 303
arg.attrs = llvm::Attribute::get(gIR->context(), llvm::AttrBuilder(arg.attrs).addAttribute(llvm::Attribute::InReg));
arg.attrs.addAttribute(llvm::Attribute::InReg);
#elif LDC_LLVM_VER == 302
arg.attrs = llvm::Attributes::get(gIR->context(), llvm::AttrBuilder(arg.attrs).addAttribute(llvm::Attributes::InReg));
#else
@@ -643,7 +644,8 @@ void X86_64TargetABI::rewriteFunctionType(TypeFunction* tf) {
arg.ltype = compositeToInt.type(arg.type, arg.ltype);
arg.byref = false;
#if LDC_LLVM_VER >= 303
arg.attrs = llvm::Attribute::get(gIR->context(), llvm::AttrBuilder().addAttribute(llvm::Attribute::InReg));
arg.attrs.clear();
arg.attrs.addAttribute(llvm::Attribute::InReg);
#elif LDC_LLVM_VER == 302
arg.attrs = llvm::Attributes::get(gIR->context(), llvm::AttrBuilder().addAttribute(llvm::Attributes::InReg));
#else