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
This commit is contained in:
Devang Patel
2008-09-25 21:00:45 +00:00
parent 32b952a2a6
commit 0598866c05
53 changed files with 1168 additions and 1169 deletions

View File

@ -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]