From 9bef807b3bfa2397fb24f4f9c4df5a633a9717b3 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 5 Mar 2014 17:48:22 -0800 Subject: Clean up the handling of inline asm. Make inline asm a report_fatal_error instead of an assertion failure so that it's a little friendlier, and add a test to make sure llc -march=js rejects inline asm. Also disable the PNaCl inline asm("":::"memory") lowering pass. If people are using this, it's best that we diagnose it as it likely isn't portable. There are usually better alternatives. --- lib/Target/JSBackend/CallHandlers.h | 4 +++- lib/Transforms/NaCl/PNaClABISimplify.cpp | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/Target/JSBackend/CallHandlers.h b/lib/Target/JSBackend/CallHandlers.h index eefe491d16..bfdd86571c 100644 --- a/lib/Target/JSBackend/CallHandlers.h +++ b/lib/Target/JSBackend/CallHandlers.h @@ -1034,7 +1034,9 @@ void setupCallHandlers() { std::string handleCall(const Instruction *CI) { const Value *CV = getActuallyCalledValue(CI); - assert(!isa(CV) && "asm() not supported, use EM_ASM() (see emscripten.h)"); + if (isa(CV)) { + report_fatal_error("asm() not supported, use EM_ASM() (see emscripten.h)"); + } // Get the name to call this function by. If it's a direct call, meaning // which know which Function we're calling, avoid calling getValueAsStr, as diff --git a/lib/Transforms/NaCl/PNaClABISimplify.cpp b/lib/Transforms/NaCl/PNaClABISimplify.cpp index 4deee01a2b..27dd45e1ea 100644 --- a/lib/Transforms/NaCl/PNaClABISimplify.cpp +++ b/lib/Transforms/NaCl/PNaClABISimplify.cpp @@ -138,7 +138,9 @@ void llvm::PNaClABISimplifyAddPostOptPasses(PassManager &PM) { // Remove ``asm("":::"memory")``. This must occur after rewriting // atomics: a ``fence seq_cst`` surrounded by ``asm("":::"memory")`` // has special meaning and is translated differently. +#if 0 // XXX EMSCRIPTEN: asm("":::"memory") does't have special semantics. PM.add(createRemoveAsmMemoryPass()); +#endif #if 0 // XXX EMSCRIPTEN: PNaCl replaces pointers with ints to simplify their ABI; empscripten doesn't need this. // ReplacePtrsWithInts assumes that getelementptr instructions and // ConstantExprs have already been expanded out. -- cgit v1.2.3-18-g5258