Add TargetInstrInfo::isSafeToMoveRegisterClassDefs. It returns true if it's safe...
authorEvan Cheng <evan.cheng@apple.com>
Fri, 6 Feb 2009 17:17:30 +0000 (17:17 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Fri, 6 Feb 2009 17:17:30 +0000 (17:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63936 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Target/TargetInstrInfo.h
lib/CodeGen/PreAllocSplitting.cpp
lib/Target/X86/X86InstrInfo.cpp
lib/Target/X86/X86InstrInfo.h

index bec37a62bf17fe599e0a4e92ea5b76c0717a7211..e54ca204670a42a7fe02a6e17fcae09061af6096 100644 (file)
@@ -427,10 +427,9 @@ public:
     return false;
   }
 
-  /// IgnoreRegisterClassBarriers - Returns true if pre-register allocation
-  /// live interval splitting pass should ignore barriers of the specified
-  /// register class.
-  virtual bool IgnoreRegisterClassBarriers(const TargetRegisterClass *RC) const{
+  /// isSafeToMoveRegClassDefs - Return true if it's safe to move a machine
+  /// instruction that defines the specified register class.
+  virtual bool isSafeToMoveRegClassDefs(const TargetRegisterClass *RC) const {
     return true;
   }
 
index dfff87a3d7ba3970c98fb295ed96c2adf55b93f3..ef2cfdb9828d17803556bf8ba65168534d80036c 100644 (file)
@@ -1128,7 +1128,10 @@ PreAllocSplitting::SplitRegLiveIntervals(const TargetRegisterClass **RCs,
   // by the current barrier.
   SmallVector<LiveInterval*, 8> Intervals;
   for (const TargetRegisterClass **RC = RCs; *RC; ++RC) {
-    if (TII->IgnoreRegisterClassBarriers(*RC))
+    // FIXME: If it's not safe to move any instruction that defines the barrier
+    // register class, then it means there are some special dependencies which
+    // codegen is not modelling. Ignore these barriers for now.
+    if (!TII->isSafeToMoveRegClassDefs(*RC))
       continue;
     std::vector<unsigned> &VRs = MRI->getRegClassVirtRegs(*RC);
     for (unsigned i = 0, e = VRs.size(); i != e; ++i) {
index 8e3985f099899d5b8225493a47361e94e586ee43..577884969b3f96a65b6e5855f01ab5d76b1ae20f 100644 (file)
@@ -2483,11 +2483,11 @@ ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const {
 }
 
 bool X86InstrInfo::
-IgnoreRegisterClassBarriers(const TargetRegisterClass *RC) const {
-  // FIXME: Ignore bariers of x87 stack registers for now. We can't
+isSafeToMoveRegClassDefs(const TargetRegisterClass *RC) const {
+  // FIXME: Return false for x87 stack register classes for now. We can't
   // allow any loads of these registers before FpGet_ST0_80.
-  return RC == &X86::CCRRegClass || RC == &X86::RFP32RegClass ||
-    RC == &X86::RFP64RegClass || RC == &X86::RFP80RegClass;
+  return !(RC == &X86::CCRRegClass || RC == &X86::RFP32RegClass ||
+           RC == &X86::RFP64RegClass || RC == &X86::RFP80RegClass);
 }
 
 const TargetRegisterClass *X86InstrInfo::getPointerRegClass() const {
index 077de56a5d5979652ebf5ad50c63bef7661abe0d..eba0baf3caeb38ab3e0205a5523e5833a14235d0 100644 (file)
@@ -406,10 +406,9 @@ public:
   virtual
   bool ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const;
 
-  /// IgnoreRegisterClassBarriers - Returns true if pre-register allocation
-  /// live interval splitting pass should ignore barriers of the specified
-  /// register class.
-  bool IgnoreRegisterClassBarriers(const TargetRegisterClass *RC) const;
+  /// isSafeToMoveRegClassDefs - Return true if it's safe to move a machine
+  /// instruction that defines the specified register class.
+  bool isSafeToMoveRegClassDefs(const TargetRegisterClass *RC) const;
 
   const TargetRegisterClass *getPointerRegClass() const;