Implement the inline asm 'A' constraint. This implements PR825 and
authorChris Lattner <sabre@nondot.org>
Tue, 11 Jul 2006 02:54:03 +0000 (02:54 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 11 Jul 2006 02:54:03 +0000 (02:54 +0000)
CodeGen/X86/2006-07-10-InlineAsmAConstraint.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29101 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86ISelLowering.cpp
lib/Target/X86/X86ISelLowering.h

index 7d21e5397be9ca3ea4b71e4c241344270208e56a..d96be87efdea5a70d93a1709512a60bb8cf30c51 100644 (file)
@@ -4135,6 +4135,16 @@ SDOperand X86TargetLowering::PerformDAGCombine(SDNode *N,
 //                           X86 Inline Assembly Support
 //===----------------------------------------------------------------------===//
 
+/// getConstraintType - Given a constraint letter, return the type of
+/// constraint it is for this target.
+X86TargetLowering::ConstraintType
+X86TargetLowering::getConstraintType(char ConstraintLetter) const {
+  switch (ConstraintLetter) {
+  case 'A': return C_RegisterClass;
+  default: return TargetLowering::getConstraintType(ConstraintLetter);
+  }
+}
+
 std::vector<unsigned> X86TargetLowering::
 getRegClassForInlineAsmConstraint(const std::string &Constraint,
                                   MVT::ValueType VT) const {
@@ -4142,7 +4152,11 @@ getRegClassForInlineAsmConstraint(const std::string &Constraint,
     // FIXME: not handling fp-stack yet!
     // FIXME: not handling MMX registers yet ('y' constraint).
     switch (Constraint[0]) {      // GCC X86 Constraint Letters
-    default: break;  // Unknown constriant letter
+    default: break;  // Unknown constraint letter
+    case 'A':   // EAX/EDX
+      if (VT == MVT::i32 || VT == MVT::i64)
+        return make_vector<unsigned>(X86::EAX, X86::EDX, 0);
+      break;
     case 'r':   // GENERAL_REGS
     case 'R':   // LEGACY_REGS
       if (VT == MVT::i32)
index 0dea459c6f546f307073e8ed1c0ec7dc0b888144..2002910dfc41ed93013af1c36a1fe1442b92e3d4 100644 (file)
@@ -310,6 +310,8 @@ namespace llvm {
     
     SDOperand getReturnAddressFrameIndex(SelectionDAG &DAG);
 
+    ConstraintType getConstraintType(char ConstraintLetter) const;
+     
     std::vector<unsigned> 
       getRegClassForInlineAsmConstraint(const std::string &Constraint,
                                         MVT::ValueType VT) const;