summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@apple.com>2011-08-15 23:22:56 +0000
committerBob Wilson <bob.wilson@apple.com>2011-08-15 23:22:56 +0000
commite17a14e2debc9f900f8507e32496a77d55253753 (patch)
tree9c64d5b8c1d6c7976788046dcb731bb7c016d96e /utils
parent5e38c473a41f4412d8a934449290b11066d144b9 (diff)
downloadllvm-e17a14e2debc9f900f8507e32496a77d55253753.tar.gz
llvm-e17a14e2debc9f900f8507e32496a77d55253753.tar.bz2
llvm-e17a14e2debc9f900f8507e32496a77d55253753.tar.xz
Avoid evaluating Neon macro arguments more than once by disabling type checks.
It turns out that the use of "__extension__" in these macros was disabling the expected "incompatible pointer" warnings, so these type checks were not doing anything anyway. They introduced a serious bug by evaluating some macro arguments twice, which is a big problem for arguments with side effects. I'll have to find another way to get the right type checking. Radar 9947657. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137680 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/NeonEmitter.cpp23
1 files changed, 8 insertions, 15 deletions
diff --git a/utils/TableGen/NeonEmitter.cpp b/utils/TableGen/NeonEmitter.cpp
index ef9774438f..1e96da7f64 100644
--- a/utils/TableGen/NeonEmitter.cpp
+++ b/utils/TableGen/NeonEmitter.cpp
@@ -485,6 +485,7 @@ static bool UseMacro(const std::string &proto) {
/// defined as a macro should be accessed directly instead of being first
/// assigned to a local temporary.
static bool MacroArgUsedDirectly(const std::string &proto, unsigned i) {
+ // True for constant ints (i), pointers (p) and const pointers (c).
return (proto[i] == 'i' || proto[i] == 'p' || proto[i] == 'c');
}
@@ -525,24 +526,16 @@ static std::string GenMacroLocals(const std::string &proto, StringRef typestr) {
for (unsigned i = 1, e = proto.size(); i != e; ++i, ++arg) {
// Do not create a temporary for an immediate argument.
// That would defeat the whole point of using a macro!
- if (proto[i] == 'i')
+ // FIXME: For other (non-immediate) arguments that are used directly, a
+ // local temporary (or some other method) is still needed to get the
+ // correct type checking, even if that temporary is not used for anything.
+ // This is omitted for now because it turns out the the use of
+ // "__extension__" in the macro disables any warnings from the pointer
+ // assignment.
+ if (MacroArgUsedDirectly(proto, i))
continue;
generatedLocal = true;
- // For other (non-immediate) arguments that are used directly, a local
- // temporary is still needed to get the correct type checking, even though
- // that temporary is not used for anything.
- if (MacroArgUsedDirectly(proto, i)) {
- s += TypeString(proto[i], typestr) + " __";
- s.push_back(arg);
- s += "_ = (__";
- s.push_back(arg);
- s += "); (void)__";
- s.push_back(arg);
- s += "_; ";
- continue;
- }
-
s += TypeString(proto[i], typestr) + " __";
s.push_back(arg);
s += " = (";