[llvm-commits] [llvm] r164309 - in /llvm/trunk: include/llvm/Attributes.h lib/AsmParser/LLParser.cpp lib/CodeGen/MachineFunction.cpp lib/Target/CppBackend/CPPBackend.cpp lib/VMCore/Attributes.cpp
Bill Wendling
isanbard at gmail.com
Thu Sep 20 09:59:57 PDT 2012
Author: void
Date: Thu Sep 20 11:59:57 2012
New Revision: 164309
URL: http://llvm.org/viewvc/llvm-project?rev=164309&view=rev
Log:
Revert r164308 to fix buildbots.
Modified:
llvm/trunk/include/llvm/Attributes.h
llvm/trunk/lib/AsmParser/LLParser.cpp
llvm/trunk/lib/CodeGen/MachineFunction.cpp
llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp
llvm/trunk/lib/VMCore/Attributes.cpp
Modified: llvm/trunk/include/llvm/Attributes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Attributes.h?rev=164309&r1=164308&r2=164309&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Attributes.h (original)
+++ llvm/trunk/include/llvm/Attributes.h Thu Sep 20 11:59:57 2012
@@ -205,24 +205,6 @@
return Bits & Attribute::StackAlignment_i;
}
- /// This returns the alignment field of an attribute as a byte alignment
- /// value.
- unsigned getAlignment() const {
- if (!hasAlignmentAttr())
- return 0;
-
- return 1U << ((getRawAlignment() >> 16) - 1);
- }
-
- /// This returns the stack alignment field of an attribute as a byte alignment
- /// value.
- unsigned getStackAlignment() const {
- if (!hasStackAlignmentAttr())
- return 0;
-
- return 1U << ((getRawStackAlignment() >> 26) - 1);
- }
-
// This is a "safe bool() operator".
operator const void *() const { return Bits ? this : 0; }
bool isEmptyOrSingleton() const { return (Bits & (Bits - 1)) == 0; }
@@ -230,9 +212,8 @@
return Bits == Attrs.Bits;
}
bool operator != (const Attributes &Attrs) const {
- return !(this == Attrs);
+ return Bits != Attrs.Bits;
}
-
Attributes operator | (const Attributes &Attrs) const {
return Attributes(Bits | Attrs.Bits);
}
@@ -313,6 +294,14 @@
return Attributes((Log2_32(i)+1) << 16);
}
+/// This returns the alignment field of an attribute as a byte alignment value.
+inline unsigned getAlignmentFromAttrs(Attributes A) {
+ if (!A.hasAlignmentAttr())
+ return 0;
+
+ return 1U << ((A.getRawAlignment() >> 16) - 1);
+}
+
/// This turns an int stack alignment (which must be a power of 2) into
/// the form used internally in Attributes.
inline Attributes constructStackAlignmentFromInt(unsigned i) {
@@ -325,6 +314,15 @@
return Attributes((Log2_32(i)+1) << 26);
}
+/// This returns the stack alignment field of an attribute as a byte alignment
+/// value.
+inline unsigned getStackAlignmentFromAttrs(Attributes A) {
+ if (!A.hasStackAlignmentAttr())
+ return 0;
+
+ return 1U << ((A.getRawStackAlignment() >> 26) - 1);
+}
+
/// This returns an integer containing an encoding of all the
/// LLVM attributes found in the given attribute bitset. Any
/// change to this encoding is a breaking change to bitcode
@@ -452,7 +450,7 @@
/// getParamAlignment - Return the alignment for the specified function
/// parameter.
unsigned getParamAlignment(unsigned Idx) const {
- return getAttributes(Idx).getAlignment();
+ return Attribute::getAlignmentFromAttrs(getAttributes(Idx));
}
/// hasAttrSomewhere - Return true if the specified attribute is set for at
Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=164309&r1=164308&r2=164309&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Thu Sep 20 11:59:57 2012
@@ -2717,7 +2717,7 @@
// If the alignment was parsed as an attribute, move to the alignment field.
if (FuncAttrs & Attribute::Alignment) {
- Alignment = FuncAttrs.getAlignment();
+ Alignment = Attribute::getAlignmentFromAttrs(FuncAttrs);
FuncAttrs &= ~Attribute::Alignment;
}
Modified: llvm/trunk/lib/CodeGen/MachineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunction.cpp?rev=164309&r1=164308&r2=164309&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineFunction.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineFunction.cpp Thu Sep 20 11:59:57 2012
@@ -60,8 +60,8 @@
MFInfo = 0;
FrameInfo = new (Allocator) MachineFrameInfo(*TM.getFrameLowering());
if (Fn->hasFnAttr(Attribute::StackAlignment))
- FrameInfo->ensureMaxAlignment(Fn->getAttributes().
- getFnAttributes().getStackAlignment());
+ FrameInfo->ensureMaxAlignment(Attribute::getStackAlignmentFromAttrs(
+ Fn->getAttributes().getFnAttributes()));
ConstantPool = new (Allocator) MachineConstantPool(TM.getTargetData());
Alignment = TM.getTargetLowering()->getMinFunctionAlignment();
// FIXME: Shouldn't use pref alignment if explicit alignment is set on Fn.
Modified: llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp?rev=164309&r1=164308&r2=164309&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp (original)
+++ llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp Thu Sep 20 11:59:57 2012
@@ -508,7 +508,7 @@
#undef HANDLE_ATTR
if (attrs & Attribute::StackAlignment)
Out << " | Attribute::constructStackAlignmentFromInt("
- << attrs.getStackAlignment()
+ << Attribute::getStackAlignmentFromAttrs(attrs)
<< ")";
attrs &= ~Attribute::StackAlignment;
assert(attrs == 0 && "Unhandled attribute!");
Modified: llvm/trunk/lib/VMCore/Attributes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Attributes.cpp?rev=164309&r1=164308&r2=164309&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Attributes.cpp (original)
+++ llvm/trunk/lib/VMCore/Attributes.cpp Thu Sep 20 11:59:57 2012
@@ -80,12 +80,12 @@
Result += "address_safety ";
if (hasStackAlignmentAttr()) {
Result += "alignstack(";
- Result += utostr(getStackAlignment());
+ Result += utostr(Attribute::getStackAlignmentFromAttrs(*this));
Result += ") ";
}
if (hasAlignmentAttr()) {
Result += "align ";
- Result += utostr(getAlignment());
+ Result += utostr(Attribute::getAlignmentFromAttrs(*this));
Result += " ";
}
// Trim the trailing space.
@@ -174,7 +174,7 @@
#ifndef NDEBUG
for (unsigned i = 0, e = Attrs.size(); i != e; ++i) {
- assert(Attrs[i].Attrs.hasAttributes() &&
+ assert(Attrs[i].Attrs != Attribute::None &&
"Pointless attribute!");
assert((!i || Attrs[i-1].Index < Attrs[i].Index) &&
"Misordered AttributesList!");
@@ -247,14 +247,13 @@
/// returned. Attributes for the result are denoted with Idx = 0.
/// Function notes are denoted with idx = ~0.
Attributes AttrListPtr::getAttributes(unsigned Idx) const {
- if (AttrList == 0) return Attributes();
+ if (AttrList == 0) return Attribute::None;
const SmallVector<AttributeWithIndex, 4> &Attrs = AttrList->Attrs;
for (unsigned i = 0, e = Attrs.size(); i != e && Attrs[i].Index <= Idx; ++i)
if (Attrs[i].Index == Idx)
return Attrs[i].Attrs;
-
- return Attributes();
+ return Attribute::None;
}
/// hasAttrSomewhere - Return true if the specified attribute is set for at
@@ -275,8 +274,8 @@
#ifndef NDEBUG
// FIXME it is not obvious how this should work for alignment.
// For now, say we can't change a known alignment.
- unsigned OldAlign = OldAttrs.getAlignment();
- unsigned NewAlign = Attrs.getAlignment();
+ unsigned OldAlign = Attribute::getAlignmentFromAttrs(OldAttrs);
+ unsigned NewAlign = Attribute::getAlignmentFromAttrs(Attrs);
assert((!OldAlign || !NewAlign || OldAlign == NewAlign) &&
"Attempt to change alignment!");
#endif
More information about the llvm-commits
mailing list