aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Bendersky <eliben@chromium.org>2013-07-15 16:48:58 -0700
committerEli Bendersky <eliben@chromium.org>2013-07-15 16:48:58 -0700
commit9ba79618f8267263bc774b104e2b0e469be9dcda (patch)
tree832295d4b8579b929104f681e0c7e21a906c2ccb
parentc6cf05cb5108f356dde97c01ee4188b0671d4542 (diff)
Trying to get the thing to copmile...
-rw-r--r--lib/Target/ARM/ARMISelLowering.cpp8
-rw-r--r--lib/Target/ARM/ARMInstrInfo.td92
-rw-r--r--lib/Target/Mips/MipsDelaySlotFiller.cpp3
-rw-r--r--lib/Target/Mips/MipsISelLowering.cpp16
-rw-r--r--lib/Target/Mips/MipsISelLowering.h2
-rw-r--r--lib/Target/Mips/MipsSubtarget.h4
6 files changed, 107 insertions, 18 deletions
diff --git a/lib/Target/ARM/ARMISelLowering.cpp b/lib/Target/ARM/ARMISelLowering.cpp
index 8bc6a215fe..e0eb5b2a9a 100644
--- a/lib/Target/ARM/ARMISelLowering.cpp
+++ b/lib/Target/ARM/ARMISelLowering.cpp
@@ -1806,7 +1806,9 @@ ARMTargetLowering::HandleByVal(
// handle var-args reg-save area.
// PR11018.
if (Subtarget->isTargetNaCl()) {
- if ((!State->isFirstByValRegValid()) &&
+ unsigned ByValArgsCount = State->getInRegsParamsCount();
+ unsigned CurByValIndex = State->getInRegsParamsProceed();
+ if ((CurByValIndex >= ByValArgsCount) &&
(ARM::R0 <= reg) && (reg <= ARM::R3)) {
State->setHasByValInRegPosition();
}
@@ -2868,7 +2870,7 @@ ARMTargetLowering::computeRegArea(CCState &CCInfo, MachineFunction &MF,
CCInfo.getInRegsParamInfo(InRegsParamRecordIdx, RBegin, REnd);
NumGPRs = REnd - RBegin;
// @LOCALMOD-BEGIN
- } else if (Subtarget->isTargetNaCl() && CCInfo.hasByValInRegPosition())
+ } else if (Subtarget->isTargetNaCl() && CCInfo.hasByValInRegPosition()) {
NumGPRs = 0;
// @LOCALMOD-END
} else {
@@ -2922,7 +2924,7 @@ ARMTargetLowering::StoreByValRegs(CCState &CCInfo, SelectionDAG &DAG,
firstRegToSaveIndex = RBegin - ARM::R0;
lastRegToSaveIndex = REnd - ARM::R0;
// @LOCALMOD-BEGIN
- } else if (Subtarget->isTargetNaCl() && CCInfo.hasByValInRegPosition())
+ } else if (Subtarget->isTargetNaCl() && CCInfo.hasByValInRegPosition()) {
firstRegToSaveIndex = 4; // Nothing to save.
// @LOCALMOD-END
} else {
diff --git a/lib/Target/ARM/ARMInstrInfo.td b/lib/Target/ARM/ARMInstrInfo.td
index 4a201a7459..063043f51b 100644
--- a/lib/Target/ARM/ARMInstrInfo.td
+++ b/lib/Target/ARM/ARMInstrInfo.td
@@ -889,7 +889,7 @@ def am2offset_imm : Operand<i32>,
//
// FIXME: split into imm vs. reg versions.
def AddrMode3AsmOperand : AsmOperandClass { let Name = "AddrMode3"; }
-def AddrMode3 : Operand<i32>,
+class AddrMode3 : Operand<i32>,
ComplexPattern<i32, 3, "SelectAddrMode3", [],
[SDNPWantRoot]> { // @LOCALMOD
let EncoderMethod = "getAddrMode3OpValue";
@@ -1988,6 +1988,33 @@ let isBranch = 1, isTerminator = 1, isBarrier = 1, isIndirectBranch = 1 in {
// SP is marked as a use to prevent stack-pointer assignments that appear
// immediately before calls from potentially appearing dead.
+
+// @LOCALMOD-START
+// Exception handling related Node and Instructions.
+// The conversion sequence is:
+// ISD::EH_RETURN -> ARMISD::EH_RETURN ->
+// ARMeh_return -> (stack change + indirect branch)
+//
+// ARMeh_return takes the place of regular return instruction
+// but takes two arguments.
+// R2, R3 are used for storing the offset and return address respectively.
+def SDT_ARMEHRET : SDTypeProfile<0, 2, [SDTCisInt<0>, SDTCisPtrTy<1>]>;
+
+def ARMehret : SDNode<"ARMISD::EH_RETURN", SDT_ARMEHRET,
+ [SDNPHasChain, SDNPOptInGlue]>;
+
+
+let isTerminator = 1, isReturn = 1, isBarrier = 1,
+ Defs = [SP],
+ Uses = [SP] in {
+ def ARMeh_return : PseudoInst<(outs),
+ (ins GPR:$spadj, GPR:$dst),
+ IIC_Br,
+ [(ARMehret GPR:$spadj, GPR:$dst)]>,
+ Requires<[IsARM]>;
+}
+// @LOCALMOD-END
+
let isCall = 1,
// FIXME: Do we really need a non-predicated version? If so, it should
// at least be a pseudo instruction expanding to the predicated version
@@ -3083,6 +3110,69 @@ def MOVTi16_ga_pcrel : PseudoInst<(outs GPR:$Rd),
} // Constraints
+// @LOCALMOD-BEGIN
+// PIC / PC-relative versions of MOVi16/MOVTi16, which have an extra
+// operand representing the ID of the PICADD instruction that corrects
+// for relativity. This is used to materialize addresses into
+// a register in a PC-relative manner.
+//
+// E.g. Rather than have an absolute address in $imm, and transferred to
+// a register with:
+// movw $Rd, :lower16:$imm
+// movt $Rd, :upper16:$imm
+//
+// we will instead have a relative offset:
+// movw $Rd, :lower16:$imm - ($pic_add_id + 8)
+// ...
+// movt $Rd, :upper16:$imm - ($pic_add_id + 8)
+// ...
+// $pic_add_id:
+// add $Rd, pc, $Rd
+//
+// One way these pseudo instructions (and the corresponding PICADD)
+// come about is during expansion of the MOVi32imm pseudo instruction
+// (see ARMExpandPseudo::ExpandMBB).
+// These pseudo instructions become real instructions when they are
+// finally lowered to MCInsts (e.g., at ARMAsmPrinter::EmitInstruction),
+// and the extra pclabel ID becomes part of the appropriate operand.
+//
+// NOTE: aside from adding the pclabel operand, all other operands should
+// be the same as the non-PIC versions to simplify conversion to the
+// non-pseudo instructions.
+let isReMaterializable = 1, isAsCheapAsAMove = 1, isMoveImm = 1,
+ neverHasSideEffects = 1 in
+def MOVi16PIC : PseudoInst<(outs GPR:$Rd), (ins imm0_65535_expr:$imm,
+ pclabel:$pic_add_id,
+ pred:$p),
+ IIC_iMOVi,
+ []>,
+ Requires<[IsARM, HasV6T2]>, UnaryDP;
+
+let Constraints = "$src = $Rd" in
+def MOVTi16PIC : PseudoInst<(outs GPR:$Rd), (ins GPR:$src,
+ imm0_65535_expr:$imm,
+ pclabel:$pic_add_id,
+ pred:$p),
+ IIC_iMOVi,
+ []>,
+ UnaryDP, Requires<[IsARM, HasV6T2]>;
+// @LOCALMOD-END
+
+// @LOCALMOD-BEGIN
+// Pseudo-instruction that will be expanded into MOVW / MOVT (PIC versions) w/
+// GOT as the operand.
+// The alternative is to create a constant pool entry with the (relative)
+// GOT address and load from the constant pool. This is currently used
+// when constant islands are turned off, since MOVW / MOVT will be faster.
+let isReMaterializable = 1, isMoveImm = 1, neverHasSideEffects = 1 in
+def MOVGOTAddr : PseudoInst<(outs GPR:$dst), (ins),
+ IIC_iMOVix2, // will expand to two MOVi's
+ []>,
+ Requires<[IsARM, UseMovt]>;
+
+def : ARMPat<(ARMWrapperGOT), (MOVGOTAddr)>;
+// @LOCALMOD-END
+
def : ARMPat<(or GPR:$src, 0xffff0000), (MOVTi16 GPR:$src, 0xffff)>,
Requires<[IsARM, HasV6T2]>;
diff --git a/lib/Target/Mips/MipsDelaySlotFiller.cpp b/lib/Target/Mips/MipsDelaySlotFiller.cpp
index cf350b5b97..d07a595af3 100644
--- a/lib/Target/Mips/MipsDelaySlotFiller.cpp
+++ b/lib/Target/Mips/MipsDelaySlotFiller.cpp
@@ -184,9 +184,6 @@ namespace {
}
bool runOnMachineFunction(MachineFunction &F) {
- if (SkipDelaySlotFiller)
- return false;
-
bool Changed = false;
for (MachineFunction::iterator FI = F.begin(), FE = F.end();
FI != FE; ++FI)
diff --git a/lib/Target/Mips/MipsISelLowering.cpp b/lib/Target/Mips/MipsISelLowering.cpp
index 1d9ca6e1d1..9be1e454e6 100644
--- a/lib/Target/Mips/MipsISelLowering.cpp
+++ b/lib/Target/Mips/MipsISelLowering.cpp
@@ -1573,21 +1573,21 @@ LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const
// @LOCALMOD-BEGIN
if (Subtarget->isTargetNaCl()) {
SDVTList VTs = DAG.getVTList(MVT::i32);
- SDValue TGAHi = DAG.getTargetGlobalAddress(GV, dl, MVT::i32, 0,
+ SDValue TGAHi = DAG.getTargetGlobalAddress(GV, DL, MVT::i32, 0,
MipsII::MO_TPREL_HI);
- SDValue TGALo = DAG.getTargetGlobalAddress(GV, dl, MVT::i32, 0,
+ SDValue TGALo = DAG.getTargetGlobalAddress(GV, DL, MVT::i32, 0,
MipsII::MO_TPREL_LO);
- SDValue Hi = DAG.getNode(MipsISD::Hi, dl, VTs, &TGAHi, 1);
- SDValue Lo = DAG.getNode(MipsISD::Lo, dl, MVT::i32, TGALo);
- SDValue Offset = DAG.getNode(ISD::ADD, dl, MVT::i32, Hi, Lo);
+ SDValue Hi = DAG.getNode(MipsISD::Hi, DL, VTs, &TGAHi, 1);
+ SDValue Lo = DAG.getNode(MipsISD::Lo, DL, MVT::i32, TGALo);
+ SDValue Offset = DAG.getNode(ISD::ADD, DL, MVT::i32, Hi, Lo);
- SDValue ThreadPointer = GetNaClThreadPointer(DAG, dl);
+ SDValue ThreadPointer = GetNaClThreadPointer(DAG, DL);
// tprel_hi and tprel_lo relocations expect that thread pointer is offset
// by 0x7000 from the start of the TLS data area.
SDValue TPOffset = DAG.getConstant(0x7000, MVT::i32);
- SDValue ThreadPointer2 = DAG.getNode(ISD::ADD, dl, PtrVT, ThreadPointer,
+ SDValue ThreadPointer2 = DAG.getNode(ISD::ADD, DL, PtrVT, ThreadPointer,
TPOffset);
- return DAG.getNode(ISD::ADD, dl, PtrVT, ThreadPointer2, Offset);
+ return DAG.getNode(ISD::ADD, DL, PtrVT, ThreadPointer2, Offset);
}
// @LOCALMOD-END
diff --git a/lib/Target/Mips/MipsISelLowering.h b/lib/Target/Mips/MipsISelLowering.h
index 6c1e7ae3ec..3169dd075b 100644
--- a/lib/Target/Mips/MipsISelLowering.h
+++ b/lib/Target/Mips/MipsISelLowering.h
@@ -271,7 +271,6 @@ namespace llvm {
/// reservedArgArea - The size of the area the caller reserves for
/// register arguments. This is 16-byte if ABI is O32.
unsigned reservedArgArea() const;
-
/// Return pointer to array of integer argument registers.
const uint16_t *intArgRegs() const;
@@ -331,6 +330,7 @@ namespace llvm {
const SDNode *CallNode, const Type *RetTy) const;
// Lower Operand specifics
+ SDValue LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const; // @LOCALMOD
SDValue lowerBR_JT(SDValue Op, SelectionDAG &DAG) const;
SDValue lowerBRCOND(SDValue Op, SelectionDAG &DAG) const;
SDValue lowerConstantPool(SDValue Op, SelectionDAG &DAG) const;
diff --git a/lib/Target/Mips/MipsSubtarget.h b/lib/Target/Mips/MipsSubtarget.h
index 864a3392af..718721c1d3 100644
--- a/lib/Target/Mips/MipsSubtarget.h
+++ b/lib/Target/Mips/MipsSubtarget.h
@@ -118,13 +118,13 @@ protected:
// Relocation Model
Reloc::Model RM;
- Triple TargetTriple; // @LOCALMOD
-
// We can override the determination of whether we are in mips16 mode
// as from the command line
enum {NoOverride, Mips16Override, NoMips16Override} OverrideMode;
MipsTargetMachine *TM;
+
+ Triple TargetTriple; // @LOCALMOD
public:
virtual bool enablePostRAScheduler(CodeGenOpt::Level OptLevel,
AntiDepBreakMode& Mode,