aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2007-11-14 09:52:30 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2007-11-14 09:52:30 +0000
commit3b8a5f3a98a0dc78501f72d61b71821ca1be26e6 (patch)
tree8cebb7acc3eca8f9ae8a7a5a3a0554070941dc81 /lib/VMCore
parent5772c674c773e0c96f6e624000e35840ba56817a (diff)
downloadexternal_llvm-3b8a5f3a98a0dc78501f72d61b71821ca1be26e6.zip
external_llvm-3b8a5f3a98a0dc78501f72d61b71821ca1be26e6.tar.gz
external_llvm-3b8a5f3a98a0dc78501f72d61b71821ca1be26e6.tar.bz2
Add pure/const attributes. Documentation will follow.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44109 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/Function.cpp4
-rw-r--r--lib/VMCore/Verifier.cpp17
2 files changed, 17 insertions, 4 deletions
diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp
index 3582b32..3256d5b 100644
--- a/lib/VMCore/Function.cpp
+++ b/lib/VMCore/Function.cpp
@@ -108,6 +108,10 @@ ParamAttrsList::getParamAttrsText(uint16_t Attrs) {
Result += "byval ";
if (Attrs & ParamAttr::Nest)
Result += "nest ";
+ if (Attrs & ParamAttr::Pure)
+ Result += "pure ";
+ if (Attrs & ParamAttr::Const)
+ Result += "const ";
return Result;
}
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp
index dea9408..09a7adc 100644
--- a/lib/VMCore/Verifier.cpp
+++ b/lib/VMCore/Verifier.cpp
@@ -398,7 +398,8 @@ void Verifier::visitFunction(Function &F) {
ParamAttr::Nest | ParamAttr::StructRet;
const uint16_t ParameterIncompatible =
- ParamAttr::NoReturn | ParamAttr::NoUnwind;
+ ParamAttr::NoReturn | ParamAttr::NoUnwind |
+ ParamAttr::Const | ParamAttr::Pure;
const uint16_t MutuallyIncompatible =
ParamAttr::ByVal | ParamAttr::InReg |
@@ -407,6 +408,9 @@ void Verifier::visitFunction(Function &F) {
const uint16_t MutuallyIncompatible2 =
ParamAttr::ZExt | ParamAttr::SExt;
+ const uint16_t MutuallyIncompatible3 =
+ ParamAttr::Pure | ParamAttr::Const;
+
const uint16_t IntegerTypeOnly =
ParamAttr::SExt | ParamAttr::ZExt;
@@ -423,9 +427,14 @@ void Verifier::visitFunction(Function &F) {
uint16_t RetI = Attrs->getParamAttrs(0) & ReturnIncompatible;
Assert1(!RetI, "Attribute " + Attrs->getParamAttrsText(RetI) +
"should not apply to functions!", &F);
- uint16_t MutI = Attrs->getParamAttrs(0) & MutuallyIncompatible2;
- Assert1(MutI != MutuallyIncompatible2, "Attributes" +
- Attrs->getParamAttrsText(MutI) + "are incompatible!", &F);
+
+ uint16_t MutI2 = Attrs->getParamAttrs(0) & MutuallyIncompatible2;
+ Assert1(MutI2 != MutuallyIncompatible2, "Attributes" +
+ Attrs->getParamAttrsText(MutI2) + "are incompatible!", &F);
+
+ uint16_t MutI3 = Attrs->getParamAttrs(0) & MutuallyIncompatible3;
+ Assert1(MutI3 != MutuallyIncompatible3, "Attributes" +
+ Attrs->getParamAttrsText(MutI3) + "are incompatible!", &F);
for (FunctionType::param_iterator I = FT->param_begin(),
E = FT->param_end(); I != E; ++I, ++Idx) {