From: Nicolas Geoffray Date: Tue, 27 Feb 2007 13:01:19 +0000 (+0000) Subject: Differentiate between the MachO and the ELF ABI the CALL instruction. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=63f8fb1993bf2b4286c5a6763e2eee414a751699;p=oota-llvm.git 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 --- diff --git a/lib/Target/PowerPC/PPCISelLowering.cpp b/lib/Target/PowerPC/PPCISelLowering.cpp index 13cdadcea81..c29364c82f6 100644 --- a/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/lib/Target/PowerPC/PPCISelLowering.cpp @@ -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 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 diff --git a/lib/Target/PowerPC/PPCISelLowering.h b/lib/Target/PowerPC/PPCISelLowering.h index 00e65f62fdb..676e0bc6fc8 100644 --- a/lib/Target/PowerPC/PPCISelLowering.h +++ b/lib/Target/PowerPC/PPCISelLowering.h @@ -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. diff --git a/lib/Target/PowerPC/PPCInstr64Bit.td b/lib/Target/PowerPC/PPCInstr64Bit.td index 57bb9dac408..50c47fdadfb 100644 --- a/lib/Target/PowerPC/PPCInstr64Bit.td +++ b/lib/Target/PowerPC/PPCInstr64Bit.td @@ -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. diff --git a/lib/Target/PowerPC/PPCInstrInfo.td b/lib/Target/PowerPC/PPCInstrInfo.td index fee3e724e59..cfdb3780acc 100644 --- a/lib/Target/PowerPC/PPCInstrInfo.td +++ b/lib/Target/PowerPC/PPCInstrInfo.td @@ -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)>;