mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 04:32:44 +01:00
Cleanup whitespace.
llvm-svn: 166013
This commit is contained in:
parent
2433b08890
commit
86c5a69349
@ -93,12 +93,12 @@ uint64_t Attributes::Raw() const {
|
|||||||
|
|
||||||
Attributes Attributes::typeIncompatible(Type *Ty) {
|
Attributes Attributes::typeIncompatible(Type *Ty) {
|
||||||
AttrBuilder Incompatible;
|
AttrBuilder Incompatible;
|
||||||
|
|
||||||
if (!Ty->isIntegerTy())
|
if (!Ty->isIntegerTy())
|
||||||
// Attributes that only apply to integers.
|
// Attributes that only apply to integers.
|
||||||
Incompatible.addAttribute(Attributes::SExt)
|
Incompatible.addAttribute(Attributes::SExt)
|
||||||
.addAttribute(Attributes::ZExt);
|
.addAttribute(Attributes::ZExt);
|
||||||
|
|
||||||
if (!Ty->isPointerTy())
|
if (!Ty->isPointerTy())
|
||||||
// Attributes that only apply to pointers.
|
// Attributes that only apply to pointers.
|
||||||
Incompatible.addAttribute(Attributes::ByVal)
|
Incompatible.addAttribute(Attributes::ByVal)
|
||||||
@ -106,7 +106,7 @@ Attributes Attributes::typeIncompatible(Type *Ty) {
|
|||||||
.addAttribute(Attributes::NoAlias)
|
.addAttribute(Attributes::NoAlias)
|
||||||
.addAttribute(Attributes::NoCapture)
|
.addAttribute(Attributes::NoCapture)
|
||||||
.addAttribute(Attributes::StructRet);
|
.addAttribute(Attributes::StructRet);
|
||||||
|
|
||||||
return Attributes::get(Ty->getContext(), Incompatible);
|
return Attributes::get(Ty->getContext(), Incompatible);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -362,19 +362,19 @@ static ManagedStatic<sys::SmartMutex<true> > ALMutex;
|
|||||||
|
|
||||||
class AttributeListImpl : public FoldingSetNode {
|
class AttributeListImpl : public FoldingSetNode {
|
||||||
sys::cas_flag RefCount;
|
sys::cas_flag RefCount;
|
||||||
|
|
||||||
// AttributesList is uniqued, these should not be publicly available.
|
// AttributesList is uniqued, these should not be publicly available.
|
||||||
void operator=(const AttributeListImpl &) LLVM_DELETED_FUNCTION;
|
void operator=(const AttributeListImpl &) LLVM_DELETED_FUNCTION;
|
||||||
AttributeListImpl(const AttributeListImpl &) LLVM_DELETED_FUNCTION;
|
AttributeListImpl(const AttributeListImpl &) LLVM_DELETED_FUNCTION;
|
||||||
~AttributeListImpl(); // Private implementation
|
~AttributeListImpl(); // Private implementation
|
||||||
public:
|
public:
|
||||||
SmallVector<AttributeWithIndex, 4> Attrs;
|
SmallVector<AttributeWithIndex, 4> Attrs;
|
||||||
|
|
||||||
AttributeListImpl(ArrayRef<AttributeWithIndex> attrs)
|
AttributeListImpl(ArrayRef<AttributeWithIndex> attrs)
|
||||||
: Attrs(attrs.begin(), attrs.end()) {
|
: Attrs(attrs.begin(), attrs.end()) {
|
||||||
RefCount = 0;
|
RefCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddRef() {
|
void AddRef() {
|
||||||
sys::SmartScopedLock<true> Lock(*ALMutex);
|
sys::SmartScopedLock<true> Lock(*ALMutex);
|
||||||
++RefCount;
|
++RefCount;
|
||||||
@ -387,7 +387,7 @@ public:
|
|||||||
if (new_val == 0)
|
if (new_val == 0)
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Profile(FoldingSetNodeID &ID) const {
|
void Profile(FoldingSetNodeID &ID) const {
|
||||||
Profile(ID, Attrs);
|
Profile(ID, Attrs);
|
||||||
}
|
}
|
||||||
@ -398,50 +398,49 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
} // end llvm namespace
|
||||||
|
|
||||||
AttributeListImpl::~AttributeListImpl() {
|
AttributeListImpl::~AttributeListImpl() {
|
||||||
// NOTE: Lock must be acquired by caller.
|
// NOTE: Lock must be acquired by caller.
|
||||||
AttributesLists->RemoveNode(this);
|
AttributesLists->RemoveNode(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AttrListPtr AttrListPtr::get(ArrayRef<AttributeWithIndex> Attrs) {
|
AttrListPtr AttrListPtr::get(ArrayRef<AttributeWithIndex> Attrs) {
|
||||||
// If there are no attributes then return a null AttributesList pointer.
|
// If there are no attributes then return a null AttributesList pointer.
|
||||||
if (Attrs.empty())
|
if (Attrs.empty())
|
||||||
return AttrListPtr();
|
return AttrListPtr();
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
for (unsigned i = 0, e = Attrs.size(); i != e; ++i) {
|
for (unsigned i = 0, e = Attrs.size(); i != e; ++i) {
|
||||||
assert(Attrs[i].Attrs.hasAttributes() &&
|
assert(Attrs[i].Attrs.hasAttributes() &&
|
||||||
"Pointless attribute!");
|
"Pointless attribute!");
|
||||||
assert((!i || Attrs[i-1].Index < Attrs[i].Index) &&
|
assert((!i || Attrs[i-1].Index < Attrs[i].Index) &&
|
||||||
"Misordered AttributesList!");
|
"Misordered AttributesList!");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Otherwise, build a key to look up the existing attributes.
|
// Otherwise, build a key to look up the existing attributes.
|
||||||
FoldingSetNodeID ID;
|
FoldingSetNodeID ID;
|
||||||
AttributeListImpl::Profile(ID, Attrs);
|
AttributeListImpl::Profile(ID, Attrs);
|
||||||
void *InsertPos;
|
void *InsertPos;
|
||||||
|
|
||||||
sys::SmartScopedLock<true> Lock(*ALMutex);
|
sys::SmartScopedLock<true> Lock(*ALMutex);
|
||||||
|
|
||||||
AttributeListImpl *PAL =
|
AttributeListImpl *PAL =
|
||||||
AttributesLists->FindNodeOrInsertPos(ID, InsertPos);
|
AttributesLists->FindNodeOrInsertPos(ID, InsertPos);
|
||||||
|
|
||||||
// If we didn't find any existing attributes of the same shape then
|
// If we didn't find any existing attributes of the same shape then
|
||||||
// create a new one and insert it.
|
// create a new one and insert it.
|
||||||
if (!PAL) {
|
if (!PAL) {
|
||||||
PAL = new AttributeListImpl(Attrs);
|
PAL = new AttributeListImpl(Attrs);
|
||||||
AttributesLists->InsertNode(PAL, InsertPos);
|
AttributesLists->InsertNode(PAL, InsertPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the AttributesList that we found or created.
|
// Return the AttributesList that we found or created.
|
||||||
return AttrListPtr(PAL);
|
return AttrListPtr(PAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// AttrListPtr Method Implementations
|
// AttrListPtr Method Implementations
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
@ -451,7 +450,7 @@ AttrListPtr::AttrListPtr(AttributeListImpl *LI) : AttrList(LI) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AttrListPtr::AttrListPtr(const AttrListPtr &P) : AttrList(P.AttrList) {
|
AttrListPtr::AttrListPtr(const AttrListPtr &P) : AttrList(P.AttrList) {
|
||||||
if (AttrList) AttrList->AddRef();
|
if (AttrList) AttrList->AddRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
const AttrListPtr &AttrListPtr::operator=(const AttrListPtr &RHS) {
|
const AttrListPtr &AttrListPtr::operator=(const AttrListPtr &RHS) {
|
||||||
@ -467,7 +466,7 @@ AttrListPtr::~AttrListPtr() {
|
|||||||
if (AttrList) AttrList->DropRef();
|
if (AttrList) AttrList->DropRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getNumSlots - Return the number of slots used in this attribute list.
|
/// getNumSlots - Return the number of slots used in this attribute list.
|
||||||
/// This is the number of arguments that have an attribute set on them
|
/// This is the number of arguments that have an attribute set on them
|
||||||
/// (including the function itself).
|
/// (including the function itself).
|
||||||
unsigned AttrListPtr::getNumSlots() const {
|
unsigned AttrListPtr::getNumSlots() const {
|
||||||
@ -481,13 +480,12 @@ const AttributeWithIndex &AttrListPtr::getSlot(unsigned Slot) const {
|
|||||||
return AttrList->Attrs[Slot];
|
return AttrList->Attrs[Slot];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// getAttributes - The attributes for the specified index are returned.
|
||||||
/// getAttributes - The attributes for the specified index are
|
/// Attributes for the result are denoted with Idx = 0. Function notes are
|
||||||
/// returned. Attributes for the result are denoted with Idx = 0.
|
/// denoted with idx = ~0.
|
||||||
/// Function notes are denoted with idx = ~0.
|
|
||||||
Attributes AttrListPtr::getAttributes(unsigned Idx) const {
|
Attributes AttrListPtr::getAttributes(unsigned Idx) const {
|
||||||
if (AttrList == 0) return Attributes();
|
if (AttrList == 0) return Attributes();
|
||||||
|
|
||||||
const SmallVector<AttributeWithIndex, 4> &Attrs = AttrList->Attrs;
|
const SmallVector<AttributeWithIndex, 4> &Attrs = AttrList->Attrs;
|
||||||
for (unsigned i = 0, e = Attrs.size(); i != e && Attrs[i].Index <= Idx; ++i)
|
for (unsigned i = 0, e = Attrs.size(); i != e && Attrs[i].Index <= Idx; ++i)
|
||||||
if (Attrs[i].Index == Idx)
|
if (Attrs[i].Index == Idx)
|
||||||
@ -529,12 +527,12 @@ AttrListPtr AttrListPtr::addAttr(LLVMContext &C, unsigned Idx,
|
|||||||
assert((!OldAlign || !NewAlign || OldAlign == NewAlign) &&
|
assert((!OldAlign || !NewAlign || OldAlign == NewAlign) &&
|
||||||
"Attempt to change alignment!");
|
"Attempt to change alignment!");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
AttrBuilder NewAttrs =
|
AttrBuilder NewAttrs =
|
||||||
AttrBuilder(OldAttrs).addAttributes(Attrs);
|
AttrBuilder(OldAttrs).addAttributes(Attrs);
|
||||||
if (NewAttrs == AttrBuilder(OldAttrs))
|
if (NewAttrs == AttrBuilder(OldAttrs))
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
SmallVector<AttributeWithIndex, 8> NewAttrList;
|
SmallVector<AttributeWithIndex, 8> NewAttrList;
|
||||||
if (AttrList == 0)
|
if (AttrList == 0)
|
||||||
NewAttrList.push_back(AttributeWithIndex::get(Idx, Attrs));
|
NewAttrList.push_back(AttributeWithIndex::get(Idx, Attrs));
|
||||||
@ -552,14 +550,14 @@ AttrListPtr AttrListPtr::addAttr(LLVMContext &C, unsigned Idx,
|
|||||||
addAttributes(OldAttrList[i].Attrs));
|
addAttributes(OldAttrList[i].Attrs));
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
NewAttrList.push_back(AttributeWithIndex::get(Idx, Attrs));
|
NewAttrList.push_back(AttributeWithIndex::get(Idx, Attrs));
|
||||||
|
|
||||||
// Copy attributes for arguments after this one.
|
// Copy attributes for arguments after this one.
|
||||||
NewAttrList.insert(NewAttrList.end(),
|
NewAttrList.insert(NewAttrList.end(),
|
||||||
OldAttrList.begin()+i, OldAttrList.end());
|
OldAttrList.begin()+i, OldAttrList.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
return get(NewAttrList);
|
return get(NewAttrList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -572,7 +570,7 @@ AttrListPtr AttrListPtr::removeAttr(LLVMContext &C, unsigned Idx,
|
|||||||
"Attempt to exclude alignment!");
|
"Attempt to exclude alignment!");
|
||||||
#endif
|
#endif
|
||||||
if (AttrList == 0) return AttrListPtr();
|
if (AttrList == 0) return AttrListPtr();
|
||||||
|
|
||||||
Attributes OldAttrs = getAttributes(Idx);
|
Attributes OldAttrs = getAttributes(Idx);
|
||||||
AttrBuilder NewAttrs =
|
AttrBuilder NewAttrs =
|
||||||
AttrBuilder(OldAttrs).removeAttributes(Attrs);
|
AttrBuilder(OldAttrs).removeAttributes(Attrs);
|
||||||
@ -582,11 +580,11 @@ AttrListPtr AttrListPtr::removeAttr(LLVMContext &C, unsigned Idx,
|
|||||||
SmallVector<AttributeWithIndex, 8> NewAttrList;
|
SmallVector<AttributeWithIndex, 8> NewAttrList;
|
||||||
const SmallVector<AttributeWithIndex, 4> &OldAttrList = AttrList->Attrs;
|
const SmallVector<AttributeWithIndex, 4> &OldAttrList = AttrList->Attrs;
|
||||||
unsigned i = 0, e = OldAttrList.size();
|
unsigned i = 0, e = OldAttrList.size();
|
||||||
|
|
||||||
// Copy attributes for arguments before this one.
|
// Copy attributes for arguments before this one.
|
||||||
for (; i != e && OldAttrList[i].Index < Idx; ++i)
|
for (; i != e && OldAttrList[i].Index < Idx; ++i)
|
||||||
NewAttrList.push_back(OldAttrList[i]);
|
NewAttrList.push_back(OldAttrList[i]);
|
||||||
|
|
||||||
// If there are attributes already at this index, merge them in.
|
// If there are attributes already at this index, merge them in.
|
||||||
assert(OldAttrList[i].Index == Idx && "Attribute isn't set?");
|
assert(OldAttrList[i].Index == Idx && "Attribute isn't set?");
|
||||||
Attrs = Attributes::get(C, AttrBuilder(OldAttrList[i].Attrs).
|
Attrs = Attributes::get(C, AttrBuilder(OldAttrList[i].Attrs).
|
||||||
@ -594,11 +592,11 @@ AttrListPtr AttrListPtr::removeAttr(LLVMContext &C, unsigned Idx,
|
|||||||
++i;
|
++i;
|
||||||
if (Attrs.hasAttributes()) // If any attributes left for this param, add them.
|
if (Attrs.hasAttributes()) // If any attributes left for this param, add them.
|
||||||
NewAttrList.push_back(AttributeWithIndex::get(Idx, Attrs));
|
NewAttrList.push_back(AttributeWithIndex::get(Idx, Attrs));
|
||||||
|
|
||||||
// Copy attributes for arguments after this one.
|
// Copy attributes for arguments after this one.
|
||||||
NewAttrList.insert(NewAttrList.end(),
|
NewAttrList.insert(NewAttrList.end(),
|
||||||
OldAttrList.begin()+i, OldAttrList.end());
|
OldAttrList.begin()+i, OldAttrList.end());
|
||||||
|
|
||||||
return get(NewAttrList);
|
return get(NewAttrList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -608,6 +606,6 @@ void AttrListPtr::dump() const {
|
|||||||
const AttributeWithIndex &PAWI = getSlot(i);
|
const AttributeWithIndex &PAWI = getSlot(i);
|
||||||
dbgs() << "{" << PAWI.Index << "," << PAWI.Attrs.getAsString() << "} ";
|
dbgs() << "{" << PAWI.Index << "," << PAWI.Attrs.getAsString() << "} ";
|
||||||
}
|
}
|
||||||
|
|
||||||
dbgs() << "]\n";
|
dbgs() << "]\n";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user