aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/NaCl/LowerEmExceptionsPass.cpp
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-01-19 20:29:58 -0800
committerAlon Zakai <alonzakai@gmail.com>2014-01-19 20:29:58 -0800
commit10af3696c0c6cd6e4050d6b4534dfc05c5e0d52f (patch)
tree2c996ba5128747ed52bef577056c8edb3769a021 /lib/Transforms/NaCl/LowerEmExceptionsPass.cpp
parent3c965ad08d26d1245d23ea918183f2c2e62e8e9b (diff)
add pre/post-invoke around calls we need to guard for longjmps
Diffstat (limited to 'lib/Transforms/NaCl/LowerEmExceptionsPass.cpp')
-rw-r--r--lib/Transforms/NaCl/LowerEmExceptionsPass.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Transforms/NaCl/LowerEmExceptionsPass.cpp b/lib/Transforms/NaCl/LowerEmExceptionsPass.cpp
index 2c0b294280..1cb246563b 100644
--- a/lib/Transforms/NaCl/LowerEmExceptionsPass.cpp
+++ b/lib/Transforms/NaCl/LowerEmExceptionsPass.cpp
@@ -99,10 +99,14 @@ bool LowerEmExceptions::runOnModule(Module &M) {
}
FunctionType *VoidFunc = FunctionType::get(Void, false);
- PreInvoke = Function::Create(VoidFunc, GlobalValue::ExternalLinkage, "emscripten_preinvoke", TheModule);
+ if (!TheModule->getFunction("emscripten_preinvoke")) {
+ PreInvoke = Function::Create(VoidFunc, GlobalValue::ExternalLinkage, "emscripten_preinvoke", TheModule);
+ }
FunctionType *Int1Func = FunctionType::get(i1, false);
- PostInvoke = Function::Create(Int1Func, GlobalValue::ExternalLinkage, "emscripten_postinvoke", TheModule);
+ if (!TheModule->getFunction("emscripten_postinvoke")) {
+ PostInvoke = Function::Create(Int1Func, GlobalValue::ExternalLinkage, "emscripten_postinvoke", TheModule);
+ }
FunctionType *LandingPadFunc = FunctionType::get(i8P, true);
LandingPad = Function::Create(LandingPadFunc, GlobalValue::ExternalLinkage, "emscripten_landingpad", TheModule);