@@ -388,15 +388,29 @@ using WebAssembly::WasmEnableEmSjLj;
388
388
using WebAssembly::WasmEnableSjLj;
389
389
390
390
static void basicCheckForEHAndSjLj (TargetMachine *TM) {
391
- // Before checking, we make sure TargetOptions.ExceptionModel is the same as
391
+
392
+ // You can't enable two modes of EH at the same time
393
+ if (WasmEnableEmEH && WasmEnableEH)
394
+ report_fatal_error (
395
+ " -enable-emscripten-cxx-exceptions not allowed with -wasm-enable-eh" );
396
+ // You can't enable two modes of SjLj at the same time
397
+ if (WasmEnableEmSjLj && WasmEnableSjLj)
398
+ report_fatal_error (
399
+ " -enable-emscripten-sjlj not allowed with -wasm-enable-sjlj" );
400
+ // You can't mix Emscripten EH with Wasm SjLj.
401
+ if (WasmEnableEmEH && WasmEnableSjLj)
402
+ report_fatal_error (
403
+ " -enable-emscripten-cxx-exceptions not allowed with -wasm-enable-sjlj" );
404
+
405
+ // Here we make sure TargetOptions.ExceptionModel is the same as
392
406
// MCAsmInfo.ExceptionsType. Normally these have to be the same, because clang
393
407
// stores the exception model info in LangOptions, which is later transferred
394
408
// to TargetOptions and MCAsmInfo. But when clang compiles bitcode directly,
395
409
// clang's LangOptions is not used and thus the exception model info is not
396
410
// correctly transferred to TargetOptions and MCAsmInfo, so we make sure we
397
- // have the correct exception model in WebAssemblyMCAsmInfo constructor.
398
- // But in this case TargetOptions is still not updated, so we make sure they
399
- // are the same.
411
+ // have the correct exception model in WebAssemblyMCAsmInfo constructor. But
412
+ // in this case TargetOptions is still not updated, so we make sure they are
413
+ // the same.
400
414
TM->Options .ExceptionModel = TM->getMCAsmInfo ()->getExceptionHandlingType ();
401
415
402
416
// Basic Correctness checking related to -exception-model
@@ -418,18 +432,6 @@ static void basicCheckForEHAndSjLj(TargetMachine *TM) {
418
432
" -exception-model=wasm only allowed with at least one of "
419
433
" -wasm-enable-eh or -wasm-enable-sjlj" );
420
434
421
- // You can't enable two modes of EH at the same time
422
- if (WasmEnableEmEH && WasmEnableEH)
423
- report_fatal_error (
424
- " -enable-emscripten-cxx-exceptions not allowed with -wasm-enable-eh" );
425
- // You can't enable two modes of SjLj at the same time
426
- if (WasmEnableEmSjLj && WasmEnableSjLj)
427
- report_fatal_error (
428
- " -enable-emscripten-sjlj not allowed with -wasm-enable-sjlj" );
429
- // You can't mix Emscripten EH with Wasm SjLj.
430
- if (WasmEnableEmEH && WasmEnableSjLj)
431
- report_fatal_error (
432
- " -enable-emscripten-cxx-exceptions not allowed with -wasm-enable-sjlj" );
433
435
// Currently it is allowed to mix Wasm EH with Emscripten SjLj as an interim
434
436
// measure, but some code will error out at compile time in this combination.
435
437
// See WebAssemblyLowerEmscriptenEHSjLj pass for details.
0 commit comments