mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-13 23:26:25 +00:00
Rename AttributeSets to AttributeGroups so that it's more meaningful.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174911 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -161,44 +161,20 @@ static void WriteStringRecord(unsigned Code, StringRef Str,
|
|||||||
Stream.EmitRecord(Code, Vals, AbbrevToUse);
|
Stream.EmitRecord(Code, Vals, AbbrevToUse);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief 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 compatibility.
|
|
||||||
/// N.B. This should be used only by the bitcode writer!
|
|
||||||
static uint64_t encodeLLVMAttributesForBitcode(AttributeSet Attrs,
|
|
||||||
unsigned Index) {
|
|
||||||
// FIXME: Remove in 4.0!
|
|
||||||
|
|
||||||
// FIXME: It doesn't make sense to store the alignment information as an
|
|
||||||
// expanded out value, we should store it as a log2 value. However, we can't
|
|
||||||
// just change that here without breaking bitcode compatibility. If this ever
|
|
||||||
// becomes a problem in practice, we should introduce new tag numbers in the
|
|
||||||
// bitcode file and have those tags use a more efficiently encoded alignment
|
|
||||||
// field.
|
|
||||||
|
|
||||||
// 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.
|
|
||||||
uint64_t EncodedAttrs = Attrs.Raw(Index) & 0xffff;
|
|
||||||
if (Attrs.hasAttribute(Index, Attribute::Alignment))
|
|
||||||
EncodedAttrs |= Attrs.getParamAlignment(Index) << 16;
|
|
||||||
EncodedAttrs |= (Attrs.Raw(Index) & (0xfffffULL << 21)) << 11;
|
|
||||||
return EncodedAttrs;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void WriteAttributeGroupTable(const ValueEnumerator &VE,
|
static void WriteAttributeGroupTable(const ValueEnumerator &VE,
|
||||||
BitstreamWriter &Stream) {
|
BitstreamWriter &Stream) {
|
||||||
const std::vector<AttributeSet> &Attrs = VE.getAttributeSets();
|
const std::vector<AttributeSet> &AttrGrps = VE.getAttributeGroups();
|
||||||
if (Attrs.empty()) return;
|
if (AttrGrps.empty()) return;
|
||||||
|
|
||||||
Stream.EnterSubblock(bitc::PARAMATTR_GROUP_BLOCK_ID, 3);
|
Stream.EnterSubblock(bitc::PARAMATTR_GROUP_BLOCK_ID, 3);
|
||||||
|
|
||||||
SmallVector<uint64_t, 64> Record;
|
SmallVector<uint64_t, 64> Record;
|
||||||
for (unsigned i = 0, e = Attrs.size(); i != e; ++i) {
|
for (unsigned i = 0, e = AttrGrps.size(); i != e; ++i) {
|
||||||
AttributeSet AS = Attrs[i];
|
AttributeSet AS = AttrGrps[i];
|
||||||
for (unsigned i = 0, e = AS.getNumSlots(); i != e; ++i) {
|
for (unsigned i = 0, e = AS.getNumSlots(); i != e; ++i) {
|
||||||
AttributeSet A = AS.getSlotAttributes(i);
|
AttributeSet A = AS.getSlotAttributes(i);
|
||||||
|
|
||||||
Record.push_back(VE.getAttributeSetID(A));
|
Record.push_back(VE.getAttributeGroupID(A));
|
||||||
Record.push_back(AS.getSlotIndex(i));
|
Record.push_back(AS.getSlotIndex(i));
|
||||||
|
|
||||||
for (AttributeSet::iterator I = AS.begin(0), E = AS.end(0);
|
for (AttributeSet::iterator I = AS.begin(0), E = AS.end(0);
|
||||||
@@ -233,6 +209,30 @@ static void WriteAttributeGroupTable(const ValueEnumerator &VE,
|
|||||||
Stream.ExitBlock();
|
Stream.ExitBlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// \brief 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 compatibility.
|
||||||
|
/// N.B. This should be used only by the bitcode writer!
|
||||||
|
static uint64_t encodeLLVMAttributesForBitcode(AttributeSet Attrs,
|
||||||
|
unsigned Index) {
|
||||||
|
// FIXME: Remove in 4.0!
|
||||||
|
|
||||||
|
// FIXME: It doesn't make sense to store the alignment information as an
|
||||||
|
// expanded out value, we should store it as a log2 value. However, we can't
|
||||||
|
// just change that here without breaking bitcode compatibility. If this ever
|
||||||
|
// becomes a problem in practice, we should introduce new tag numbers in the
|
||||||
|
// bitcode file and have those tags use a more efficiently encoded alignment
|
||||||
|
// field.
|
||||||
|
|
||||||
|
// 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.
|
||||||
|
uint64_t EncodedAttrs = Attrs.Raw(Index) & 0xffff;
|
||||||
|
if (Attrs.hasAttribute(Index, Attribute::Alignment))
|
||||||
|
EncodedAttrs |= Attrs.getParamAlignment(Index) << 16;
|
||||||
|
EncodedAttrs |= (Attrs.Raw(Index) & (0xfffffULL << 21)) << 11;
|
||||||
|
return EncodedAttrs;
|
||||||
|
}
|
||||||
|
|
||||||
static void WriteAttributeTable(const ValueEnumerator &VE,
|
static void WriteAttributeTable(const ValueEnumerator &VE,
|
||||||
BitstreamWriter &Stream) {
|
BitstreamWriter &Stream) {
|
||||||
const std::vector<AttributeSet> &Attrs = VE.getAttributes();
|
const std::vector<AttributeSet> &Attrs = VE.getAttributes();
|
||||||
|
@@ -431,10 +431,10 @@ void ValueEnumerator::EnumerateAttributes(const AttributeSet &PAL) {
|
|||||||
// Do lookups for all attribute groups.
|
// Do lookups for all attribute groups.
|
||||||
for (unsigned i = 0, e = PAL.getNumSlots(); i != e; ++i) {
|
for (unsigned i = 0, e = PAL.getNumSlots(); i != e; ++i) {
|
||||||
AttributeSet AS = PAL.getSlotAttributes(i);
|
AttributeSet AS = PAL.getSlotAttributes(i);
|
||||||
unsigned &Entry = AttributeSetMap[AS];
|
unsigned &Entry = AttributeGroupMap[AS];
|
||||||
if (Entry == 0) {
|
if (Entry == 0) {
|
||||||
AttributeSets.push_back(AS);
|
AttributeGroups.push_back(AS);
|
||||||
Entry = AttributeSets.size();
|
Entry = AttributeGroups.size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -52,9 +52,9 @@ private:
|
|||||||
SmallVector<const MDNode *, 8> FunctionLocalMDs;
|
SmallVector<const MDNode *, 8> FunctionLocalMDs;
|
||||||
ValueMapType MDValueMap;
|
ValueMapType MDValueMap;
|
||||||
|
|
||||||
typedef DenseMap<AttributeSet, unsigned> AttributeSetMapType;
|
typedef DenseMap<AttributeSet, unsigned> AttributeGroupMapType;
|
||||||
AttributeSetMapType AttributeSetMap;
|
AttributeGroupMapType AttributeGroupMap;
|
||||||
std::vector<AttributeSet> AttributeSets;
|
std::vector<AttributeSet> AttributeGroups;
|
||||||
|
|
||||||
typedef DenseMap<void*, unsigned> AttributeMapType;
|
typedef DenseMap<void*, unsigned> AttributeMapType;
|
||||||
AttributeMapType AttributeMap;
|
AttributeMapType AttributeMap;
|
||||||
@@ -102,17 +102,17 @@ public:
|
|||||||
unsigned getInstructionID(const Instruction *I) const;
|
unsigned getInstructionID(const Instruction *I) const;
|
||||||
void setInstructionID(const Instruction *I);
|
void setInstructionID(const Instruction *I);
|
||||||
|
|
||||||
unsigned getAttributeID(const AttributeSet &PAL) const {
|
unsigned getAttributeID(AttributeSet PAL) const {
|
||||||
if (PAL.isEmpty()) return 0; // Null maps to zero.
|
if (PAL.isEmpty()) return 0; // Null maps to zero.
|
||||||
AttributeMapType::const_iterator I = AttributeMap.find(PAL.getRawPointer());
|
AttributeMapType::const_iterator I = AttributeMap.find(PAL.getRawPointer());
|
||||||
assert(I != AttributeMap.end() && "Attribute not in ValueEnumerator!");
|
assert(I != AttributeMap.end() && "Attribute not in ValueEnumerator!");
|
||||||
return I->second;
|
return I->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned getAttributeSetID(const AttributeSet &PAL) const {
|
unsigned getAttributeGroupID(AttributeSet PAL) const {
|
||||||
if (PAL.isEmpty()) return 0; // Null maps to zero.
|
if (PAL.isEmpty()) return 0; // Null maps to zero.
|
||||||
AttributeSetMapType::const_iterator I = AttributeSetMap.find(PAL);
|
AttributeGroupMapType::const_iterator I = AttributeGroupMap.find(PAL);
|
||||||
assert(I != AttributeSetMap.end() && "Attribute not in ValueEnumerator!");
|
assert(I != AttributeGroupMap.end() && "Attribute not in ValueEnumerator!");
|
||||||
return I->second;
|
return I->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,8 +135,8 @@ public:
|
|||||||
const std::vector<AttributeSet> &getAttributes() const {
|
const std::vector<AttributeSet> &getAttributes() const {
|
||||||
return Attribute;
|
return Attribute;
|
||||||
}
|
}
|
||||||
const std::vector<AttributeSet> &getAttributeSets() const {
|
const std::vector<AttributeSet> &getAttributeGroups() const {
|
||||||
return AttributeSets;
|
return AttributeGroups;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getGlobalBasicBlockID - This returns the function-specific ID for the
|
/// getGlobalBasicBlockID - This returns the function-specific ID for the
|
||||||
|
Reference in New Issue
Block a user