diff options
author | Duncan Sands <baldrick@free.fr> | 2007-07-27 12:58:54 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2007-07-27 12:58:54 +0000 |
commit | 36397f50343639ce9a25996f2d790c656791ab92 (patch) | |
tree | a43e609dd0de1b138d3245ac390527372b3f591c /lib/VMCore | |
parent | ada779fb11eb411536aa8219a176ca0ce4d58fd1 (diff) | |
download | external_llvm-36397f50343639ce9a25996f2d790c656791ab92.zip external_llvm-36397f50343639ce9a25996f2d790c656791ab92.tar.gz external_llvm-36397f50343639ce9a25996f2d790c656791ab92.tar.bz2 |
Support for trampolines, except for X86 codegen which is
still under discussion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40549 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r-- | lib/VMCore/Function.cpp | 2 | ||||
-rw-r--r-- | lib/VMCore/Verifier.cpp | 17 |
2 files changed, 19 insertions, 0 deletions
diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp index dd78196..1374d55 100644 --- a/lib/VMCore/Function.cpp +++ b/lib/VMCore/Function.cpp @@ -105,6 +105,8 @@ ParamAttrsList::getParamAttrsText(uint16_t Attrs) { Result += "sret "; if (Attrs & ParamAttr::ByVal) Result += "byval "; + if (Attrs & ParamAttr::Nest) + Result += "nest "; return Result; } diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index ffca88b..de4050d 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -361,6 +361,7 @@ void Verifier::visitFunction(Function &F) { if (const ParamAttrsList *Attrs = FT->getParamAttrs()) { unsigned Idx = 1; + bool SawNest = false; Assert1(!Attrs->paramHasAttr(0, ParamAttr::ByVal), "Attribute ByVal should not apply to functions!", &F); @@ -368,6 +369,8 @@ void Verifier::visitFunction(Function &F) { "Attribute SRet should not apply to functions!", &F); Assert1(!Attrs->paramHasAttr(0, ParamAttr::InReg), "Attribute InReg should not apply to functions!", &F); + Assert1(!Attrs->paramHasAttr(0, ParamAttr::Nest), + "Attribute Nest should not apply to functions!", &F); for (FunctionType::param_iterator I = FT->param_begin(), E = FT->param_end(); I != E; ++I, ++Idx) { @@ -391,6 +394,20 @@ void Verifier::visitFunction(Function &F) { "Attribute ByVal should only apply to pointer to structs!", &F); } + if (Attrs->paramHasAttr(Idx, ParamAttr::Nest)) { + Assert1(!SawNest, "More than one parameter has attribute Nest!", &F); + SawNest = true; + + Assert1(isa<PointerType>(FT->getParamType(Idx-1)), + "Attribute Nest should only apply to Pointer type!", &F); + Assert1(!Attrs->paramHasAttr(Idx, ParamAttr::ByVal), + "Attributes Nest and ByVal are incompatible!", &F); + Assert1(!Attrs->paramHasAttr(Idx, ParamAttr::InReg), + "Attributes Nest and InReg are incompatible!", &F); + Assert1(!Attrs->paramHasAttr(Idx, ParamAttr::StructRet), + "Attributes Nest and StructRet are incompatible!", &F); + } + Assert1(!Attrs->paramHasAttr(Idx, ParamAttr::NoReturn), "Attribute NoReturn should only be applied to function", &F); Assert1(!Attrs->paramHasAttr(Idx, ParamAttr::NoUnwind), |