aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobert Muth <robertm@chromium.org>2012-09-19 10:58:48 -0400
committerRobert Muth <robertm@chromium.org>2012-09-19 10:58:48 -0400
commit09ec8c048e4d64e2ac69531f736838f69bdc7fda (patch)
tree0b437b769281386feaae5cbea32106a1bbfd99e9 /lib
parentc1b167f380e6dacbd19f237c669b25160850ccaf (diff)
Exclude vector and array calls from being rewritten
Vectors and Arrays occur in callingconv_case_by_case/ Ensure that we do not interfere with those tests BUG= http://code.google.com/p/nativeclient/issues/detail?id=2986
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Scalar/NaClCcRewrite.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/NaClCcRewrite.cpp b/lib/Transforms/Scalar/NaClCcRewrite.cpp
index 0a3d073ff7..62bf4325dd 100644
--- a/lib/Transforms/Scalar/NaClCcRewrite.cpp
+++ b/lib/Transforms/Scalar/NaClCcRewrite.cpp
@@ -402,6 +402,15 @@ bool FunctionNeedsRewrite(const Function* fun,
// if we skip the rewrite for the function body
// we also need to skip it at the callsites
// if (F.isVarArg()) return false;
+
+ // Vectors and Arrays are not supported for compatibility
+ for (Function::const_arg_iterator AI = fun->arg_begin(), AE = fun->arg_end();
+ AI != AE;
+ ++AI) {
+ const Type* t = AI->getType();
+ if (isa<VectorType>(t) || isa<ArrayType>(t)) return false;
+ }
+
for (Function::const_arg_iterator AI = fun->arg_begin(), AE = fun->arg_end();
AI != AE;
++AI) {
@@ -686,6 +695,13 @@ template<class T> bool CallNeedsRewrite(
const T* call = cast<T>(inst);
// skip non parameter operands at the end
size_t num_params = call->getNumOperands() - (isa<CallInst>(inst) ? 1 : 3);
+
+ // Vectors and Arrays are not supported for compatibility
+ for (size_t i = 0; i < num_params; ++i) {
+ Type* t = call->getOperand(i)->getType();
+ if (isa<VectorType>(t) || isa<ArrayType>(t)) return false;
+ }
+
for (size_t i = 0; i < num_params; ++i) {
Type* t = call->getOperand(i)->getType();
// byval and srets are modelled as pointers (to structs)