Differentiate between the MachO and the ELF ABI the CALL instruction.
authorNicolas Geoffray <nicolas.geoffray@lip6.fr>
Tue, 27 Feb 2007 13:01:19 +0000 (13:01 +0000)
committerNicolas Geoffray <nicolas.geoffray@lip6.fr>
Tue, 27 Feb 2007 13:01:19 +0000 (13:01 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34667 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PowerPC/PPCISelLowering.cpp
lib/Target/PowerPC/PPCISelLowering.h
lib/Target/PowerPC/PPCInstr64Bit.td
lib/Target/PowerPC/PPCInstrInfo.td

index 13cdadcea8104e2984dcd4f9caf651c826778983..c29364c82f6dafa00c43e72b4957042ee1a6060f 100644 (file)
@@ -326,7 +326,8 @@ const char *PPCTargetLowering::getTargetNodeName(unsigned Opcode) const {
   case PPCISD::SHL:           return "PPCISD::SHL";
   case PPCISD::EXTSW_32:      return "PPCISD::EXTSW_32";
   case PPCISD::STD_32:        return "PPCISD::STD_32";
-  case PPCISD::CALL:          return "PPCISD::CALL";
+  case PPCISD::CALL_ELF:      return "PPCISD::CALL_ELF";
+  case PPCISD::CALL_Macho:    return "PPCISD::CALL_Macho";
   case PPCISD::MTCTR:         return "PPCISD::MTCTR";
   case PPCISD::BCTRL_Macho:   return "PPCISD::BCTRL_Macho";
   case PPCISD::BCTRL_ELF:     return "PPCISD::BCTRL_ELF";
@@ -1510,7 +1511,7 @@ static SDOperand LowerCALL(SDOperand Op, SelectionDAG &DAG,
   NodeTys.push_back(MVT::Flag);    // Returns a flag for retval copy to use.
 
   SmallVector<SDOperand, 8> Ops;
-  unsigned CallOpc = PPCISD::CALL;
+  unsigned CallOpc = isMachoABI? PPCISD::CALL_Macho : PPCISD::CALL_ELF;
   
   // If the callee is a GlobalAddress/ExternalSymbol node (quite common, every
   // direct call is) turn it into a TargetGlobalAddress/TargetExternalSymbol
index 00e65f62fdb3924c43c8c49dd53946476900b0d9..676e0bc6fc8d22593c0e2a13c0c9da12114dbf87 100644 (file)
@@ -82,7 +82,7 @@ namespace llvm {
       STD_32,
       
       /// CALL - A direct function call.
-      CALL,
+      CALL_Macho, CALL_ELF,
       
       /// CHAIN,FLAG = MTCTR(VAL, CHAIN[, INFLAG]) - Directly corresponds to a
       /// MTCTR instruction.
index 57bb9dac408a03fbe206152167abbcc73bcf9041..50c47fdadfb560294e2305e7de5ab624641f1325 100644 (file)
@@ -102,7 +102,7 @@ let isCall = 1, noResults = 1, PPC970_Unit = 7,
                             
   def BLA8_ELF : IForm<18, 1, 1,
                        (ops aaddr:$func, variable_ops),
-                       "bla $func", BrB, [/*(PPCcall_ELF (i64 imm:$func))*/]>;
+                       "bla $func", BrB, [(PPCcall_ELF (i64 imm:$func))]>;
 }
 
 
@@ -111,12 +111,11 @@ def : Pat<(PPCcall_Macho (i64 tglobaladdr:$dst)),
           (BL8_Macho tglobaladdr:$dst)>;
 def : Pat<(PPCcall_Macho (i64 texternalsym:$dst)),
           (BL8_Macho texternalsym:$dst)>;
-/*
+
 def : Pat<(PPCcall_ELF (i64 tglobaladdr:$dst)),
           (BL8_ELF tglobaladdr:$dst)>;
 def : Pat<(PPCcall_ELF (i64 texternalsym:$dst)),
           (BL8_ELF texternalsym:$dst)>;
-*/
 
 //===----------------------------------------------------------------------===//
 // 64-bit SPR manipulation instrs.
index fee3e724e59b41999c7fab7a3ca9dec6f17b9c3a..cfdb3780acce160cda01061bc0b9472fea880d92 100644 (file)
@@ -81,9 +81,9 @@ def callseq_end   : SDNode<"ISD::CALLSEQ_END",   SDT_PPCCallSeq,
                            [SDNPHasChain, SDNPOutFlag]>;
 
 def SDT_PPCCall   : SDTypeProfile<0, -1, [SDTCisInt<0>]>;
-def PPCcall_Macho : SDNode<"PPCISD::CALL", SDT_PPCCall,
+def PPCcall_Macho : SDNode<"PPCISD::CALL_Macho", SDT_PPCCall,
                            [SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>;
-def PPCcall_ELF   : SDNode<"PPCISD::CALL", SDT_PPCCall,
+def PPCcall_ELF   : SDNode<"PPCISD::CALL_ELF", SDT_PPCCall,
                            [SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>;
 def PPCmtctr      : SDNode<"PPCISD::MTCTR", SDT_PPCCall,
                            [SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>;
@@ -407,11 +407,11 @@ let isCall = 1, noResults = 1, PPC970_Unit = 7,
   def BLA_ELF : IForm<18, 1, 1,
                       (ops aaddr:$func, variable_ops),
                       "bla $func", BrB,
-                      [/*(PPCcall_ELF (i32 imm:$func))*/]>;
+                      [(PPCcall_ELF (i32 imm:$func))]>;
   def BCTRL_ELF : XLForm_2_ext<19, 528, 20, 0, 1,
                                (ops variable_ops),
                                "bctrl", BrB,
-                               [/*(PPCbctrl_ELF)*/]>;
+                               [(PPCbctrl_ELF)]>;
 }
 
 // DCB* instructions.
@@ -1101,10 +1101,10 @@ def : Pat<(PPCcall_Macho (i32 tglobaladdr:$dst)),
           (BL_Macho tglobaladdr:$dst)>;
 def : Pat<(PPCcall_Macho (i32 texternalsym:$dst)),
           (BL_Macho texternalsym:$dst)>;
-/*def : Pat<(PPCcall_ELF (i32 tglobaladdr:$dst)),
+def : Pat<(PPCcall_ELF (i32 tglobaladdr:$dst)),
           (BL_ELF tglobaladdr:$dst)>;
 def : Pat<(PPCcall_ELF (i32 texternalsym:$dst)),
-          (BL_ELF texternalsym:$dst)>;*/
+          (BL_ELF texternalsym:$dst)>;
 
 // Hi and Lo for Darwin Global Addresses.
 def : Pat<(PPChi tglobaladdr:$in, 0), (LIS tglobaladdr:$in)>;