diff options
author | Devang Patel <dpatel@apple.com> | 2008-09-25 21:00:45 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2008-09-25 21:00:45 +0000 |
commit | 0598866c052147c31b808391f58434ce3dbfb838 (patch) | |
tree | 5a33037d52126e5eb635d76afe643d9b854694a1 /lib/Bitcode/Reader | |
parent | 32b952a2a60d1091e0e17bb6ce788cd1d41e6f8b (diff) |
Large mechanical patch.
s/ParamAttr/Attribute/g
s/PAList/AttrList/g
s/FnAttributeWithIndex/AttributeWithIndex/g
s/FnAttr/Attribute/g
This sets the stage
- to implement function notes as function attributes and
- to distinguish between function attributes and return value attributes.
This requires corresponding changes in llvm-gcc and clang.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56622 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bitcode/Reader')
-rw-r--r-- | lib/Bitcode/Reader/BitcodeReader.cpp | 26 | ||||
-rw-r--r-- | lib/Bitcode/Reader/BitcodeReader.h | 14 |
2 files changed, 20 insertions, 20 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(); |