18 #ifndef LLVM_IR_FUNCTION_H
19 #define LLVM_IR_FUNCTION_H
57 return static_cast<Argument*
>(&Sentinel);
98 void setParent(
Module *parent);
104 bool hasLazyArguments()
const {
107 void CheckLazyArguments()
const {
108 if (hasLazyArguments())
109 BuildLazyArguments();
111 void BuildLazyArguments()
const;
114 void operator=(const Function&) LLVM_DELETED_FUNCTION;
125 const Twine &
N = "", Module *M = 0);
130 return new(0)
Function(Ty, Linkage, N, M);
166 (static_cast<unsigned>(CC) << 2));
178 AttributeSet::FunctionIndex, N));
184 getContext(), AttributeSet::FunctionIndex, N));
191 AttributeSet::FunctionIndex, Kind));
196 AttributeSet::FunctionIndex, Kind, Value));
201 return AttributeSets.
hasAttribute(AttributeSet::FunctionIndex, Kind);
204 return AttributeSets.
hasAttribute(AttributeSet::FunctionIndex, Kind);
209 return AttributeSets.
getAttribute(AttributeSet::FunctionIndex, Kind);
212 return AttributeSets.
getAttribute(AttributeSet::FunctionIndex, Kind);
218 const char *
getGC()
const;
219 void setGC(
const char *Str);
238 return AttributeSets.
hasAttribute(AttributeSet::FunctionIndex,
257 return AttributeSets.
hasAttribute(AttributeSet::FunctionIndex,
266 return AttributeSets.
hasAttribute(AttributeSet::FunctionIndex,
275 return AttributeSets.
hasAttribute(AttributeSet::FunctionIndex,
285 return AttributeSets.
hasAttribute(AttributeSet::FunctionIndex,
363 CheckLazyArguments();
367 CheckLazyArguments();
371 return &Function::ArgumentList;
377 return &Function::BasicBlocks;
411 CheckLazyArguments();
412 return ArgumentList.
begin();
415 CheckLazyArguments();
416 return ArgumentList.
begin();
419 CheckLazyArguments();
420 return ArgumentList.
end();
423 CheckLazyArguments();
424 return ArgumentList.
end();
490 void setValueSubclassData(
unsigned short D) {
495 inline ValueSymbolTable *
bool isDefTriviallyDead() const
BasicBlockListType::const_iterator const_iterator
static void noteHead(BasicBlock *, BasicBlock *)
LLVMContext & getContext() const
LLVM Argument representation.
ArgumentListType::iterator arg_iterator
static void destroySentinel(Argument *)
bool onlyReadsMemory() const
Determine if the function does not access or only reads memory.
The main container class for the LLVM Intermediate Representation.
bool doesNotAccessMemory(unsigned n) const
const char * getGC() const
Externally visible function.
Type * getReturnType() const
unsigned getParamAlignment(unsigned Index) const
Return the alignment for the specified function parameter.
Attribute getFnAttribute(Attribute::AttrKind Kind) const
Return the attribute for the given attribute kind.
Argument * provideInitialHead() const
const_arg_iterator arg_end() const
bool hasAttribute(unsigned Index, Attribute::AttrKind Kind) const
Return true if the attribute exists at the given index.
virtual void removeFromParent()
CallingConv::ID getCallingConv() const
bool doesNotAlias(unsigned n) const
Determine if the parameter does not alias other parameters.
StringRef getName() const
AttributeSet removeAttribute(LLVMContext &C, unsigned Index, Attribute::AttrKind Attr) const
Remove the specified attribute at the specified index from this attribute list. Since attribute lists...
bool doesNotThrow() const
Determine if the function cannot unwind.
This file contains the simple types necessary to represent the attributes associated with functions a...
Function must be in a unwind table.
bool onlyReadsMemory(unsigned n) const
void copyAttributesFrom(const GlobalValue *Src)
ID
LLVM Calling Convention Representation.
const_iterator end() const
Function does not access memory.
Hidden pointer to structure to return.
Function creates no aliases of pointer.
void addFnAttr(Attribute::AttrKind N)
Add function attributes to this function.
void addFnAttr(StringRef Kind, StringRef Value)
static void noteHead(Argument *, Argument *)
const BasicBlock & back() const
bool hasStructRetAttr() const
Determine if the function returns a structure through first pointer argument.
const_iterator begin() const
BasicBlock * createSentinel() const
void removeAttributes(unsigned i, AttributeSet attr)
removes the attributes from the list of attributes.
ValueSymbolTable & getValueSymbolTable()
bool doesNotAccessMemory() const
Determine if the function does not access memory.
Considered to not alias after call.
bool hasAddressTaken(const User **=0) const
void setDoesNotCapture(unsigned n)
void setCallingConv(CallingConv::ID CC)
void setOnlyReadsMemory()
const ValueSymbolTable & getValueSymbolTable() const
LLVM Basic Block Representation.
iplist< BasicBlock > BasicBlockListType
const_arg_iterator arg_begin() const
unsigned getIntrinsicID() const LLVM_READONLY
size_type LLVM_ATTRIBUTE_UNUSED_RESULT size() const
LLVM Constant Representation.
BasicBlock & getEntryBlock()
void setDoesNotAlias(unsigned n)
bool doesNotReturn() const
Determine if the function cannot return.
unsigned getValueID() const
BasicBlock * provideInitialHead() const
Function doesn't unwind stack.
BasicBlockListType::iterator iterator
Mark the function as not returning.
void setDoesNotAccessMemory(unsigned n)
static iplist< BasicBlock > Function::* getSublistAccess(BasicBlock *)
static iplist< Argument > Function::* getSublistAccess(Argument *)
Call cannot be duplicated.
void setCannotDuplicate()
BasicBlockListType & getBasicBlockList()
const BasicBlockListType & getBasicBlockList() const
bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const
bool needsUnwindTableEntry() const
True if this function needs an unwind table.
const BasicBlock & getEntryBlock() const
void setValueSubclassData(unsigned short D)
void setLinkage(LinkageTypes LT)
#define LLVM_DELETED_FUNCTION
AttributeSet getAttributes() const
Return the attribute list for this Function.
ArgumentListType & getArgumentList()
LinkageTypes
An enumeration for the kinds of linkage for global values.
void addAttribute(unsigned i, Attribute::AttrKind attr)
adds the attribute to the list of attributes.
static bool classof(const Value *V)
Methods for support type inquiry through isa, cast, and dyn_cast:
Function only reads from memory.
void setGC(const char *Str)
AttributeSet addAttribute(LLVMContext &C, unsigned Index, Attribute::AttrKind Attr) const
Add an attribute to the attribute set at the given index. Since attribute sets are immutable...
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
unsigned short getSubclassDataFromValue() const
void setDoesNotAccessMemory()
void removeFnAttr(Attribute::AttrKind N)
Remove function attributes from this function.
BasicBlock * ensureHead(BasicBlock *) const
FunctionType * getFunctionType() const
bool callsFunctionThatReturnsTwice() const
void addFnAttr(StringRef Kind)
Add function attributes to this function.
static bool getSymTab(Value *V, ValueSymbolTable *&ST)
bool hasPrefixData() const
bool hasUWTable() const
True if the ABI mandates (or the user requested) that this function be in a unwind table...
virtual void eraseFromParent()
Constant * getPrefixData() const
void setAttributes(AttributeSet attrs)
Set the attribute list for this Function.
Argument * createSentinel() const
Attribute getAttribute(unsigned Index, Attribute::AttrKind Kind) const
Return the attribute object that exists at the given index.
bool cannotDuplicate() const
Determine if the call cannot be duplicated.
static NodeTy * createSentinel()
createSentinel - create the dynamic sentinel
bool hasFnAttribute(StringRef Kind) const
const BasicBlock & front() const
unsigned getParamAlignment(unsigned i) const
Extract the alignment for a call or parameter (0=unknown).
iplist< Argument > ArgumentListType
LLVM Value Representation.
void setOnlyReadsMemory(unsigned n)
bool doesNotCapture(unsigned n) const
Determine if the parameter can be captured.
const ArgumentListType & getArgumentList() const
static void destroySentinel(BasicBlock *)
ArgumentListType::const_iterator const_arg_iterator
void addAttributes(unsigned i, AttributeSet attrs)
adds the attributes to the list of attributes.
Argument * ensureHead(Argument *) const
static Function * Create(FunctionType *Ty, LinkageTypes Linkage, const Twine &N="", Module *M=0)
void setPrefixData(Constant *PrefixData)
Attribute getFnAttribute(StringRef Kind) const