static Attribute decodeLLVMAttributesForBitcode(LLVMContext &C,
uint64_t EncodedAttrs);
- /// \brief The set of attributes set in Attribute is converted to a string of
- /// equivalent mnemonics. This is, presumably, for writing out the mnemonics
- /// for the assembly writer.
+ /// \brief The Attribute is converted to a string of equivalent mnemonic. This
+ /// is, presumably, for writing out the mnemonics for the assembly writer.
std::string getAsString() const;
};
/// @brief Determine if the function returns a structure through first
/// pointer argument.
bool hasStructRetAttr() const {
- return AttributeList.getParamAttributes(1).
- hasAttribute(Attribute::StructRet);
+ return AttributeList.hasAttribute(1, Attribute::StructRet);
}
/// @brief Determine if the parameter does not alias other parameters.
/// @param n The parameter to check. 1 is the first parameter, 0 is the return
bool doesNotAlias(unsigned n) const {
- return AttributeList.getParamAttributes(n).
- hasAttribute(Attribute::NoAlias);
+ return AttributeList.hasAttribute(n, Attribute::NoAlias);
}
void setDoesNotAlias(unsigned n) {
addAttribute(n, Attribute::get(getContext(), Attribute::NoAlias));
/// @brief Determine if the parameter can be captured.
/// @param n The parameter to check. 1 is the first parameter, 0 is the return
bool doesNotCapture(unsigned n) const {
- return AttributeList.getParamAttributes(n).
- hasAttribute(Attribute::NoCapture);
+ return AttributeList.hasAttribute(n, Attribute::NoCapture);
}
void setDoesNotCapture(unsigned n) {
addAttribute(n, Attribute::get(getContext(), Attribute::NoCapture));
AttributeSet PAL = AttributeSet::get(Context, Attrs);
- if (PAL.getParamAttributes(1).hasAttribute(Attribute::StructRet) &&
- !RetType->isVoidTy())
+ if (PAL.hasAttribute(1, Attribute::StructRet) && !RetType->isVoidTy())
return Error(RetTypeLoc, "functions with 'sret' argument must return void");
FunctionType *FT =
continue;
}
- if (PAL.getParamAttributes(paramIndex+1).
- hasAttribute(Attribute::ByVal) == false) {
+ if (PAL.hasAttribute(paramIndex+1, Attribute::ByVal) == false) {
// Just a scalar
const PointerType *PTy = dyn_cast<PointerType>(Ty);
if (isKernelFunc) {
// to newly created nodes. The SDNOdes for params have to
// appear in the same order as their order of appearance
// in the original function. "idx+1" holds that order.
- if (PAL.getParamAttributes(i+1).hasAttribute(Attribute::ByVal) == false) {
+ if (PAL.hasAttribute(i+1, Attribute::ByVal) == false) {
// A plain scalar.
if (isABI || isKernel) {
// If ABI, load from the param symbol
for (FunctionType::param_iterator I = FTy->param_begin(),
E = FTy->param_end(); I != E; ++I, ++Idx)
- if (Attrs.getParamAttributes(Idx).hasAttribute(Attribute::InReg))
+ if (Attrs.hasAttribute(Idx, Attribute::InReg))
// FIXME: should only count parameters that are lowered to integers.
InRegCount += (TD->getTypeSizeInBits(*I) + 31) / 32;
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();
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);
}
void AssemblyWriter::writeParamOperand(const Value *Operand,
- Attribute Attrs) {
+ AttributeSet Attrs, unsigned Idx) {
if (Operand == 0) {
Out << "<null operand!>";
return;
// 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);
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 {
// 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);
}
}
/// 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()) {
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))
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 << ')';
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);
}
}
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);
}
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);
}
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);
}
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);