Differentiate between the MachO and the ELF ABI the CALL instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34667 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nicolas Geoffray 2007-02-27 13:01:19 +00:00
parent d313a9b148
commit 63f8fb1993
4 changed files with 12 additions and 12 deletions

View File

@ -326,7 +326,8 @@ const char *PPCTargetLowering::getTargetNodeName(unsigned Opcode) const {
case PPCISD::SHL: return "PPCISD::SHL"; case PPCISD::SHL: return "PPCISD::SHL";
case PPCISD::EXTSW_32: return "PPCISD::EXTSW_32"; case PPCISD::EXTSW_32: return "PPCISD::EXTSW_32";
case PPCISD::STD_32: return "PPCISD::STD_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::MTCTR: return "PPCISD::MTCTR";
case PPCISD::BCTRL_Macho: return "PPCISD::BCTRL_Macho"; case PPCISD::BCTRL_Macho: return "PPCISD::BCTRL_Macho";
case PPCISD::BCTRL_ELF: return "PPCISD::BCTRL_ELF"; 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. NodeTys.push_back(MVT::Flag); // Returns a flag for retval copy to use.
SmallVector<SDOperand, 8> Ops; 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 // If the callee is a GlobalAddress/ExternalSymbol node (quite common, every
// direct call is) turn it into a TargetGlobalAddress/TargetExternalSymbol // direct call is) turn it into a TargetGlobalAddress/TargetExternalSymbol

View File

@ -82,7 +82,7 @@ namespace llvm {
STD_32, STD_32,
/// CALL - A direct function call. /// CALL - A direct function call.
CALL, CALL_Macho, CALL_ELF,
/// CHAIN,FLAG = MTCTR(VAL, CHAIN[, INFLAG]) - Directly corresponds to a /// CHAIN,FLAG = MTCTR(VAL, CHAIN[, INFLAG]) - Directly corresponds to a
/// MTCTR instruction. /// MTCTR instruction.

View File

@ -102,7 +102,7 @@ let isCall = 1, noResults = 1, PPC970_Unit = 7,
def BLA8_ELF : IForm<18, 1, 1, def BLA8_ELF : IForm<18, 1, 1,
(ops aaddr:$func, variable_ops), (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)>; (BL8_Macho tglobaladdr:$dst)>;
def : Pat<(PPCcall_Macho (i64 texternalsym:$dst)), def : Pat<(PPCcall_Macho (i64 texternalsym:$dst)),
(BL8_Macho texternalsym:$dst)>; (BL8_Macho texternalsym:$dst)>;
/*
def : Pat<(PPCcall_ELF (i64 tglobaladdr:$dst)), def : Pat<(PPCcall_ELF (i64 tglobaladdr:$dst)),
(BL8_ELF tglobaladdr:$dst)>; (BL8_ELF tglobaladdr:$dst)>;
def : Pat<(PPCcall_ELF (i64 texternalsym:$dst)), def : Pat<(PPCcall_ELF (i64 texternalsym:$dst)),
(BL8_ELF texternalsym:$dst)>; (BL8_ELF texternalsym:$dst)>;
*/
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// 64-bit SPR manipulation instrs. // 64-bit SPR manipulation instrs.

View File

@ -81,9 +81,9 @@ def callseq_end : SDNode<"ISD::CALLSEQ_END", SDT_PPCCallSeq,
[SDNPHasChain, SDNPOutFlag]>; [SDNPHasChain, SDNPOutFlag]>;
def SDT_PPCCall : SDTypeProfile<0, -1, [SDTCisInt<0>]>; 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]>; [SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>;
def PPCcall_ELF : SDNode<"PPCISD::CALL", SDT_PPCCall, def PPCcall_ELF : SDNode<"PPCISD::CALL_ELF", SDT_PPCCall,
[SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>; [SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>;
def PPCmtctr : SDNode<"PPCISD::MTCTR", SDT_PPCCall, def PPCmtctr : SDNode<"PPCISD::MTCTR", SDT_PPCCall,
[SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>; [SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>;
@ -407,11 +407,11 @@ let isCall = 1, noResults = 1, PPC970_Unit = 7,
def BLA_ELF : IForm<18, 1, 1, def BLA_ELF : IForm<18, 1, 1,
(ops aaddr:$func, variable_ops), (ops aaddr:$func, variable_ops),
"bla $func", BrB, "bla $func", BrB,
[/*(PPCcall_ELF (i32 imm:$func))*/]>; [(PPCcall_ELF (i32 imm:$func))]>;
def BCTRL_ELF : XLForm_2_ext<19, 528, 20, 0, 1, def BCTRL_ELF : XLForm_2_ext<19, 528, 20, 0, 1,
(ops variable_ops), (ops variable_ops),
"bctrl", BrB, "bctrl", BrB,
[/*(PPCbctrl_ELF)*/]>; [(PPCbctrl_ELF)]>;
} }
// DCB* instructions. // DCB* instructions.
@ -1101,10 +1101,10 @@ def : Pat<(PPCcall_Macho (i32 tglobaladdr:$dst)),
(BL_Macho tglobaladdr:$dst)>; (BL_Macho tglobaladdr:$dst)>;
def : Pat<(PPCcall_Macho (i32 texternalsym:$dst)), def : Pat<(PPCcall_Macho (i32 texternalsym:$dst)),
(BL_Macho texternalsym:$dst)>; (BL_Macho texternalsym:$dst)>;
/*def : Pat<(PPCcall_ELF (i32 tglobaladdr:$dst)), def : Pat<(PPCcall_ELF (i32 tglobaladdr:$dst)),
(BL_ELF tglobaladdr:$dst)>; (BL_ELF tglobaladdr:$dst)>;
def : Pat<(PPCcall_ELF (i32 texternalsym:$dst)), def : Pat<(PPCcall_ELF (i32 texternalsym:$dst)),
(BL_ELF texternalsym:$dst)>;*/ (BL_ELF texternalsym:$dst)>;
// Hi and Lo for Darwin Global Addresses. // Hi and Lo for Darwin Global Addresses.
def : Pat<(PPChi tglobaladdr:$in, 0), (LIS tglobaladdr:$in)>; def : Pat<(PPChi tglobaladdr:$in, 0), (LIS tglobaladdr:$in)>;