[llvm] r205421 - Mark FPB as a reserved register when needed.

Job Noorman jobnoorman at gmail.com
Wed Apr 2 06:13:56 PDT 2014


Author: job
Date: Wed Apr  2 08:13:56 2014
New Revision: 205421

URL: http://llvm.org/viewvc/llvm-project?rev=205421&view=rev
Log:
Mark FPB as a reserved register when needed.

Modified:
    llvm/trunk/lib/Target/MSP430/MSP430RegisterInfo.cpp
    llvm/trunk/test/CodeGen/MSP430/fp.ll

Modified: llvm/trunk/lib/Target/MSP430/MSP430RegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430RegisterInfo.cpp?rev=205421&r1=205420&r2=205421&view=diff
==============================================================================
--- llvm/trunk/lib/Target/MSP430/MSP430RegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/MSP430/MSP430RegisterInfo.cpp Wed Apr  2 08:13:56 2014
@@ -88,8 +88,10 @@ BitVector MSP430RegisterInfo::getReserve
   Reserved.set(MSP430::CGW);
 
   // Mark frame pointer as reserved if needed.
-  if (TFI->hasFP(MF))
+  if (TFI->hasFP(MF)) {
+    Reserved.set(MSP430::FPB);
     Reserved.set(MSP430::FPW);
+  }
 
   return Reserved;
 }

Modified: llvm/trunk/test/CodeGen/MSP430/fp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/MSP430/fp.ll?rev=205421&r1=205420&r2=205421&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/MSP430/fp.ll (original)
+++ llvm/trunk/test/CodeGen/MSP430/fp.ll Wed Apr  2 08:13:56 2014
@@ -15,3 +15,15 @@ entry:
 ; CHECK: pop.w r4
   ret void
 }
+
+; Due to FPB not being marked as reserved, the register allocator used to select
+; r4 as the register for the "r" constraint below. This test verifies that this
+; does not happen anymore. Note that the only reason an ISR is used here is that
+; the register allocator selects r4 first instead of fifth in a normal function.
+define msp430_intrcc void @fpb_alloced() #0 {
+; CHECK_LABEL: fpb_alloced:
+; CHECK-NOT: mov.b #0, r4
+; CHECK: nop
+  call void asm sideeffect "nop", "r"(i8 0)
+  ret void
+}





More information about the llvm-commits mailing list