diff options
author | Bill Wendling <isanbard@gmail.com> | 2012-12-30 13:50:49 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2012-12-30 13:50:49 +0000 |
commit | 749a43d874f06127fa163efff456693e29124aeb (patch) | |
tree | 250a92158e98d233cdf18f64c1bb176df12ce84a /llvm/lib/VMCore | |
parent | 74dba875e2f2d60919f0151022a995ef4883efb5 (diff) | |
download | bcm5719-llvm-749a43d874f06127fa163efff456693e29124aeb.tar.gz bcm5719-llvm-749a43d874f06127fa163efff456693e29124aeb.zip |
Use the predicate methods off of AttributeSet instead of Attribute.
llvm-svn: 171257
Diffstat (limited to 'llvm/lib/VMCore')
-rw-r--r-- | llvm/lib/VMCore/AsmWriter.cpp | 27 | ||||
-rw-r--r-- | llvm/lib/VMCore/Core.cpp | 5 | ||||
-rw-r--r-- | llvm/lib/VMCore/Instructions.cpp | 10 |
3 files changed, 19 insertions, 23 deletions
diff --git a/llvm/lib/VMCore/AsmWriter.cpp b/llvm/lib/VMCore/AsmWriter.cpp index 08aa73cfa9f..7e80322cc63 100644 --- a/llvm/lib/VMCore/AsmWriter.cpp +++ b/llvm/lib/VMCore/AsmWriter.cpp @@ -1197,7 +1197,7 @@ public: void printModule(const Module *M); void writeOperand(const Value *Op, bool PrintType); - void writeParamOperand(const Value *Operand, Attribute Attrs); + void writeParamOperand(const Value *Operand, AttributeSet Attrs,unsigned Idx); void writeAtomic(AtomicOrdering Ordering, SynchronizationScope SynchScope); void writeAllMDNodes(); @@ -1206,7 +1206,7 @@ public: void printGlobal(const GlobalVariable *GV); void printAlias(const GlobalAlias *GV); void printFunction(const Function *F); - void printArgument(const Argument *FA, Attribute Attrs); + void printArgument(const Argument *FA, AttributeSet Attrs, unsigned Idx); void printBasicBlock(const BasicBlock *BB); void printInstruction(const Instruction &I); @@ -1251,7 +1251,7 @@ void AssemblyWriter::writeAtomic(AtomicOrdering Ordering, } void AssemblyWriter::writeParamOperand(const Value *Operand, - Attribute Attrs) { + AttributeSet Attrs, unsigned Idx) { if (Operand == 0) { Out << "<null operand!>"; return; @@ -1260,8 +1260,8 @@ void AssemblyWriter::writeParamOperand(const Value *Operand, // Print the type TypePrinter.print(Operand->getType(), Out); // Print parameter attributes list - if (Attrs.hasAttributes()) - Out << ' ' << Attrs.getAsString(); + if (Attrs.hasAttributes(Idx)) + Out << ' ' << Attrs.getAsString(Idx); Out << ' '; // Print the operand WriteAsOperandInternal(Out, Operand, &TypePrinter, &Machine, TheModule); @@ -1575,7 +1575,7 @@ void AssemblyWriter::printFunction(const Function *F) { I != E; ++I) { // Insert commas as we go... the first arg doesn't get a comma if (I != F->arg_begin()) Out << ", "; - printArgument(I, Attrs.getParamAttributes(Idx)); + printArgument(I, Attrs, Idx); Idx++; } } else { @@ -1587,9 +1587,8 @@ void AssemblyWriter::printFunction(const Function *F) { // Output type... TypePrinter.print(FT->getParamType(i), Out); - Attribute ArgAttrs = Attrs.getParamAttributes(i+1); - if (ArgAttrs.hasAttributes()) - Out << ' ' << ArgAttrs.getAsString(); + if (Attrs.hasAttributes(i+1)) + Out << ' ' << Attrs.getAsString(i+1); } } @@ -1630,13 +1629,13 @@ void AssemblyWriter::printFunction(const Function *F) { /// the function. Simply print it out /// void AssemblyWriter::printArgument(const Argument *Arg, - Attribute Attrs) { + AttributeSet Attrs, unsigned Idx) { // Output type... TypePrinter.print(Arg->getType(), Out); // Output parameter attributes list - if (Attrs.hasAttributes()) - Out << ' ' << Attrs.getAsString(); + if (Attrs.hasAttributes(Idx)) + Out << ' ' << Attrs.getAsString(Idx); // Output name, if available... if (Arg->hasName()) { @@ -1871,7 +1870,7 @@ void AssemblyWriter::printInstruction(const Instruction &I) { for (unsigned op = 0, Eop = CI->getNumArgOperands(); op < Eop; ++op) { if (op > 0) Out << ", "; - writeParamOperand(CI->getArgOperand(op), PAL.getParamAttributes(op + 1)); + writeParamOperand(CI->getArgOperand(op), PAL, op + 1); } Out << ')'; if (PAL.hasAttributes(AttributeSet::FunctionIndex)) @@ -1910,7 +1909,7 @@ void AssemblyWriter::printInstruction(const Instruction &I) { for (unsigned op = 0, Eop = II->getNumArgOperands(); op < Eop; ++op) { if (op) Out << ", "; - writeParamOperand(II->getArgOperand(op), PAL.getParamAttributes(op + 1)); + writeParamOperand(II->getArgOperand(op), PAL, op + 1); } Out << ')'; diff --git a/llvm/lib/VMCore/Core.cpp b/llvm/lib/VMCore/Core.cpp index 60a8483aba5..a1e9cf3f359 100644 --- a/llvm/lib/VMCore/Core.cpp +++ b/llvm/lib/VMCore/Core.cpp @@ -1476,9 +1476,8 @@ void LLVMRemoveAttribute(LLVMValueRef Arg, LLVMAttribute PA) { LLVMAttribute LLVMGetAttribute(LLVMValueRef Arg) { Argument *A = unwrap<Argument>(Arg); - Attribute attr = A->getParent()->getAttributes().getParamAttributes( - A->getArgNo()+1); - return (LLVMAttribute)attr.getBitMask(); + return (LLVMAttribute)A->getParent()->getAttributes(). + getBitMask(A->getArgNo()+1); } diff --git a/llvm/lib/VMCore/Instructions.cpp b/llvm/lib/VMCore/Instructions.cpp index 23db33646e5..dffd13c0ee4 100644 --- a/llvm/lib/VMCore/Instructions.cpp +++ b/llvm/lib/VMCore/Instructions.cpp @@ -344,8 +344,7 @@ void CallInst::removeAttribute(unsigned i, Attribute attr) { } bool CallInst::hasFnAttr(Attribute::AttrKind A) const { - if (AttributeList.getParamAttributes(AttributeSet::FunctionIndex) - .hasAttribute(A)) + if (AttributeList.hasAttribute(AttributeSet::FunctionIndex, A)) return true; if (const Function *F = getCalledFunction()) return F->getAttributes().hasAttribute(AttributeSet::FunctionIndex, A); @@ -353,7 +352,7 @@ bool CallInst::hasFnAttr(Attribute::AttrKind A) const { } bool CallInst::paramHasAttr(unsigned i, Attribute::AttrKind A) const { - if (AttributeList.getParamAttributes(i).hasAttribute(A)) + if (AttributeList.hasAttribute(i, A)) return true; if (const Function *F = getCalledFunction()) return F->getAttributes().hasAttribute(i, A); @@ -573,8 +572,7 @@ void InvokeInst::setSuccessorV(unsigned idx, BasicBlock *B) { } bool InvokeInst::hasFnAttr(Attribute::AttrKind A) const { - if (AttributeList.getParamAttributes(AttributeSet::FunctionIndex). - hasAttribute(A)) + if (AttributeList.hasAttribute(AttributeSet::FunctionIndex, A)) return true; if (const Function *F = getCalledFunction()) return F->getAttributes().hasAttribute(AttributeSet::FunctionIndex, A); @@ -582,7 +580,7 @@ bool InvokeInst::hasFnAttr(Attribute::AttrKind A) const { } bool InvokeInst::paramHasAttr(unsigned i, Attribute::AttrKind A) const { - if (AttributeList.getParamAttributes(i).hasAttribute(A)) + if (AttributeList.hasAttribute(i, A)) return true; if (const Function *F = getCalledFunction()) return F->getAttributes().hasAttribute(i, A); |