[llvm-commits] [dragonegg] r165919 - in /dragonegg/trunk/src: Convert.cpp DefaultABI.cpp TypeConversion.cpp
Bill Wendling
isanbard at gmail.com
Sun Oct 14 21:52:59 PDT 2012
Author: void
Date: Sun Oct 14 23:52:59 2012
New Revision: 165919
URL: http://llvm.org/viewvc/llvm-project?rev=165919&view=rev
Log:
Attempt to convert to new Attributes format.
Modified:
dragonegg/trunk/src/Convert.cpp
dragonegg/trunk/src/DefaultABI.cpp
dragonegg/trunk/src/TypeConversion.cpp
Modified: dragonegg/trunk/src/Convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Convert.cpp?rev=165919&r1=165918&r2=165919&view=diff
==============================================================================
--- dragonegg/trunk/src/Convert.cpp (original)
+++ dragonegg/trunk/src/Convert.cpp Sun Oct 14 23:52:59 2012
@@ -3248,7 +3248,8 @@
// This call does not throw - mark it 'nounwind'.
Attributes::Builder B;
B.addAttribute(Attributes::NoUnwind);
- PAL = PAL.addAttr(Callee->getContext(), ~0, Attributes::get(B));
+ PAL = PAL.addAttr(Callee->getContext(), ~0,
+ Attributes::get(Callee->getContext(), B));
}
if (!PAL.getFnAttributes().hasAttribute(Attributes::NoUnwind)) {
Modified: dragonegg/trunk/src/DefaultABI.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/DefaultABI.cpp?rev=165919&r1=165918&r2=165919&view=diff
==============================================================================
--- dragonegg/trunk/src/DefaultABI.cpp (original)
+++ dragonegg/trunk/src/DefaultABI.cpp Sun Oct 14 23:52:59 2012
@@ -217,7 +217,8 @@
Attributes::Builder B;
B.addAttribute(Attributes::ByVal);
B.addAlignmentAttr(LLVM_BYVAL_ALIGNMENT(type));
- *Attributes = Attributes::get(B.addAttributes(*Attributes));
+ *Attributes = Attributes::get(Ty->getContext(),
+ B.addAttributes(*Attributes));
}
} else {
C.HandleScalarArgument(Ty, type);
@@ -244,7 +245,8 @@
Attributes::Builder B;
B.addAttribute(Attributes::ByVal);
B.addAlignmentAttr(LLVM_BYVAL_ALIGNMENT(type));
- *Attributes = Attributes::get(B.addAttributes(*Attributes));
+ *Attributes = Attributes::get(Ty->getContext(),
+ B.addAttributes(*Attributes));
}
}
} else if (LLVM_SHOULD_PASS_AGGREGATE_USING_BYVAL_ATTR(type, Ty)) {
@@ -253,7 +255,8 @@
Attributes::Builder B;
B.addAttribute(Attributes::ByVal);
B.addAlignmentAttr(LLVM_BYVAL_ALIGNMENT(type));
- *Attributes = Attributes::get(B.addAttributes(*Attributes));
+ *Attributes = Attributes::get(Ty->getContext(),
+ B.addAttributes(*Attributes));
}
} else if (LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(type, &Size,
&DontCheckAlignment)) {
Modified: dragonegg/trunk/src/TypeConversion.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/TypeConversion.cpp?rev=165919&r1=165918&r2=165919&view=diff
==============================================================================
--- dragonegg/trunk/src/TypeConversion.cpp (original)
+++ dragonegg/trunk/src/TypeConversion.cpp Sun Oct 14 23:52:59 2012
@@ -640,16 +640,16 @@
};
}
-static Attributes HandleArgumentExtension(tree ArgTy) {
+static Attributes HandleArgumentExtension(LLVMContext &C, tree ArgTy) {
if (isa<BOOLEAN_TYPE>(ArgTy)) {
if (TREE_INT_CST_LOW(TYPE_SIZE(ArgTy)) < INT_TYPE_SIZE)
- return Attributes::get(Attributes::Builder().addAttribute(Attributes::ZExt));
+ return Attributes::get(C, Attributes::Builder().addAttribute(Attributes::ZExt));
} else if (isa<INTEGER_TYPE>(ArgTy) &&
TREE_INT_CST_LOW(TYPE_SIZE(ArgTy)) < INT_TYPE_SIZE) {
if (TYPE_UNSIGNED(ArgTy))
- return Attributes::get(Attributes::Builder().addAttribute(Attributes::ZExt));
+ return Attributes::get(C, Attributes::Builder().addAttribute(Attributes::ZExt));
else
- return Attributes::get(Attributes::Builder().addAttribute(Attributes::SExt));
+ return Attributes::get(C, Attributes::Builder().addAttribute(Attributes::SExt));
}
return Attributes();
@@ -680,9 +680,10 @@
ABIConverter.HandleReturnType(ReturnType, current_function_decl, false);
SmallVector<AttributeWithIndex, 8> Attrs;
+ LLVMContext &Context = RetTy->getContext()
// Compute whether the result needs to be zext or sext'd.
- Attributes RAttributes = HandleArgumentExtension(ReturnType);
+ Attributes RAttributes = HandleArgumentExtension(Context, ReturnType);
// Allow the target to change the attributes.
#ifdef TARGET_ADJUST_LLVM_RETATTR
@@ -699,7 +700,7 @@
B.addAttribute(Attributes::StructRet)
.addAttribute(Attributes::NoAlias);
Attrs.push_back(AttributeWithIndex::get(ArgTys.size(),
- Attributes::get(B)));
+ Attributes::get(Context, B)));
}
std::vector<Type*> ScalarArgs;
@@ -710,7 +711,7 @@
Attributes::Builder B;
B.addAttribute(Attributes::Nest);
Attrs.push_back(AttributeWithIndex::get(ArgTys.size(),
- Attributes::get(B)));
+ Attributes::get(Context, B)));
}
for (ArrayRef<tree>::iterator I = Args.begin(), E = Args.end(); I != E; ++I) {
@@ -722,14 +723,14 @@
ABIConverter.HandleArgument(ArgTy, ScalarArgs, &PAttributes);
// Compute zext/sext attributes.
- PAttributes |= HandleArgumentExtension(ArgTy);
+ PAttributes |= HandleArgumentExtension(Context, ArgTy);
// Compute noalias attributes.
Attributes::Builder B;
if (isa<ACCESS_TYPE>(ArgTy) && TYPE_RESTRICT(ArgTy))
B.addAttribute(Attributes::NoAlias);
- PAttributes |= Attributes::get(B);
+ PAttributes |= Attributes::get(Context, B);
if (PAttributes.hasAttributes())
Attrs.push_back(AttributeWithIndex::get(ArgTys.size(), PAttributes));
}
@@ -796,7 +797,8 @@
// Compute whether the result needs to be zext or sext'd.
Attributes RAttributes;
- RAttributes |= HandleArgumentExtension(TREE_TYPE(type));
+ LLVMContext &Context = RetTy->getContext();
+ RAttributes |= HandleArgumentExtension(Context, TREE_TYPE(type));
// Allow the target to change the attributes.
#ifdef TARGET_ADJUST_LLVM_RETATTR
@@ -806,7 +808,7 @@
// The value returned by a 'malloc' function does not alias anything.
if (flags & ECF_MALLOC)
RAttributes |=
- Attributes::get(Attributes::Builder().addAttribute(Attributes::NoAlias));
+ Attributes::get(Context, Attributes::Builder().addAttribute(Attributes::NoAlias));
if (RAttributes.hasAttributes())
Attrs.push_back(AttributeWithIndex::get(0, RAttributes));
@@ -818,7 +820,7 @@
B.addAttribute(Attributes::StructRet)
.addAttribute(Attributes::NoAlias);
Attrs.push_back(AttributeWithIndex::get(ArgTypes.size(),
- Attributes::get(B)));
+ Attributes::get(Context, B)));
}
std::vector<Type*> ScalarArgs;
@@ -829,7 +831,7 @@
Attributes::Builder B;
B.addAttribute(Attributes::Nest);
Attrs.push_back(AttributeWithIndex::get(ArgTypes.size(),
- Attributes::get(B)));
+ Attributes::get(Context, B)));
}
#ifdef LLVM_TARGET_ENABLE_REGPARM
@@ -872,7 +874,7 @@
ABIConverter.HandleArgument(ArgTy, ScalarArgs, &PAttributes);
// Compute zext/sext attributes.
- PAttributes |= HandleArgumentExtension(ArgTy);
+ PAttributes |= HandleArgumentExtension(Context, ArgTy);
// Compute noalias attributes. If we have a decl for the function
// inspect it for restrict qualifiers, otherwise try the argument
@@ -880,7 +882,7 @@
tree RestrictArgTy = (DeclArgs) ? TREE_TYPE(DeclArgs) : ArgTy;
if (isa<ACCESS_TYPE>(RestrictArgTy) && TYPE_RESTRICT(RestrictArgTy))
PAttributes |=
- Attributes::get(Attributes::Builder().addAttribute(Attributes::NoAlias));
+ Attributes::get(Context, Attributes::Builder().addAttribute(Attributes::NoAlias));
#ifdef LLVM_TARGET_ENABLE_REGPARM
// Allow the target to mark this as inreg.
@@ -917,7 +919,7 @@
assert(RetTy && "Return type not specified!");
if (FnAttributes.hasAttributes())
- Attrs.push_back(AttributeWithIndex::get(~0, Attributes::get(FnAttributes)));
+ Attrs.push_back(AttributeWithIndex::get(~0, Attributes::get(Context, FnAttributes)));
// Finally, make the function type and result attributes.
PAL = AttrListPtr::get(Attrs);
More information about the llvm-commits
mailing list