[PATCH] D60232: [WebAssembly] EmscriptenEHSjLj: Don't abort if __THREW__ is defined
Sam Clegg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 3 14:04:46 PDT 2019
sbc100 created this revision.
Herald added subscribers: llvm-commits, sunfish, aheejin, hiraditya, jgravelle-google, dschuff.
Herald added a project: LLVM.
In emscripten we actually want to be able to compile the source
code that defined this symbol.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D60232
Files:
llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
Index: llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
===================================================================
--- llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
+++ llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
@@ -330,17 +330,6 @@
return true;
}
-// Get a global variable with the given name. If it doesn't exist declare it,
-// which will generate an import and asssumes that it will exist at link time.
-static GlobalVariable *getGlobalVariableI32(Module &M, IRBuilder<> &IRB,
- const char *Name) {
- if (M.getNamedGlobal(Name))
- report_fatal_error(Twine("variable name is reserved: ") + Name);
-
- return new GlobalVariable(M, IRB.getInt32Ty(), false,
- GlobalValue::ExternalLinkage, nullptr, Name);
-}
-
// Simple function name mangler.
// This function simply takes LLVM's string representation of parameter types
// and concatenate them with '_'. There are non-alphanumeric characters but llc
@@ -633,8 +622,8 @@
// Declare (or get) global variables __THREW__, __threwValue, and
// getTempRet0/setTempRet0 function which are used in common for both
// exception handling and setjmp/longjmp handling
- ThrewGV = getGlobalVariableI32(M, IRB, "__THREW__");
- ThrewValueGV = getGlobalVariableI32(M, IRB, "__threwValue");
+ ThrewGV = cast<GlobalVariable>(M.getOrInsertGlobal("__THREW__", IRB.getInt32Ty()));
+ ThrewValueGV = cast<GlobalVariable>(M.getOrInsertGlobal("__threwValue", IRB.getInt32Ty()));
GetTempRet0Func =
Function::Create(FunctionType::get(IRB.getInt32Ty(), false),
GlobalValue::ExternalLinkage, "getTempRet0", &M);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60232.193592.patch
Type: text/x-patch
Size: 1733 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190403/57a6eff1/attachment.bin>
More information about the llvm-commits
mailing list