aboutsummaryrefslogtreecommitdiff
path: root/lib/Bitcode
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Bitcode')
-rw-r--r--lib/Bitcode/Reader/BitcodeReader.cpp26
-rw-r--r--lib/Bitcode/Reader/BitcodeReader.h14
-rw-r--r--lib/Bitcode/Writer/BitcodeWriter.cpp16
-rw-r--r--lib/Bitcode/Writer/ValueEnumerator.cpp16
-rw-r--r--lib/Bitcode/Writer/ValueEnumerator.h20
5 files changed, 46 insertions, 46 deletions
diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp
index 820a1e3847..205650ddd0 100644
--- a/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -32,7 +32,7 @@ void BitcodeReader::FreeState() {
std::vector<PATypeHolder>().swap(TypeList);
ValueList.clear();
- std::vector<PAListPtr>().swap(ParamAttrs);
+ std::vector<AttrListPtr>().swap(Attributes);
std::vector<BasicBlock*>().swap(FunctionBBs);
std::vector<Function*>().swap(FunctionsWithBodies);
DeferredFunctionInfo.clear();
@@ -313,16 +313,16 @@ const Type *BitcodeReader::getTypeByID(unsigned ID, bool isTypeTable) {
// Functions for parsing blocks from the bitcode file
//===----------------------------------------------------------------------===//
-bool BitcodeReader::ParseParamAttrBlock() {
+bool BitcodeReader::ParseAttributeBlock() {
if (Stream.EnterSubBlock(bitc::PARAMATTR_BLOCK_ID))
return Error("Malformed block record");
- if (!ParamAttrs.empty())
+ if (!Attributes.empty())
return Error("Multiple PARAMATTR blocks found!");
SmallVector<uint64_t, 64> Record;
- SmallVector<FnAttributeWithIndex, 8> Attrs;
+ SmallVector<AttributeWithIndex, 8> Attrs;
// Read all the records.
while (1) {
@@ -356,11 +356,11 @@ bool BitcodeReader::ParseParamAttrBlock() {
return Error("Invalid ENTRY record");
for (unsigned i = 0, e = Record.size(); i != e; i += 2) {
- if (Record[i+1] != ParamAttr::None)
- Attrs.push_back(FnAttributeWithIndex::get(Record[i], Record[i+1]));
+ if (Record[i+1] != Attribute::None)
+ Attrs.push_back(AttributeWithIndex::get(Record[i], Record[i+1]));
}
- ParamAttrs.push_back(PAListPtr::get(Attrs.begin(), Attrs.end()));
+ Attributes.push_back(AttrListPtr::get(Attrs.begin(), Attrs.end()));
Attrs.clear();
break;
}
@@ -1030,7 +1030,7 @@ bool BitcodeReader::ParseModule(const std::string &ModuleID) {
return Error("Malformed BlockInfoBlock");
break;
case bitc::PARAMATTR_BLOCK_ID:
- if (ParseParamAttrBlock())
+ if (ParseAttributeBlock())
return true;
break;
case bitc::TYPE_BLOCK_ID:
@@ -1183,7 +1183,7 @@ bool BitcodeReader::ParseModule(const std::string &ModuleID) {
Func->setCallingConv(Record[1]);
bool isProto = Record[2];
Func->setLinkage(GetDecodedLinkage(Record[3]));
- Func->setParamAttrs(getParamAttrs(Record[4]));
+ Func->setAttributes(getAttributes(Record[4]));
Func->setAlignment((1 << Record[5]) >> 1);
if (Record[6]) {
@@ -1695,7 +1695,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
case bitc::FUNC_CODE_INST_INVOKE: {
// INVOKE: [attrs, cc, normBB, unwindBB, fnty, op0,op1,op2, ...]
if (Record.size() < 4) return Error("Invalid INVOKE record");
- PAListPtr PAL = getParamAttrs(Record[0]);
+ AttrListPtr PAL = getAttributes(Record[0]);
unsigned CCInfo = Record[1];
BasicBlock *NormalBB = getBasicBlock(Record[2]);
BasicBlock *UnwindBB = getBasicBlock(Record[3]);
@@ -1736,7 +1736,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
I = InvokeInst::Create(Callee, NormalBB, UnwindBB,
Ops.begin(), Ops.end());
cast<InvokeInst>(I)->setCallingConv(CCInfo);
- cast<InvokeInst>(I)->setParamAttrs(PAL);
+ cast<InvokeInst>(I)->setAttributes(PAL);
break;
}
case bitc::FUNC_CODE_INST_UNWIND: // UNWIND
@@ -1834,7 +1834,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
if (Record.size() < 3)
return Error("Invalid CALL record");
- PAListPtr PAL = getParamAttrs(Record[0]);
+ AttrListPtr PAL = getAttributes(Record[0]);
unsigned CCInfo = Record[1];
unsigned OpNum = 2;
@@ -1874,7 +1874,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
I = CallInst::Create(Callee, Args.begin(), Args.end());
cast<CallInst>(I)->setCallingConv(CCInfo>>1);
cast<CallInst>(I)->setTailCall(CCInfo & 1);
- cast<CallInst>(I)->setParamAttrs(PAL);
+ cast<CallInst>(I)->setAttributes(PAL);
break;
}
case bitc::FUNC_CODE_INST_VAARG: { // VAARG: [valistty, valist, instty]
diff --git a/lib/Bitcode/Reader/BitcodeReader.h b/lib/Bitcode/Reader/BitcodeReader.h
index 9eac14fd99..e8ad1ddaca 100644
--- a/lib/Bitcode/Reader/BitcodeReader.h
+++ b/lib/Bitcode/Reader/BitcodeReader.h
@@ -136,10 +136,10 @@ class BitcodeReader : public ModuleProvider {
std::vector<std::pair<GlobalVariable*, unsigned> > GlobalInits;
std::vector<std::pair<GlobalAlias*, unsigned> > AliasInits;
- /// ParamAttrs - The set of parameter attributes by index. Index zero in the
+ /// Attributes - The set of parameter attributes by index. Index zero in the
/// file is for null, and is thus not represented here. As such all indices
/// are off by one.
- std::vector<PAListPtr> ParamAttrs;
+ std::vector<AttrListPtr> Attributes;
/// FunctionBBs - While parsing a function body, this is a list of the basic
/// blocks for the function.
@@ -203,10 +203,10 @@ private:
if (ID >= FunctionBBs.size()) return 0; // Invalid ID
return FunctionBBs[ID];
}
- PAListPtr getParamAttrs(unsigned i) const {
- if (i-1 < ParamAttrs.size())
- return ParamAttrs[i-1];
- return PAListPtr();
+ AttrListPtr getAttributes(unsigned i) const {
+ if (i-1 < Attributes.size())
+ return Attributes[i-1];
+ return AttrListPtr();
}
/// getValueTypePair - Read a value/type pair out of the specified record from
@@ -239,7 +239,7 @@ private:
bool ParseModule(const std::string &ModuleID);
- bool ParseParamAttrBlock();
+ bool ParseAttributeBlock();
bool ParseTypeTable();
bool ParseTypeSymbolTable();
bool ParseValueSymbolTable();
diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp
index baacbddf96..4b0664e27b 100644
--- a/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -108,18 +108,18 @@ static void WriteStringRecord(unsigned Code, const std::string &Str,
}
// Emit information about parameter attributes.
-static void WriteParamAttrTable(const ValueEnumerator &VE,
+static void WriteAttributeTable(const ValueEnumerator &VE,
BitstreamWriter &Stream) {
- const std::vector<PAListPtr> &Attrs = VE.getParamAttrs();
+ const std::vector<AttrListPtr> &Attrs = VE.getAttributes();
if (Attrs.empty()) return;
Stream.EnterSubblock(bitc::PARAMATTR_BLOCK_ID, 3);
SmallVector<uint64_t, 64> Record;
for (unsigned i = 0, e = Attrs.size(); i != e; ++i) {
- const PAListPtr &A = Attrs[i];
+ const AttrListPtr &A = Attrs[i];
for (unsigned i = 0, e = A.getNumSlots(); i != e; ++i) {
- const FnAttributeWithIndex &PAWI = A.getSlot(i);
+ const AttributeWithIndex &PAWI = A.getSlot(i);
Record.push_back(PAWI.Index);
Record.push_back(PAWI.Attrs);
}
@@ -407,7 +407,7 @@ static void WriteModuleInfo(const Module *M, const ValueEnumerator &VE,
Vals.push_back(F->getCallingConv());
Vals.push_back(F->isDeclaration());
Vals.push_back(getEncodedLinkage(F));
- Vals.push_back(VE.getParamAttrID(F->getParamAttrs()));
+ Vals.push_back(VE.getAttributeID(F->getAttributes()));
Vals.push_back(Log2_32(F->getAlignment())+1);
Vals.push_back(F->hasSection() ? SectionMap[F->getSection()] : 0);
Vals.push_back(getEncodedVisibility(F));
@@ -818,7 +818,7 @@ static void WriteInstruction(const Instruction &I, unsigned InstID,
Code = bitc::FUNC_CODE_INST_INVOKE;
const InvokeInst *II = cast<InvokeInst>(&I);
- Vals.push_back(VE.getParamAttrID(II->getParamAttrs()));
+ Vals.push_back(VE.getAttributeID(II->getAttributes()));
Vals.push_back(II->getCallingConv());
Vals.push_back(VE.getValueID(I.getOperand(1))); // normal dest
Vals.push_back(VE.getValueID(I.getOperand(2))); // unwind dest
@@ -892,7 +892,7 @@ static void WriteInstruction(const Instruction &I, unsigned InstID,
Code = bitc::FUNC_CODE_INST_CALL;
const CallInst *CI = cast<CallInst>(&I);
- Vals.push_back(VE.getParamAttrID(CI->getParamAttrs()));
+ Vals.push_back(VE.getAttributeID(CI->getAttributes()));
Vals.push_back((CI->getCallingConv() << 1) | unsigned(CI->isTailCall()));
PushValueAndType(CI->getOperand(0), InstID, Vals, VE); // Callee
@@ -1226,7 +1226,7 @@ static void WriteModule(const Module *M, BitstreamWriter &Stream) {
WriteBlockInfo(VE, Stream);
// Emit information about parameter attributes.
- WriteParamAttrTable(VE, Stream);
+ WriteAttributeTable(VE, Stream);
// Emit information describing all of the types in the module.
WriteTypeTable(VE, Stream);
diff --git a/lib/Bitcode/Writer/ValueEnumerator.cpp b/lib/Bitcode/Writer/ValueEnumerator.cpp
index 21d0dfe7eb..1c12bc4cd4 100644
--- a/lib/Bitcode/Writer/ValueEnumerator.cpp
+++ b/lib/Bitcode/Writer/ValueEnumerator.cpp
@@ -47,7 +47,7 @@ ValueEnumerator::ValueEnumerator(const Module *M) {
// Enumerate the functions.
for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I) {
EnumerateValue(I);
- EnumerateParamAttrs(cast<Function>(I)->getParamAttrs());
+ EnumerateAttributes(cast<Function>(I)->getAttributes());
}
// Enumerate the aliases.
@@ -90,9 +90,9 @@ ValueEnumerator::ValueEnumerator(const Module *M) {
EnumerateOperandType(*OI);
EnumerateType(I->getType());
if (const CallInst *CI = dyn_cast<CallInst>(I))
- EnumerateParamAttrs(CI->getParamAttrs());
+ EnumerateAttributes(CI->getAttributes());
else if (const InvokeInst *II = dyn_cast<InvokeInst>(I))
- EnumerateParamAttrs(II->getParamAttrs());
+ EnumerateAttributes(II->getAttributes());
}
}
@@ -247,14 +247,14 @@ void ValueEnumerator::EnumerateOperandType(const Value *V) {
}
}
-void ValueEnumerator::EnumerateParamAttrs(const PAListPtr &PAL) {
+void ValueEnumerator::EnumerateAttributes(const AttrListPtr &PAL) {
if (PAL.isEmpty()) return; // null is always 0.
// Do a lookup.
- unsigned &Entry = ParamAttrMap[PAL.getRawPointer()];
+ unsigned &Entry = AttributeMap[PAL.getRawPointer()];
if (Entry == 0) {
// Never saw this before, add it.
- ParamAttrs.push_back(PAL);
- Entry = ParamAttrs.size();
+ Attributes.push_back(PAL);
+ Entry = Attributes.size();
}
}
@@ -303,7 +303,7 @@ void ValueEnumerator::incorporateFunction(const Function &F) {
// Add the function's parameter attributes so they are available for use in
// the function's instruction.
- EnumerateParamAttrs(F.getParamAttrs());
+ EnumerateAttributes(F.getAttributes());
FirstInstID = Values.size();
diff --git a/lib/Bitcode/Writer/ValueEnumerator.h b/lib/Bitcode/Writer/ValueEnumerator.h
index 405aec7016..bb0324b1c5 100644
--- a/lib/Bitcode/Writer/ValueEnumerator.h
+++ b/lib/Bitcode/Writer/ValueEnumerator.h
@@ -25,7 +25,7 @@ class Value;
class BasicBlock;
class Function;
class Module;
-class PAListPtr;
+class AttrListPtr;
class TypeSymbolTable;
class ValueSymbolTable;
@@ -45,9 +45,9 @@ private:
ValueMapType ValueMap;
ValueList Values;
- typedef DenseMap<void*, unsigned> ParamAttrMapType;
- ParamAttrMapType ParamAttrMap;
- std::vector<PAListPtr> ParamAttrs;
+ typedef DenseMap<void*, unsigned> AttributeMapType;
+ AttributeMapType AttributeMap;
+ std::vector<AttrListPtr> Attributes;
/// BasicBlocks - This contains all the basic blocks for the currently
/// incorporated function. Their reverse mapping is stored in ValueMap.
@@ -76,10 +76,10 @@ public:
return I->second-1;
}
- unsigned getParamAttrID(const PAListPtr &PAL) const {
+ unsigned getAttributeID(const AttrListPtr &PAL) const {
if (PAL.isEmpty()) return 0; // Null maps to zero.
- ParamAttrMapType::const_iterator I = ParamAttrMap.find(PAL.getRawPointer());
- assert(I != ParamAttrMap.end() && "ParamAttr not in ValueEnumerator!");
+ AttributeMapType::const_iterator I = AttributeMap.find(PAL.getRawPointer());
+ assert(I != AttributeMap.end() && "Attribute not in ValueEnumerator!");
return I->second;
}
@@ -95,8 +95,8 @@ public:
const std::vector<const BasicBlock*> &getBasicBlocks() const {
return BasicBlocks;
}
- const std::vector<PAListPtr> &getParamAttrs() const {
- return ParamAttrs;
+ const std::vector<AttrListPtr> &getAttributes() const {
+ return Attributes;
}
/// PurgeAggregateValues - If there are any aggregate values at the end of the
@@ -116,7 +116,7 @@ private:
void EnumerateValue(const Value *V);
void EnumerateType(const Type *T);
void EnumerateOperandType(const Value *V);
- void EnumerateParamAttrs(const PAListPtr &PAL);
+ void EnumerateAttributes(const AttrListPtr &PAL);
void EnumerateTypeSymbolTable(const TypeSymbolTable &ST);
void EnumerateValueSymbolTable(const ValueSymbolTable &ST);