diff options
author | Eli Bendersky <eliben@chromium.org> | 2013-03-11 15:16:37 -0700 |
---|---|---|
committer | Eli Bendersky <eliben@chromium.org> | 2013-03-11 15:16:37 -0700 |
commit | 23c00401dad33ca247d2818e71540079bed63c5b (patch) | |
tree | df9f25d60f9538fbde84b78cf3c4e4a00eb6c3db /include/llvm/IR/Function.h | |
parent | 79da56afe68a0c5b2c2227681014dd13705d78cc (diff) | |
parent | 279b9184c2ff4fea93b198a3519b8cb3a1d8d195 (diff) |
Merge commit '279b9184c2ff4fea93b198a3519b8cb3a1d8d195'
Conflicts:
include/llvm/CodeGen/LexicalScopes.h
include/llvm/MC/MCAsmInfo.h
lib/Linker/LinkArchives.cpp
lib/Linker/LinkItems.cpp
lib/MC/MCAsmInfo.cpp
lib/MC/MCDwarf.cpp
lib/Target/ARM/ARMInstrInfo.td
lib/Target/ARM/ARMSubtarget.cpp
lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp
lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp
lib/Target/Mips/MipsAsmPrinter.cpp
lib/Target/Mips/MipsDelaySlotFiller.cpp
lib/Target/Mips/MipsISelDAGToDAG.cpp
lib/Target/Mips/MipsSubtarget.cpp
lib/Target/Mips/MipsSubtarget.h
lib/Target/Mips/MipsTargetObjectFile.cpp
lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp
lib/Target/X86/X86FastISel.cpp
lib/Target/X86/X86ISelLowering.cpp
lib/Target/X86/X86TargetMachine.cpp
lib/Transforms/CMakeLists.txt
lib/Transforms/LLVMBuild.txt
lib/Transforms/Makefile
test/MC/ARM/arm_instructions.s
test/MC/X86/AlignedBundling/pad-align-to-bundle-end.s
Diffstat (limited to 'include/llvm/IR/Function.h')
-rw-r--r-- | include/llvm/IR/Function.h | 56 |
1 files changed, 30 insertions, 26 deletions
diff --git a/include/llvm/IR/Function.h b/include/llvm/IR/Function.h index 9bdaebac82..568b55c87b 100644 --- a/include/llvm/IR/Function.h +++ b/include/llvm/IR/Function.h @@ -85,7 +85,7 @@ private: BasicBlockListType BasicBlocks; ///< The basic blocks mutable ArgumentListType ArgumentList; ///< The formal arguments ValueSymbolTable *SymTab; ///< Symbol table of args/instructions - AttributeSet AttributeList; ///< Parameter attributes + AttributeSet AttributeSets; ///< Parameter attributes // HasLazyArguments is stored in Value::SubclassData. /*bool HasLazyArguments;*/ @@ -162,24 +162,25 @@ public: /// getAttributes - Return the attribute list for this Function. /// - const AttributeSet &getAttributes() const { return AttributeList; } + AttributeSet getAttributes() const { return AttributeSets; } /// setAttributes - Set the attribute list for this Function. /// - void setAttributes(const AttributeSet &attrs) { AttributeList = attrs; } + void setAttributes(AttributeSet attrs) { AttributeSets = attrs; } /// addFnAttr - Add function attributes to this function. /// void addFnAttr(Attribute::AttrKind N) { - // Function Attribute are stored at ~0 index - addAttribute(AttributeSet::FunctionIndex, Attribute::get(getContext(), N)); + setAttributes(AttributeSets.addAttribute(getContext(), + AttributeSet::FunctionIndex, N)); } - /// removeFnAttr - Remove function attributes from this function. - /// - void removeFnAttr(Attribute N) { - // Function Attribute are stored at ~0 index - removeAttribute(~0U, N); + /// \brief Return true if the function has the attribute. + bool hasFnAttribute(Attribute::AttrKind Kind) const { + return AttributeSets.hasAttribute(AttributeSet::FunctionIndex, Kind); + } + bool hasFnAttribute(StringRef Kind) const { + return AttributeSets.hasAttribute(AttributeSet::FunctionIndex, Kind); } /// hasGC/getGC/setGC/clearGC - The name of the garbage collection algorithm @@ -189,20 +190,23 @@ public: void setGC(const char *Str); void clearGC(); - /// addAttribute - adds the attribute to the list of attributes. - void addAttribute(unsigned i, Attribute attr); + /// @brief adds the attribute to the list of attributes. + void addAttribute(unsigned i, Attribute::AttrKind attr); + + /// @brief adds the attributes to the list of attributes. + void addAttributes(unsigned i, AttributeSet attrs); - /// removeAttribute - removes the attribute from the list of attributes. - void removeAttribute(unsigned i, Attribute attr); + /// @brief removes the attributes from the list of attributes. + void removeAttributes(unsigned i, AttributeSet attr); /// @brief Extract the alignment for a call or parameter (0=unknown). unsigned getParamAlignment(unsigned i) const { - return AttributeList.getParamAlignment(i); + return AttributeSets.getParamAlignment(i); } /// @brief Determine if the function does not access memory. bool doesNotAccessMemory() const { - return AttributeList.hasAttribute(AttributeSet::FunctionIndex, + return AttributeSets.hasAttribute(AttributeSet::FunctionIndex, Attribute::ReadNone); } void setDoesNotAccessMemory() { @@ -212,7 +216,7 @@ public: /// @brief Determine if the function does not access or only reads memory. bool onlyReadsMemory() const { return doesNotAccessMemory() || - AttributeList.hasAttribute(AttributeSet::FunctionIndex, + AttributeSets.hasAttribute(AttributeSet::FunctionIndex, Attribute::ReadOnly); } void setOnlyReadsMemory() { @@ -221,7 +225,7 @@ public: /// @brief Determine if the function cannot return. bool doesNotReturn() const { - return AttributeList.hasAttribute(AttributeSet::FunctionIndex, + return AttributeSets.hasAttribute(AttributeSet::FunctionIndex, Attribute::NoReturn); } void setDoesNotReturn() { @@ -230,7 +234,7 @@ public: /// @brief Determine if the function cannot unwind. bool doesNotThrow() const { - return AttributeList.hasAttribute(AttributeSet::FunctionIndex, + return AttributeSets.hasAttribute(AttributeSet::FunctionIndex, Attribute::NoUnwind); } void setDoesNotThrow() { @@ -239,7 +243,7 @@ public: /// @brief Determine if the call cannot be duplicated. bool cannotDuplicate() const { - return AttributeList.hasAttribute(AttributeSet::FunctionIndex, + return AttributeSets.hasAttribute(AttributeSet::FunctionIndex, Attribute::NoDuplicate); } void setCannotDuplicate() { @@ -249,7 +253,7 @@ public: /// @brief True if the ABI mandates (or the user requested) that this /// function be in a unwind table. bool hasUWTable() const { - return AttributeList.hasAttribute(AttributeSet::FunctionIndex, + return AttributeSets.hasAttribute(AttributeSet::FunctionIndex, Attribute::UWTable); } void setHasUWTable() { @@ -264,25 +268,25 @@ public: /// @brief Determine if the function returns a structure through first /// pointer argument. bool hasStructRetAttr() const { - return AttributeList.hasAttribute(1, Attribute::StructRet); + return AttributeSets.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.hasAttribute(n, Attribute::NoAlias); + return AttributeSets.hasAttribute(n, Attribute::NoAlias); } void setDoesNotAlias(unsigned n) { - addAttribute(n, Attribute::get(getContext(), Attribute::NoAlias)); + addAttribute(n, 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.hasAttribute(n, Attribute::NoCapture); + return AttributeSets.hasAttribute(n, Attribute::NoCapture); } void setDoesNotCapture(unsigned n) { - addAttribute(n, Attribute::get(getContext(), Attribute::NoCapture)); + addAttribute(n, Attribute::NoCapture); } /// copyAttributesFrom - copy all additional attributes (those not needed to |