aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Voung <jvoung@chromium.org>2013-06-28 14:54:54 -0700
committerJan Voung <jvoung@chromium.org>2013-06-28 14:54:54 -0700
commitf2518db25a8d0cacebb82d2f8872b00014a03bc8 (patch)
tree776d74f210d2db1b8535d168d804390c0befd6db
parent331ef6ecbef4e3f3afa8ae627ad5b3528a534e04 (diff)
Move stacksave/restore to allowed list, pow to disallowed.
The stacksave/restore intrinsics are covered by "run_vla_test", tests in GCC torture testsuite, and basic llvm lit tests (mostly related to debug info...). The pow intrinsic is no longer needed after Eli's change to Clang, and pow is done purely in libm (even with -fno-math-errno). BUG=http://code.google.com/p/nativeclient/issues/detail?id=3378 R=eliben@chromium.org, jfb@chromium.org, mseaborn@chromium.org Review URL: https://codereview.chromium.org/18180002
-rw-r--r--docs/PNaClLangRef.rst11
-rw-r--r--lib/Analysis/NaCl/PNaClABIVerifyModule.cpp23
2 files changed, 19 insertions, 15 deletions
diff --git a/docs/PNaClLangRef.rst b/docs/PNaClLangRef.rst
index b1d39a7187..dc144f59a2 100644
--- a/docs/PNaClLangRef.rst
+++ b/docs/PNaClLangRef.rst
@@ -323,16 +323,19 @@ TODO(jfb): atomics
* ``llvm.memset``
* ``llvm.bswap``
- The llvm.bswap intrinsic is only supported with the following argument types:
- i16, i32, i64.
+ The overloaded llvm.bswap intrinsic is only supported with the following
+ argument types: i16, i32, i64 (the types supported by C-style GCC builtins).
* ``llvm.ctlz``
* ``llvm.cttz``
* ``llvm.ctpop``
- The llvm.ctlz, llvm.cttz, and llvm.ctpop intrinsics only support
- i32 and i64 argument types (the types supported by C-style GCC builtins).
+ The overloaded llvm.ctlz, llvm.cttz, and llvm.ctpop intrinsics are only
+ supported with the i32 and i64 argument types (the types supported by
+ C-style GCC builtins).
+* ``llvm.stacksave``
+* ``llvm.stackrestore``
* ``llvm.trap``
* ``llvm.nacl.read.tp``
diff --git a/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp b/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp
index 7836484c2f..7922d84a51 100644
--- a/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp
+++ b/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp
@@ -204,6 +204,9 @@ bool PNaClABIVerifyModule::isWhitelistedIntrinsic(const Function *F,
case Intrinsic::nacl_read_tp:
case Intrinsic::nacl_setjmp:
case Intrinsic::nacl_longjmp:
+ // Stack save and restore are used to support C99 VLAs.
+ case Intrinsic::stackrestore:
+ case Intrinsic::stacksave:
case Intrinsic::trap:
return true;
@@ -253,13 +256,14 @@ bool PNaClABIVerifyModule::isWhitelistedIntrinsic(const Function *F,
case Intrinsic::invariant_end:
case Intrinsic::invariant_start:
// Some transcendental functions not needed yet.
- case Intrinsic::cos: // Rounding not defined: support with fast-math?
- case Intrinsic::exp: // Rounding not defined: support with fast-math?
- case Intrinsic::exp2: // Rounding not defined: support with fast-math?
- case Intrinsic::log: // Rounding not defined: support with fast-math?
- case Intrinsic::log2: // Rounding not defined: support with fast-math?
- case Intrinsic::log10: // Rounding not defined: support with fast-math?
- case Intrinsic::sin: // Rounding not defined: support with fast-math?
+ case Intrinsic::cos:
+ case Intrinsic::exp:
+ case Intrinsic::exp2:
+ case Intrinsic::log:
+ case Intrinsic::log2:
+ case Intrinsic::log10:
+ case Intrinsic::pow:
+ case Intrinsic::sin:
// We run -lower-expect to convert Intrinsic::expect into branch weights
// and consume in the middle-end. The backend just ignores llvm.expect.
case Intrinsic::expect:
@@ -274,12 +278,9 @@ bool PNaClABIVerifyModule::isWhitelistedIntrinsic(const Function *F,
case Intrinsic::dbg_value:
return PNaClABIAllowDevIntrinsics || PNaClABIAllowDebugMetadata;
case Intrinsic::nacl_target_arch: // Used by translator self-build.
- case Intrinsic::pow: // Rounding is supposed to be the same as libm.
case Intrinsic::powi: // Rounding not defined: support with fast-math?
- case Intrinsic::prefetch: // Could ignore if target doesn't support?
+ case Intrinsic::prefetch: // TODO(jfb): Use our own data-prefetch intrinsic instead.
case Intrinsic::sqrt: // Rounding is defined, but setting errno up to libm.
- case Intrinsic::stackrestore: // Used to support C99 VLAs.
- case Intrinsic::stacksave: // Used to support C99 VLAs.
return PNaClABIAllowDevIntrinsics;
}
}