diff options
author | Eric Christopher <echristo@apple.com> | 2008-05-16 20:39:43 +0000 |
---|---|---|
committer | Eric Christopher <echristo@apple.com> | 2008-05-16 20:39:43 +0000 |
commit | 0bf7b414ae0bb6699cadc3a210d18cfec44e9354 (patch) | |
tree | e971e77f496a9001380a6cf15a17f52af1b923e0 | |
parent | ea7dd407149332e5ab1ffc42c8344ecd1751008f (diff) | |
download | external_llvm-0bf7b414ae0bb6699cadc3a210d18cfec44e9354.zip external_llvm-0bf7b414ae0bb6699cadc3a210d18cfec44e9354.tar.gz external_llvm-0bf7b414ae0bb6699cadc3a210d18cfec44e9354.tar.bz2 |
Add functions to enable adding a single attribute to a function and
its associated call site.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51204 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/Function.h | 3 | ||||
-rw-r--r-- | include/llvm/Instructions.h | 6 | ||||
-rw-r--r-- | lib/VMCore/Function.cpp | 6 | ||||
-rw-r--r-- | lib/VMCore/Instructions.cpp | 12 |
4 files changed, 27 insertions, 0 deletions
diff --git a/include/llvm/Function.h b/include/llvm/Function.h index 28c301f..5dd8502 100644 --- a/include/llvm/Function.h +++ b/include/llvm/Function.h @@ -170,6 +170,9 @@ public: bool paramHasAttr(unsigned i, ParameterAttributes attr) const { return ParamAttrs.paramHasAttr(i, attr); } + + /// addParamAttr - adds the attribute to the list of attributes. + void addParamAttr(unsigned i, ParameterAttributes attr); /// @brief Extract the alignment for a call or parameter (0=unknown). unsigned getParamAlignment(unsigned i) const { diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h index ba46b20..1bd2cba 100644 --- a/include/llvm/Instructions.h +++ b/include/llvm/Instructions.h @@ -1109,6 +1109,9 @@ public: /// setParamAttrs - Sets the parameter attributes for this call. void setParamAttrs(const PAListPtr &Attrs) { ParamAttrs = Attrs; } + + /// addParamAttr - adds the attribute to the list of attributes. + void addParamAttr(unsigned i, ParameterAttributes attr); /// @brief Determine whether the call or the callee has the given attribute. bool paramHasAttr(unsigned i, unsigned attr) const; @@ -2428,6 +2431,9 @@ public: /// @brief Determine whether the call or the callee has the given attribute. bool paramHasAttr(unsigned i, ParameterAttributes attr) const; + + /// addParamAttr - adds the attribute to the list of attributes. + void addParamAttr(unsigned i, ParameterAttributes attr); /// @brief Extract the alignment for a call or parameter (0=unknown). unsigned getParamAlignment(unsigned i) const { diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp index 9f7eefe..49e69e1 100644 --- a/lib/VMCore/Function.cpp +++ b/lib/VMCore/Function.cpp @@ -240,6 +240,12 @@ void Function::setDoesNotThrow(bool doesNotThrow) { setParamAttrs(PAL); } +void Function::addParamAttr(unsigned i, ParameterAttributes attr) { + PAListPtr PAL = getParamAttrs(); + PAL = PAL.addAttr(i, attr); + setParamAttrs(PAL); +} + // Maintain the collector name for each function in an on-the-side table. This // saves allocating an additional word in Function for programs which do not use // GC (i.e., most programs) at the cost of increased overhead for clients which diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp index ff3b8b5..40eea13 100644 --- a/lib/VMCore/Instructions.cpp +++ b/lib/VMCore/Instructions.cpp @@ -373,6 +373,12 @@ CallInst::CallInst(const CallInst &CI) OL[i].init(InOL[i], this); } +void CallInst::addParamAttr(unsigned i, ParameterAttributes attr) { + PAListPtr PAL = getParamAttrs(); + PAL = PAL.addAttr(i, attr); + setParamAttrs(PAL); +} + bool CallInst::paramHasAttr(unsigned i, ParameterAttributes attr) const { if (ParamAttrs.paramHasAttr(i, attr)) return true; @@ -449,6 +455,12 @@ bool InvokeInst::paramHasAttr(unsigned i, ParameterAttributes attr) const { return false; } +void InvokeInst::addParamAttr(unsigned i, ParameterAttributes attr) { + PAListPtr PAL = getParamAttrs(); + PAL = PAL.addAttr(i, attr); + setParamAttrs(PAL); +} + void InvokeInst::setDoesNotThrow(bool doesNotThrow) { PAListPtr PAL = getParamAttrs(); if (doesNotThrow) |