aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-10-23 06:42:42 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-10-23 06:42:42 +0000
commit152b7e18748f7e06a93260f22cc9dac8eb3abee2 (patch)
treec304a6fdd9fcfd3b049db55eca99f02fa8c8909c /lib
parent8eef4b2d05808e586a0b5aabc87e9ba5d5e8a798 (diff)
downloadexternal_llvm-152b7e18748f7e06a93260f22cc9dac8eb3abee2.zip
external_llvm-152b7e18748f7e06a93260f22cc9dac8eb3abee2.tar.gz
external_llvm-152b7e18748f7e06a93260f22cc9dac8eb3abee2.tar.bz2
Temporary solution: added a different set of BCTRL_Macho / BCTRL_ELF with right callee-saved defs set for ppc64.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43248 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/PowerPC/PPCISelDAGToDAG.cpp8
-rw-r--r--lib/Target/PowerPC/PPCInstr64Bit.td12
-rw-r--r--lib/Target/PowerPC/PPCInstrInfo.td6
3 files changed, 18 insertions, 8 deletions
diff --git a/lib/Target/PowerPC/PPCISelDAGToDAG.cpp b/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
index 730bac6..372d238 100644
--- a/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
+++ b/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
@@ -42,11 +42,13 @@ namespace {
class VISIBILITY_HIDDEN PPCDAGToDAGISel : public SelectionDAGISel {
PPCTargetMachine &TM;
PPCTargetLowering PPCLowering;
+ const PPCSubtarget &PPCSubTarget;
unsigned GlobalBaseReg;
public:
PPCDAGToDAGISel(PPCTargetMachine &tm)
: SelectionDAGISel(PPCLowering), TM(tm),
- PPCLowering(*TM.getTargetLowering()) {}
+ PPCLowering(*TM.getTargetLowering()),
+ PPCSubTarget(*TM.getSubtargetImpl()) {}
virtual bool runOnFunction(Function &Fn) {
// Make sure we re-emit a set of the global base reg if necessary
@@ -736,7 +738,7 @@ SDNode *PPCDAGToDAGISel::SelectSETCC(SDOperand Op) {
CCReg = CurDAG->getCopyToReg(CurDAG->getEntryNode(), CR7Reg, CCReg,
InFlag).getValue(1);
- if (TLI.getTargetMachine().getSubtarget<PPCSubtarget>().isGigaProcessor())
+ if (PPCSubTarget.isGigaProcessor())
IntCR = SDOperand(CurDAG->getTargetNode(PPC::MFOCRF, MVT::i32, CR7Reg,
CCReg), 0);
else
@@ -859,7 +861,7 @@ SDNode *PPCDAGToDAGISel::Select(SDOperand Op) {
SDOperand InFlag = N->getOperand(1);
AddToISelQueue(InFlag);
// Use MFOCRF if supported.
- if (TLI.getTargetMachine().getSubtarget<PPCSubtarget>().isGigaProcessor())
+ if (PPCSubTarget.isGigaProcessor())
return CurDAG->getTargetNode(PPC::MFOCRF, MVT::i32,
N->getOperand(0), InFlag);
else
diff --git a/lib/Target/PowerPC/PPCInstr64Bit.td b/lib/Target/PowerPC/PPCInstr64Bit.td
index 9d728cf..11d90b3 100644
--- a/lib/Target/PowerPC/PPCInstr64Bit.td
+++ b/lib/Target/PowerPC/PPCInstr64Bit.td
@@ -81,10 +81,13 @@ let isCall = 1, PPC970_Unit = 7,
def BL8_Macho : IForm<18, 0, 1,
(outs), (ins calltarget:$func, variable_ops),
"bl $func", BrB, []>; // See Pat patterns below.
-
def BLA8_Macho : IForm<18, 1, 1,
(outs), (ins aaddr:$func, variable_ops),
"bla $func", BrB, [(PPCcall_Macho (i64 imm:$func))]>;
+ def BCTRL8_Macho : XLForm_2_ext<19, 528, 20, 0, 1,
+ (outs), (ins variable_ops),
+ "bctrl", BrB,
+ [(PPCbctrl_Macho)]>, Requires<[In64BitMode]>;
}
// ELF 64 ABI Calls = Macho ABI Calls
@@ -99,11 +102,14 @@ let isCall = 1, PPC970_Unit = 7,
// Convenient aliases for call instructions
def BL8_ELF : IForm<18, 0, 1,
(outs), (ins calltarget:$func, variable_ops),
- "bl $func", BrB, []>; // See Pat patterns below.
-
+ "bl $func", BrB, []>; // See Pat patterns below.
def BLA8_ELF : IForm<18, 1, 1,
(outs), (ins aaddr:$func, variable_ops),
"bla $func", BrB, [(PPCcall_ELF (i64 imm:$func))]>;
+ def BCTRL8_ELF : XLForm_2_ext<19, 528, 20, 0, 1,
+ (outs), (ins variable_ops),
+ "bctrl", BrB,
+ [(PPCbctrl_ELF)]>, Requires<[In64BitMode]>;
}
diff --git a/lib/Target/PowerPC/PPCInstrInfo.td b/lib/Target/PowerPC/PPCInstrInfo.td
index f62f7cb..6a08cea 100644
--- a/lib/Target/PowerPC/PPCInstrInfo.td
+++ b/lib/Target/PowerPC/PPCInstrInfo.td
@@ -304,6 +304,8 @@ def iaddroff : ComplexPattern<iPTR, 1, "SelectAddrImmOffs", [], []>;
//===----------------------------------------------------------------------===//
// PowerPC Instruction Predicate Definitions.
def FPContractions : Predicate<"!NoExcessFPPrecision">;
+def In32BitMode : Predicate<"!PPCSubTarget.isPPC64()">;
+def In64BitMode : Predicate<"PPCSubTarget.isPPC64()">;
//===----------------------------------------------------------------------===//
@@ -409,7 +411,7 @@ let isCall = 1, PPC970_Unit = 7,
def BCTRL_Macho : XLForm_2_ext<19, 528, 20, 0, 1,
(outs), (ins variable_ops),
"bctrl", BrB,
- [(PPCbctrl_Macho)]>;
+ [(PPCbctrl_Macho)]>, Requires<[In32BitMode]>;
}
// ELF ABI Calls.
@@ -431,7 +433,7 @@ let isCall = 1, PPC970_Unit = 7,
def BCTRL_ELF : XLForm_2_ext<19, 528, 20, 0, 1,
(outs), (ins variable_ops),
"bctrl", BrB,
- [(PPCbctrl_ELF)]>;
+ [(PPCbctrl_ELF)]>, Requires<[In32BitMode]>;
}
// DCB* instructions.