[llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelLowering.cpp ARMISelLowering.h ARMInstrInfo.td

Evan Cheng evan.cheng at apple.com
Tue Jun 19 14:05:32 PDT 2007



Changes in directory llvm/lib/Target/ARM:

ARMISelLowering.cpp updated: 1.56 -> 1.57
ARMISelLowering.h updated: 1.16 -> 1.17
ARMInstrInfo.td updated: 1.112 -> 1.113
---
Log message:

Allow predicated immediate ARM to ARM calls.

---
Diffs of the changes:  (+14 -1)

 ARMISelLowering.cpp |    7 ++++++-
 ARMISelLowering.h   |    1 +
 ARMInstrInfo.td     |    7 +++++++
 3 files changed, 14 insertions(+), 1 deletion(-)


Index: llvm/lib/Target/ARM/ARMISelLowering.cpp
diff -u llvm/lib/Target/ARM/ARMISelLowering.cpp:1.56 llvm/lib/Target/ARM/ARMISelLowering.cpp:1.57
--- llvm/lib/Target/ARM/ARMISelLowering.cpp:1.56	Fri Jun  1 03:28:59 2007
+++ llvm/lib/Target/ARM/ARMISelLowering.cpp	Tue Jun 19 16:05:09 2007
@@ -267,6 +267,7 @@
   case ARMISD::Wrapper:       return "ARMISD::Wrapper";
   case ARMISD::WrapperJT:     return "ARMISD::WrapperJT";
   case ARMISD::CALL:          return "ARMISD::CALL";
+  case ARMISD::CALL_PRED:     return "ARMISD::CALL_PRED";
   case ARMISD::CALL_NOLINK:   return "ARMISD::CALL_NOLINK";
   case ARMISD::tCALL:         return "ARMISD::tCALL";
   case ARMISD::BRCOND:        return "ARMISD::BRCOND";
@@ -517,6 +518,7 @@
   // node so that legalize doesn't hack it.
   bool isDirect = false;
   bool isARMFunc = false;
+  bool isLocalARMFunc = false;
   if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee)) {
     GlobalValue *GV = G->getGlobal();
     isDirect = true;
@@ -525,6 +527,8 @@
     bool isStub = (isExt && Subtarget->isTargetDarwin()) &&
                    getTargetMachine().getRelocationModel() != Reloc::Static;
     isARMFunc = !Subtarget->isThumb() || isStub;
+    // ARM call to a local ARM function is predicable.
+    isLocalARMFunc = !Subtarget->isThumb() && !isExt;
     // tBX takes a register source operand.
     if (isARMFunc && Subtarget->isThumb() && !Subtarget->hasV5TOps()) {
       ARMConstantPoolValue *CPV = new ARMConstantPoolValue(GV, ARMPCLabelIndex,
@@ -564,7 +568,8 @@
       CallOpc = isARMFunc ? ARMISD::CALL : ARMISD::tCALL;
   } else {
     CallOpc = (isDirect || Subtarget->hasV5TOps())
-      ? ARMISD::CALL : ARMISD::CALL_NOLINK;
+      ? (isLocalARMFunc ? ARMISD::CALL_PRED : ARMISD::CALL)
+      : ARMISD::CALL_NOLINK;
   }
   if (CallOpc == ARMISD::CALL_NOLINK && !Subtarget->isThumb()) {
     // implicit def LR - LR mustn't be allocated as GRP:$dst of CALL_NOLINK


Index: llvm/lib/Target/ARM/ARMISelLowering.h
diff -u llvm/lib/Target/ARM/ARMISelLowering.h:1.16 llvm/lib/Target/ARM/ARMISelLowering.h:1.17
--- llvm/lib/Target/ARM/ARMISelLowering.h:1.16	Thu May 17 16:31:21 2007
+++ llvm/lib/Target/ARM/ARMISelLowering.h	Tue Jun 19 16:05:09 2007
@@ -34,6 +34,7 @@
       WrapperJT,    // WrapperJT - A wrapper node for TargetJumpTable
       
       CALL,         // Function call.
+      CALL_PRED,    // Function call that's predicable.
       CALL_NOLINK,  // Function call with branch not branch-and-link.
       tCALL,        // Thumb function call.
       BRCOND,       // Conditional branch.


Index: llvm/lib/Target/ARM/ARMInstrInfo.td
diff -u llvm/lib/Target/ARM/ARMInstrInfo.td:1.112 llvm/lib/Target/ARM/ARMInstrInfo.td:1.113
--- llvm/lib/Target/ARM/ARMInstrInfo.td:1.112	Mon Jun 18 20:48:04 2007
+++ llvm/lib/Target/ARM/ARMInstrInfo.td	Tue Jun 19 16:05:09 2007
@@ -52,6 +52,8 @@
 
 def ARMcall          : SDNode<"ARMISD::CALL", SDT_ARMcall,
                               [SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>;
+def ARMcall_pred    : SDNode<"ARMISD::CALL_PRED", SDT_ARMcall,
+                              [SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>;
 def ARMcall_nolink   : SDNode<"ARMISD::CALL_NOLINK", SDT_ARMcall,
                               [SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>;
 
@@ -621,6 +623,11 @@
   def BL  : AXI<(ops i32imm:$func, variable_ops),
                 "bl ${func:call}",
                 [(ARMcall tglobaladdr:$func)]>;
+
+  def BL_pred : AI<(ops i32imm:$func, variable_ops),
+                    "bl", " ${func:call}",
+                    [(ARMcall_pred tglobaladdr:$func)]>;
+
   // ARMv5T and above
   def BLX : AXI<(ops GPR:$dst, variable_ops),
                 "blx $dst",






More information about the llvm-commits mailing list