diff options
author | Mark Seaborn <mseaborn@chromium.org> | 2013-06-06 10:33:01 -0700 |
---|---|---|
committer | Mark Seaborn <mseaborn@chromium.org> | 2013-06-06 10:33:01 -0700 |
commit | bcbad3ce541bc70ab3383d3d77198ceb9e813b46 (patch) | |
tree | 0e259872032346feb3f4e5f2402588602a179d3d /lib/Transforms/NaCl/StripAttributes.cpp | |
parent | 37bdd9174a1cba17b369c8c1f561e70c458e0c13 (diff) |
PNaCl ABI: Strip out calling conventions from functions and calls
Always use the standard C calling conventions. Disallow "fastcc" etc.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=2346
TEST=*.ll tests + PNaCl toolchain trybots
Review URL: https://codereview.chromium.org/16529004
Diffstat (limited to 'lib/Transforms/NaCl/StripAttributes.cpp')
-rw-r--r-- | lib/Transforms/NaCl/StripAttributes.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/Transforms/NaCl/StripAttributes.cpp b/lib/Transforms/NaCl/StripAttributes.cpp index f5ec0423b4..476c500756 100644 --- a/lib/Transforms/NaCl/StripAttributes.cpp +++ b/lib/Transforms/NaCl/StripAttributes.cpp @@ -8,12 +8,14 @@ //===----------------------------------------------------------------------===// // // This pass strips out attributes that are not supported by PNaCl's -// stable ABI. Currently, this strips out attributes from functions -// and function calls. +// stable ABI. Currently, this strips out: +// +// * Function and argument attributes from functions and function +// calls. +// * Calling conventions from functions and function calls. // // TODO(mseaborn): Strip out the following too: // -// * Calling conventions from functions and function calls. // * "nuw" and "nsw" arithmetic attributes. // * "align" attributes from integer memory accesses. // @@ -131,6 +133,7 @@ static void CheckAttributes(AttributeSet Attrs) { bool StripAttributes::runOnFunction(Function &Func) { CheckAttributes(Func.getAttributes()); Func.setAttributes(AttributeSet()); + Func.setCallingConv(CallingConv::C); for (Function::iterator BB = Func.begin(), E = Func.end(); BB != E; ++BB) { @@ -140,6 +143,7 @@ bool StripAttributes::runOnFunction(Function &Func) { if (Call) { CheckAttributes(Call.getAttributes()); Call.setAttributes(AttributeSet()); + Call.setCallingConv(CallingConv::C); } } } |