aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/NaCl/LowerEmExceptionsPass.cpp
diff options
context:
space:
mode:
authorDan Gohman <sunfish@google.com>2014-02-24 08:49:19 -0800
committerDan Gohman <sunfish@google.com>2014-02-25 11:58:56 -0800
commit338da97ed47659b9ef04f60067f84cafc93e3dd3 (patch)
tree2a80c78435712eafe02ea4afdc96c8d7713016cb /lib/Transforms/NaCl/LowerEmExceptionsPass.cpp
parent5653eb58d0b0068f0ef341c8928aa06d1d0ea3f7 (diff)
Support GEP and ConstantExprs directly in the JSBackend.
This patch also lays the groundwork for the single-use instruction trick to reduce the number of temporary variables.
Diffstat (limited to 'lib/Transforms/NaCl/LowerEmExceptionsPass.cpp')
-rw-r--r--lib/Transforms/NaCl/LowerEmExceptionsPass.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/Transforms/NaCl/LowerEmExceptionsPass.cpp b/lib/Transforms/NaCl/LowerEmExceptionsPass.cpp
index a562588c3a..2e3f0924cc 100644
--- a/lib/Transforms/NaCl/LowerEmExceptionsPass.cpp
+++ b/lib/Transforms/NaCl/LowerEmExceptionsPass.cpp
@@ -231,7 +231,21 @@ bool LowerEmExceptions::runOnModule(Module &M) {
unsigned Num = LP->getNumClauses();
SmallVector<Value*,16> NewLPArgs;
NewLPArgs.push_back(LP->getPersonalityFn());
- for (unsigned i = 0; i < Num; i++) NewLPArgs.push_back(LP->getClause(i));
+ for (unsigned i = 0; i < Num; i++) {
+ Value *Arg = LP->getClause(i);
+ // As a temporary workaround for the lack of aggregate varargs support
+ // in the varargs lowering code, break out filter operands into their
+ // component elements.
+ if (LP->isFilter(i)) {
+ ArrayType *ATy = cast<ArrayType>(Arg->getType());
+ for (unsigned elem = 0, elemEnd = ATy->getNumElements(); elem != elemEnd; ++elem) {
+ Instruction *EE = ExtractValueInst::Create(Arg, makeArrayRef(elem), "", LP);
+ NewLPArgs.push_back(EE);
+ }
+ } else {
+ NewLPArgs.push_back(Arg);
+ }
+ }
NewLPArgs.push_back(LP->isCleanup() ? ConstantInt::getTrue(i1) : ConstantInt::getFalse(i1));
CallInst *NewLP = CallInst::Create(LandingPad, NewLPArgs, "", LP);