Emit an error for illegal inline asm constraint (which uses illegal type) rather...
authorEvan Cheng <evan.cheng@apple.com>
Wed, 10 Feb 2010 01:21:02 +0000 (01:21 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Wed, 10 Feb 2010 01:21:02 +0000 (01:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95746 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CalcSpillWeights.cpp
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

index 953ef639642230dc911ab88600ae04013eb4f47e..ab2e3f6f30e63f8bee82ee6ef4bce0f0e6ae6010 100644 (file)
@@ -20,6 +20,7 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Target/TargetInstrInfo.h"
+#include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/TargetRegisterInfo.h"
 #include "llvm/Target/TargetMachine.h"
 using namespace llvm;
index 8b380c68c273f6fde1b70e952d5ddfaf754dc683..24ac34c4e7fc00f5a8eadc33962ed2ada1dc29e2 100644 (file)
@@ -131,6 +131,17 @@ namespace {
       }
     }
 
+    /// areValueTypesLegal - Return true if types of all the values are legal.
+    bool areValueTypesLegal() {
+      for (unsigned Value = 0, e = ValueVTs.size(); Value != e; ++Value) {
+        EVT RegisterVT = RegVTs[Value];
+        if (!TLI->isTypeLegal(RegisterVT))
+          return false;
+      }
+      return true;
+    }
+
+
     /// append - Add the specified values to this one.
     void append(const RegsForValue &RHS) {
       TLI = RHS.TLI;
@@ -5515,7 +5526,8 @@ void SelectionDAGBuilder::visitInlineAsm(CallSite CS) {
              "Don't know how to handle indirect register inputs yet!");
 
       // Copy the input into the appropriate registers.
-      if (OpInfo.AssignedRegs.Regs.empty()) {
+      if (OpInfo.AssignedRegs.Regs.empty() ||
+          !OpInfo.AssignedRegs.areValueTypesLegal()) {
         llvm_report_error("Couldn't allocate input reg for"
                           " constraint '"+ OpInfo.ConstraintCode +"'!");
       }