[llvm-commits] [llvm] r51204 - in /llvm/trunk: include/llvm/Function.h include/llvm/Instructions.h lib/VMCore/Function.cpp lib/VMCore/Instructions.cpp
Eric Christopher
echristo at apple.com
Fri May 16 13:39:43 PDT 2008
Author: echristo
Date: Fri May 16 15:39:43 2008
New Revision: 51204
URL: http://llvm.org/viewvc/llvm-project?rev=51204&view=rev
Log:
Add functions to enable adding a single attribute to a function and
its associated call site.
Modified:
llvm/trunk/include/llvm/Function.h
llvm/trunk/include/llvm/Instructions.h
llvm/trunk/lib/VMCore/Function.cpp
llvm/trunk/lib/VMCore/Instructions.cpp
Modified: llvm/trunk/include/llvm/Function.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Function.h?rev=51204&r1=51203&r2=51204&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Function.h (original)
+++ llvm/trunk/include/llvm/Function.h Fri May 16 15:39:43 2008
@@ -170,6 +170,9 @@
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 {
Modified: llvm/trunk/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=51204&r1=51203&r2=51204&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Instructions.h (original)
+++ llvm/trunk/include/llvm/Instructions.h Fri May 16 15:39:43 2008
@@ -1109,6 +1109,9 @@
/// 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 @@
/// @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 {
Modified: llvm/trunk/lib/VMCore/Function.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Function.cpp?rev=51204&r1=51203&r2=51204&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Function.cpp (original)
+++ llvm/trunk/lib/VMCore/Function.cpp Fri May 16 15:39:43 2008
@@ -240,6 +240,12 @@
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
Modified: llvm/trunk/lib/VMCore/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=51204&r1=51203&r2=51204&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Instructions.cpp (original)
+++ llvm/trunk/lib/VMCore/Instructions.cpp Fri May 16 15:39:43 2008
@@ -373,6 +373,12 @@
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 @@
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)
More information about the llvm-commits
mailing list