s/Raw/getBitMask/g to be more in line with current naming conventions. This method won't be sticking around.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171244 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling 2012-12-30 01:05:42 +00:00
parent f35cb76a70
commit c966e08a98
5 changed files with 24 additions and 23 deletions

View File

@ -127,7 +127,7 @@ public:
return pImpl != A.pImpl; return pImpl != A.pImpl;
} }
uint64_t Raw() const; uint64_t getBitMask() const;
/// \brief Which attributes cannot be applied to a type. /// \brief Which attributes cannot be applied to a type.
static Attribute typeIncompatible(Type *Ty); static Attribute typeIncompatible(Type *Ty);
@ -160,7 +160,7 @@ class AttrBuilder {
public: public:
AttrBuilder() : Bits(0) {} AttrBuilder() : Bits(0) {}
explicit AttrBuilder(uint64_t B) : Bits(B) {} explicit AttrBuilder(uint64_t B) : Bits(B) {}
AttrBuilder(const Attribute &A) : Bits(A.Raw()) {} AttrBuilder(const Attribute &A) : Bits(A.getBitMask()) {}
void clear() { Bits = 0; } void clear() { Bits = 0; }
@ -231,7 +231,7 @@ public:
.removeAttribute(Attribute::NoDuplicate); .removeAttribute(Attribute::NoDuplicate);
} }
uint64_t Raw() const { return Bits; } uint64_t getBitMask() const { return Bits; }
bool operator==(const AttrBuilder &B) { bool operator==(const AttrBuilder &B) {
return Bits == B.Bits; return Bits == B.Bits;

View File

@ -477,7 +477,7 @@ bool BitcodeReader::ParseAttributeBlock() {
for (unsigned i = 0, e = Record.size(); i != e; i += 2) { for (unsigned i = 0, e = Record.size(); i != e; i += 2) {
Attribute ReconstitutedAttr = Attribute ReconstitutedAttr =
Attribute::decodeLLVMAttributesForBitcode(Context, Record[i+1]); Attribute::decodeLLVMAttributesForBitcode(Context, Record[i+1]);
Record[i+1] = ReconstitutedAttr.Raw(); Record[i+1] = ReconstitutedAttr.getBitMask();
} }
for (unsigned i = 0, e = Record.size(); i != e; i += 2) { for (unsigned i = 0, e = Record.size(); i != e; i += 2) {

View File

@ -42,7 +42,7 @@ public:
uint64_t getAlignment() const; uint64_t getAlignment() const;
uint64_t getStackAlignment() const; uint64_t getStackAlignment() const;
uint64_t Raw() const; // FIXME: Remove. uint64_t getBitMask() const; // FIXME: Remove.
static uint64_t getAttrMask(uint64_t Val); static uint64_t getAttrMask(uint64_t Val);
@ -71,7 +71,7 @@ public:
} }
static void Profile(FoldingSetNodeID &ID, ArrayRef<AttributeWithIndex> Attrs){ static void Profile(FoldingSetNodeID &ID, ArrayRef<AttributeWithIndex> Attrs){
for (unsigned i = 0, e = Attrs.size(); i != e; ++i) { for (unsigned i = 0, e = Attrs.size(); i != e; ++i) {
ID.AddInteger(Attrs[i].Attrs.Raw()); ID.AddInteger(Attrs[i].Attrs.getBitMask());
ID.AddInteger(Attrs[i].Index); ID.AddInteger(Attrs[i].Index);
} }
} }

View File

@ -45,7 +45,7 @@ Attribute Attribute::get(LLVMContext &Context, AttrBuilder &B) {
// Otherwise, build a key to look up the existing attributes. // Otherwise, build a key to look up the existing attributes.
LLVMContextImpl *pImpl = Context.pImpl; LLVMContextImpl *pImpl = Context.pImpl;
FoldingSetNodeID ID; FoldingSetNodeID ID;
ID.AddInteger(B.Raw()); ID.AddInteger(B.getBitMask());
void *InsertPoint; void *InsertPoint;
AttributeImpl *PA = pImpl->AttrsSet.FindNodeOrInsertPos(ID, InsertPoint); AttributeImpl *PA = pImpl->AttrsSet.FindNodeOrInsertPos(ID, InsertPoint);
@ -53,7 +53,7 @@ Attribute Attribute::get(LLVMContext &Context, AttrBuilder &B) {
if (!PA) { if (!PA) {
// If we didn't find any existing attributes of the same shape then create a // If we didn't find any existing attributes of the same shape then create a
// new one and insert it. // new one and insert it.
PA = new AttributeImpl(Context, B.Raw()); PA = new AttributeImpl(Context, B.getBitMask());
pImpl->AttrsSet.InsertNode(PA, InsertPoint); pImpl->AttrsSet.InsertNode(PA, InsertPoint);
} }
@ -88,8 +88,8 @@ unsigned Attribute::getStackAlignment() const {
return 1U << ((pImpl->getStackAlignment() >> 26) - 1); return 1U << ((pImpl->getStackAlignment() >> 26) - 1);
} }
uint64_t Attribute::Raw() const { uint64_t Attribute::getBitMask() const {
return pImpl ? pImpl->Raw() : 0; return pImpl ? pImpl->getBitMask() : 0;
} }
Attribute Attribute::typeIncompatible(Type *Ty) { Attribute Attribute::typeIncompatible(Type *Ty) {
@ -124,10 +124,10 @@ uint64_t Attribute::encodeLLVMAttributesForBitcode(Attribute Attrs) {
// Store the alignment in the bitcode as a 16-bit raw value instead of a 5-bit // Store the alignment in the bitcode as a 16-bit raw value instead of a 5-bit
// log2 encoded value. Shift the bits above the alignment up by 11 bits. // log2 encoded value. Shift the bits above the alignment up by 11 bits.
uint64_t EncodedAttrs = Attrs.Raw() & 0xffff; uint64_t EncodedAttrs = Attrs.getBitMask() & 0xffff;
if (Attrs.hasAttribute(Attribute::Alignment)) if (Attrs.hasAttribute(Attribute::Alignment))
EncodedAttrs |= Attrs.getAlignment() << 16; EncodedAttrs |= Attrs.getAlignment() << 16;
EncodedAttrs |= (Attrs.Raw() & (0xffffULL << 21)) << 11; EncodedAttrs |= (Attrs.getBitMask() & (0xffffULL << 21)) << 11;
return EncodedAttrs; return EncodedAttrs;
} }
@ -257,12 +257,12 @@ AttrBuilder &AttrBuilder::removeAttribute(Attribute::AttrKind Val) {
} }
AttrBuilder &AttrBuilder::addAttributes(const Attribute &A) { AttrBuilder &AttrBuilder::addAttributes(const Attribute &A) {
Bits |= A.Raw(); Bits |= A.getBitMask();
return *this; return *this;
} }
AttrBuilder &AttrBuilder::removeAttributes(const Attribute &A){ AttrBuilder &AttrBuilder::removeAttributes(const Attribute &A){
Bits &= ~A.Raw(); Bits &= ~A.getBitMask();
return *this; return *this;
} }
@ -274,7 +274,7 @@ bool AttrBuilder::hasAttributes() const {
return Bits != 0; return Bits != 0;
} }
bool AttrBuilder::hasAttributes(const Attribute &A) const { bool AttrBuilder::hasAttributes(const Attribute &A) const {
return Bits & A.Raw(); return Bits & A.getBitMask();
} }
bool AttrBuilder::hasAlignmentAttr() const { bool AttrBuilder::hasAlignmentAttr() const {
return Bits & AttributeImpl::getAttrMask(Attribute::Alignment); return Bits & AttributeImpl::getAttrMask(Attribute::Alignment);
@ -302,7 +302,7 @@ AttributeImpl::AttributeImpl(LLVMContext &C, uint64_t data) {
Data = ConstantInt::get(Type::getInt64Ty(C), data); Data = ConstantInt::get(Type::getInt64Ty(C), data);
} }
uint64_t AttributeImpl::Raw() const { uint64_t AttributeImpl::getBitMask() const {
return cast<ConstantInt>(Data)->getZExtValue(); return cast<ConstantInt>(Data)->getZExtValue();
} }
@ -343,23 +343,24 @@ uint64_t AttributeImpl::getAttrMask(uint64_t Val) {
} }
bool AttributeImpl::hasAttribute(uint64_t A) const { bool AttributeImpl::hasAttribute(uint64_t A) const {
return (Raw() & getAttrMask(A)) != 0; return (getBitMask() & getAttrMask(A)) != 0;
} }
bool AttributeImpl::hasAttributes() const { bool AttributeImpl::hasAttributes() const {
return Raw() != 0; return getBitMask() != 0;
} }
bool AttributeImpl::hasAttributes(const Attribute &A) const { bool AttributeImpl::hasAttributes(const Attribute &A) const {
return Raw() & A.Raw(); // FIXME: Raw() won't work here in the future. // FIXME: getBitMask() won't work here in the future.
return getBitMask() & A.getBitMask();
} }
uint64_t AttributeImpl::getAlignment() const { uint64_t AttributeImpl::getAlignment() const {
return Raw() & getAttrMask(Attribute::Alignment); return getBitMask() & getAttrMask(Attribute::Alignment);
} }
uint64_t AttributeImpl::getStackAlignment() const { uint64_t AttributeImpl::getStackAlignment() const {
return Raw() & getAttrMask(Attribute::StackAlignment); return getBitMask() & getAttrMask(Attribute::StackAlignment);
} }
void AttributeImpl::Profile(FoldingSetNodeID &ID, Constant *Data) { void AttributeImpl::Profile(FoldingSetNodeID &ID, Constant *Data) {

View File

@ -1402,7 +1402,7 @@ LLVMAttribute LLVMGetFunctionAttr(LLVMValueRef Fn) {
Function *Func = unwrap<Function>(Fn); Function *Func = unwrap<Function>(Fn);
const AttributeSet PAL = Func->getAttributes(); const AttributeSet PAL = Func->getAttributes();
Attribute attr = PAL.getFnAttributes(); Attribute attr = PAL.getFnAttributes();
return (LLVMAttribute)attr.Raw(); return (LLVMAttribute)attr.getBitMask();
} }
/*--.. Operations on parameters ............................................--*/ /*--.. Operations on parameters ............................................--*/
@ -1479,7 +1479,7 @@ LLVMAttribute LLVMGetAttribute(LLVMValueRef Arg) {
Argument *A = unwrap<Argument>(Arg); Argument *A = unwrap<Argument>(Arg);
Attribute attr = A->getParent()->getAttributes().getParamAttributes( Attribute attr = A->getParent()->getAttributes().getParamAttributes(
A->getArgNo()+1); A->getArgNo()+1);
return (LLVMAttribute)attr.Raw(); return (LLVMAttribute)attr.getBitMask();
} }