mirror of
https://github.com/RPCS3/llvm.git
synced 2025-05-14 01:16:26 +00:00
Fully implement frame index, so that we can pass the address of alloca's
around to functions and stuff git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23036 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
afb2dd43de
commit
e28e40a273
@ -369,9 +369,10 @@ bool PPC32DAGToDAGISel::SelectAddr(SDOperand Addr, SDOperand &Op1,
|
|||||||
if (Addr.getOpcode() == ISD::ADD) {
|
if (Addr.getOpcode() == ISD::ADD) {
|
||||||
if (isIntImmediate(Addr.getOperand(1), imm) && isInt16(imm)) {
|
if (isIntImmediate(Addr.getOperand(1), imm) && isInt16(imm)) {
|
||||||
Op1 = getI32Imm(Lo16(imm));
|
Op1 = getI32Imm(Lo16(imm));
|
||||||
if (isa<FrameIndexSDNode>(Addr.getOperand(0))) {
|
if (FrameIndexSDNode *FI =
|
||||||
|
dyn_cast<FrameIndexSDNode>(Addr.getOperand(0))) {
|
||||||
++FrameOff;
|
++FrameOff;
|
||||||
Op2 = Addr.getOperand(0);
|
Op2 = CurDAG->getTargetFrameIndex(FI->getIndex(), MVT::i32);
|
||||||
} else {
|
} else {
|
||||||
Op2 = Select(Addr.getOperand(0));
|
Op2 = Select(Addr.getOperand(0));
|
||||||
}
|
}
|
||||||
@ -396,9 +397,9 @@ bool PPC32DAGToDAGISel::SelectAddr(SDOperand Addr, SDOperand &Op1,
|
|||||||
Op2 = CurDAG->getTargetNode(PPC::LIS, MVT::i32, Op1);
|
Op2 = CurDAG->getTargetNode(PPC::LIS, MVT::i32, Op1);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (isa<FrameIndexSDNode>(Addr)) {
|
} else if (FrameIndexSDNode *FI = dyn_cast<FrameIndexSDNode>(Addr)) {
|
||||||
Op1 = getI32Imm(0);
|
Op1 = getI32Imm(0);
|
||||||
Op2 = Addr;
|
Op2 = CurDAG->getTargetFrameIndex(FI->getIndex(), MVT::i32);
|
||||||
return false;
|
return false;
|
||||||
} else if (ConstantPoolSDNode *CP = dyn_cast<ConstantPoolSDNode>(Addr)) {
|
} else if (ConstantPoolSDNode *CP = dyn_cast<ConstantPoolSDNode>(Addr)) {
|
||||||
Op1 = Addr;
|
Op1 = Addr;
|
||||||
@ -530,6 +531,13 @@ SDOperand PPC32DAGToDAGISel::Select(SDOperand Op) {
|
|||||||
else
|
else
|
||||||
CurDAG->SelectNodeTo(N, N->getValueType(0), PPC::IMPLICIT_DEF_FP);
|
CurDAG->SelectNodeTo(N, N->getValueType(0), PPC::IMPLICIT_DEF_FP);
|
||||||
break;
|
break;
|
||||||
|
case ISD::FrameIndex: {
|
||||||
|
int FI = cast<FrameIndexSDNode>(N)->getIndex();
|
||||||
|
CurDAG->SelectNodeTo(N, MVT::i32, PPC::ADDI,
|
||||||
|
CurDAG->getTargetFrameIndex(FI, MVT::i32),
|
||||||
|
getI32Imm(0));
|
||||||
|
break;
|
||||||
|
}
|
||||||
case ISD::GlobalAddress: {
|
case ISD::GlobalAddress: {
|
||||||
GlobalValue *GV = cast<GlobalAddressSDNode>(N)->getGlobal();
|
GlobalValue *GV = cast<GlobalAddressSDNode>(N)->getGlobal();
|
||||||
SDOperand Tmp;
|
SDOperand Tmp;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user