[PATCH] D45938: Improves x86 interrupt error message on argument type error

Nathan Ringo via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 23 00:54:18 PDT 2018


remexre created this revision.
remexre added reviewers: aaboud, craig.topper.

Currently if you define an interrupt handler with the right arity but wrong type, you get the unhelpful error "X86 interrupts may take one or two arguments." This changes the message for type errors to call them out as such.


Repository:
  rL LLVM

https://reviews.llvm.org/D45938

Files:
  lib/Target/X86/X86ISelLowering.cpp


Index: lib/Target/X86/X86ISelLowering.cpp
===================================================================
--- lib/Target/X86/X86ISelLowering.cpp
+++ lib/Target/X86/X86ISelLowering.cpp
@@ -2991,11 +2991,14 @@
       "Var args not supported with calling conv' regcall, fastcc, ghc or hipe");
 
   if (CallConv == CallingConv::X86_INTR) {
-    bool isLegal = Ins.size() == 1 ||
-                   (Ins.size() == 2 && ((Is64Bit && Ins[1].VT == MVT::i64) ||
-                                        (!Is64Bit && Ins[1].VT == MVT::i32)));
-    if (!isLegal)
+    bool isArgnLegal = Ins.size() == 1 || Ins.size() == 2;
+    if (!isArgnLegal)
       report_fatal_error("X86 interrupts may take one or two arguments");
+    bool isArg2Legal = (Is64Bit && Ins[1].VT == MVT::i64) ||
+                       (!Is64Bit && Ins[1].VT == MVT::i32);
+	if (!isArg2Legal)
+	  report_fatal_error("X86 interrupts' second argument must be a "
+			             "machine-sized word");
   }
 
   // Assign locations to all of the incoming arguments.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45938.143503.patch
Type: text/x-patch
Size: 1030 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180423/575649b7/attachment.bin>


More information about the llvm-commits mailing list