[llvm] r260759 - [WebAssembly] Report more meaningful error messages for some unsupported

Derek Schuff via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 12 14:56:03 PST 2016


Author: dschuff
Date: Fri Feb 12 16:56:03 2016
New Revision: 260759

URL: http://llvm.org/viewvc/llvm-project?rev=260759&view=rev
Log:
[WebAssembly] Report more meaningful error messages for some unsupported
ops.

Computed gotos and RETURNADDR may never be supported; we can do
FRAMEADDR in the future.

Modified:
    llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
    llvm/trunk/lib/Target/WebAssembly/known_gcc_test_failures.txt

Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp?rev=260759&r1=260758&r2=260759&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp Fri Feb 12 16:56:03 2016
@@ -61,6 +61,8 @@ WebAssemblyTargetLowering::WebAssemblyTa
   setOperationAction(ISD::GlobalAddress, MVTPtr, Custom);
   setOperationAction(ISD::ExternalSymbol, MVTPtr, Custom);
   setOperationAction(ISD::JumpTable, MVTPtr, Custom);
+  setOperationAction(ISD::BlockAddress, MVTPtr, Custom);
+  setOperationAction(ISD::BRIND, MVT::Other, Custom);
 
   // Take the default expansion for va_arg, va_copy, and va_end. There is no
   // default action for va_start, so we do that custom.
@@ -515,6 +517,7 @@ SDValue WebAssemblyTargetLowering::Lower
 
 SDValue WebAssemblyTargetLowering::LowerOperation(SDValue Op,
                                                   SelectionDAG &DAG) const {
+  SDLoc DL(Op);
   switch (Op.getOpcode()) {
     default:
       llvm_unreachable("unimplemented operation lowering");
@@ -531,6 +534,16 @@ SDValue WebAssemblyTargetLowering::Lower
       return LowerBR_JT(Op, DAG);
     case ISD::VASTART:
       return LowerVASTART(Op, DAG);
+    case ISD::BlockAddress:
+    case ISD::BRIND:
+      fail(DL, DAG, "WebAssembly hasn't implemented computed gotos");
+      return SDValue();
+    case ISD::RETURNADDR: // Probably nothing meaningful can be returned here.
+      fail(DL, DAG, "WebAssembly hasn't implemented __builtin_return_address");
+      return SDValue();
+    case ISD::FRAMEADDR: // TODO: Make this return the userspace frame address
+      fail(DL, DAG, "WebAssembly hasn't implemented __builtin_frame_address");
+      return SDValue();
   }
 }
 

Modified: llvm/trunk/lib/Target/WebAssembly/known_gcc_test_failures.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/known_gcc_test_failures.txt?rev=260759&r1=260758&r2=260759&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/known_gcc_test_failures.txt (original)
+++ llvm/trunk/lib/Target/WebAssembly/known_gcc_test_failures.txt Fri Feb 12 16:56:03 2016
@@ -54,22 +54,22 @@ pr38151.c
 pr28982b.c
 
 
-# Cannot select brind.
+# Computed gotos are not supported (Cannot select BlockAddress/BRIND)
 20040302-1.c
 20071210-1.c
 920501-4.c
 920501-5.c
-
-# Cannot select BlockAddress.
 comp-goto-1.c
 980526-1.c
 990208-1.c
 
-# unimplemented operation lowering.
+# WebAssembly hasn't implemented (will never?) __builtin_return_address
 20010122-1.c
 20030323-1.c
 20030811-1.c
 pr17377.c
+
+# WebAssembly hasn't implemented __builtin_frame_address
 frame-address.c
 
 # Error: invalid output constraint '=t' in asm.




More information about the llvm-commits mailing list