Enable the new no-SP register classes by default. This is to address
authorDan Gohman <gohman@apple.com>
Wed, 5 Aug 2009 17:40:24 +0000 (17:40 +0000)
committerDan Gohman <gohman@apple.com>
Wed, 5 Aug 2009 17:40:24 +0000 (17:40 +0000)
PR4572. A few tests have some minor code regressions due to different
coalescing.

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

lib/Target/X86/X86Instr64bit.td
lib/Target/X86/X86InstrInfo.td
lib/Target/X86/X86RegisterInfo.cpp
test/CodeGen/X86/coalesce-esp.ll
test/CodeGen/X86/ins_subreg_coalesce-3.ll
test/CodeGen/X86/stack-color-with-reg.ll

index 94bb1deca3329f8f5cd601fa085878a6f3d92e5d..a76a056c4ea19224e58a18349acc247216792211 100644 (file)
@@ -32,13 +32,13 @@ def i64i8imm   : Operand<i64>;
 
 def lea64mem : Operand<i64> {
   let PrintMethod = "printlea64mem";
-  let MIOperandInfo = (ops GR64, i8imm, GR64, i32imm);
+  let MIOperandInfo = (ops GR64, i8imm, GR64_NOSP, i32imm);
 }
 
 def lea64_32mem : Operand<i32> {
   let PrintMethod = "printlea64_32mem";
   let AsmOperandLowerMethod = "lower_lea64_32mem";
-  let MIOperandInfo = (ops GR32, i8imm, GR32, i32imm);
+  let MIOperandInfo = (ops GR32, i8imm, GR32_NOSP, i32imm);
 }
 
 //===----------------------------------------------------------------------===//
index bbf0cb537b3da1f7eae96478db6cc270780c8a91..65b1e9d2ec160362818407fe2356af23ce9c2f18 100644 (file)
@@ -196,7 +196,7 @@ def i8mem_NOREX : Operand<i64> {
 
 def lea32mem : Operand<i32> {
   let PrintMethod = "printlea32mem";
-  let MIOperandInfo = (ops GR32, i8imm, GR32, i32imm);
+  let MIOperandInfo = (ops GR32, i8imm, GR32_NOSP, i32imm);
 }
 
 def SSECC : Operand<i8> {
index 21f4dc5694c8e0d40e5f61c9e592c0e403acc63c..cae62905d370029de6fd6100ebee67447a4a40b3 100644 (file)
 #include "llvm/Support/ErrorHandling.h"
 using namespace llvm;
 
-static cl::opt<bool>
-StrictIndexRegclass("strict-index-regclass",
-                    cl::desc("Use a special register class to avoid letting SP "
-                             "be used as an index"));
-
 X86RegisterInfo::X86RegisterInfo(X86TargetMachine &tm,
                                  const TargetInstrInfo &tii)
   : X86GenRegisterInfo(tm.getSubtarget<X86Subtarget>().is64Bit() ?
@@ -274,15 +269,9 @@ getPointerRegClass(unsigned Kind) const {
       return &X86::GR64RegClass;
     return &X86::GR32RegClass;
   case 1: // Normal GRPs except the stack pointer (for encoding reasons).
-    if (!StrictIndexRegclass) {
-      if (TM.getSubtarget<X86Subtarget>().is64Bit())
-        return &X86::GR64RegClass;
-      return &X86::GR32RegClass;
-    } else {
-      if (TM.getSubtarget<X86Subtarget>().is64Bit())
-        return &X86::GR64_NOSPRegClass;
-      return &X86::GR32_NOSPRegClass;
-    }
+    if (TM.getSubtarget<X86Subtarget>().is64Bit())
+      return &X86::GR64_NOSPRegClass;
+    return &X86::GR32_NOSPRegClass;
   }
 }
 
index 8a1597870dd06d3a1097fa74837d64a058d3e053..ede9b59a7e56cb0c42121d2be200f57809d373a1 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | llc -strict-index-regclass | grep {movl  %esp, %eax}
+; RUN: llvm-as < %s | llc | grep {movl %esp, %eax}
 ; PR4572
 
 ; Don't coalesce with %esp if it would end up putting %esp in
index 6fd18d6541d88d9ee019ada5a627cc700579bb60..3213723db0e5165e7729690843d5ca874f40f06a 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | llc -march=x86-64 | grep mov | count 10
+; RUN: llvm-as < %s | llc -march=x86-64 | grep mov | count 11
 
        %struct.COMPOSITE = type { i8, i16, i16 }
        %struct.FILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, %struct.__sFILEX*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 }
index 832886be75600dfe63b400a2591219e04c1edd67..114e9bf48d73ed525a88bb510049be0c7e91e21a 100644 (file)
@@ -1,7 +1,7 @@
 ; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin10 -relocation-model=pic -disable-fp-elim -color-ss-with-regs -stats -info-output-file - > %t
 ; RUN:   grep stackcoloring %t | grep "loads eliminated" 
 ; RUN:   grep stackcoloring %t | grep "stack slot refs replaced with reg refs"  | grep 5
-; RUN:   grep asm-printer %t   | grep 180
+; RUN:   grep asm-printer %t   | grep 182
 
        type { [62 x %struct.Bitvec*] }         ; type %0
        type { i8* }            ; type %1