} Base;
SDValue IndexReg;
- int32_t Disp;
+ int64_t Disp;
SystemZRRIAddressMode()
: BaseType(RegBase), IndexReg(), Disp(0) {
/// or 64-bit immediate, and if the value can be accurately represented as a
/// sign extension from a 20-bit value. If so, this returns true and the
/// immediate.
-static bool isImmSExt20(int64_t Val, int32_t &Imm) {
+static bool isImmSExt20(int64_t Val, int64_t &Imm) {
if (Val >= -524288 && Val <= 524287) {
- Imm = (int32_t)Val;
+ Imm = Val;
return true;
}
return false;
}
-static bool isImmSExt20(SDNode *N, int32_t &Imm) {
+static bool isImmSExt20(SDNode *N, int64_t &Imm) {
if (N->getOpcode() != ISD::Constant)
return false;
return isImmSExt20(cast<ConstantSDNode>(N)->getSExtValue(), Imm);
}
-static bool isImmSExt20(SDValue Op, int32_t &Imm) {
+static bool isImmSExt20(SDValue Op, int64_t &Imm) {
return isImmSExt20(Op.getNode(), Imm);
}
MVT VT = Addr.getValueType();
if (Addr.getOpcode() == ISD::ADD) {
- int32_t Imm = 0;
+ int64_t Imm = 0;
if (isImmSExt20(Addr.getOperand(1), Imm)) {
- Disp = CurDAG->getTargetConstant(Imm, MVT::i32);
+ Disp = CurDAG->getTargetConstant(Imm, MVT::i64);
if (FrameIndexSDNode *FI =
dyn_cast<FrameIndexSDNode>(Addr.getOperand(0))) {
Base = CurDAG->getTargetFrameIndex(FI->getIndex(), VT);
return true; // [r+i]
}
} else if (Addr.getOpcode() == ISD::OR) {
- int32_t Imm = 0;
+ int64_t Imm = 0;
if (isImmSExt20(Addr.getOperand(1), Imm)) {
// If this is an or of disjoint bitfields, we can codegen this as an add
// (for better address arithmetic) if the LHS and RHS of the OR are
// If all of the bits are known zero on the LHS or RHS, the add won't
// carry.
Base = Addr.getOperand(0);
- Disp = CurDAG->getTargetConstant(Imm, MVT::i32);
+ Disp = CurDAG->getTargetConstant(Imm, MVT::i64);
return true;
}
}
// If this address fits entirely in a 20-bit sext immediate field, codegen
// this as "d(r0)"
- int32_t Imm;
+ int64_t Imm;
if (isImmSExt20(CN, Imm)) {
- Disp = CurDAG->getTargetConstant(Imm, MVT::i32);
+ Disp = CurDAG->getTargetConstant(Imm, MVT::i64);
Base = CurDAG->getRegister(0, VT);
return true;
}
}
- Disp = CurDAG->getTargetConstant(0, MVT::i32);
+ Disp = CurDAG->getTargetConstant(0, MVT::i64);
if (FrameIndexSDNode *FI = dyn_cast<FrameIndexSDNode>(Addr))
Base = CurDAG->getTargetFrameIndex(FI->getIndex(), VT);
else
switch (N.getOpcode()) {
default: break;
case ISD::Constant: {
- uint64_t Val = cast<ConstantSDNode>(N)->getSExtValue();
- int32_t Imm;
+ int64_t Val = cast<ConstantSDNode>(N)->getSExtValue();
+ int64_t Imm;
if (isImmSExt20(AM.Disp + Val, Imm)) {
AM.Disp = Imm;
return false;
// Handle "X | C" as "X + C" iff X is known to have C bits clear.
if (ConstantSDNode *CN = dyn_cast<ConstantSDNode>(N.getOperand(1))) {
SystemZRRIAddressMode Backup = AM;
- uint64_t Offset = CN->getSExtValue();
- int32_t Imm;
+ int64_t Offset = CN->getSExtValue();
+ int64_t Imm;
// Start with the LHS as an addr mode.
if (!MatchAddress(N.getOperand(0), AM, Depth+1) &&
// The resultant disp must fit in 20-bits.
if (!Done && MatchAddress(Addr, AM))
return false;
+ DOUT << "MatchAddress (final): "; DEBUG(AM.dump());
+
MVT VT = Addr.getValueType();
if (AM.BaseType == SystemZRRIAddressMode::RegBase) {
if (!AM.Base.Reg.getNode())
else
Base = CurDAG->getTargetFrameIndex(AM.Base.FrameIndex, TLI.getPointerTy());
Index = AM.IndexReg;
- Disp = CurDAG->getTargetConstant(AM.Disp, MVT::i32);
+ Disp = CurDAG->getTargetConstant(AM.Disp, MVT::i64);
return true;
}
Base = CurDAG->getTargetFrameIndex(AM.Base.FrameIndex,
TLI.getPointerTy());
Index = AM.IndexReg;
- Disp = CurDAG->getTargetConstant(AM.Disp, MVT::i32);
+ Disp = CurDAG->getTargetConstant(AM.Disp, MVT::i64);
return true;
}
def riaddr : Operand<i64>,
ComplexPattern<i64, 2, "SelectAddrRI", []> {
let PrintMethod = "printRIAddrOperand";
- let MIOperandInfo = (ops ADDR64:$base, i32imm:$disp);
+ let MIOperandInfo = (ops ADDR64:$base, i64imm:$disp);
}
//===----------------------------------------------------------------------===//
def rriaddr : Operand<i64>,
ComplexPattern<i64, 3, "SelectAddrRRI", [], []> {
let PrintMethod = "printRRIAddrOperand";
- let MIOperandInfo = (ops ADDR64:$base, ADDR64:$index, i32imm:$disp);
+ let MIOperandInfo = (ops ADDR64:$base, ADDR64:$index, i64imm:$disp);
}
def laaddr : Operand<i64>,
ComplexPattern<i64, 3, "SelectLAAddr", [add, sub, or, frameindex], []> {
let PrintMethod = "printRRIAddrOperand";
- let MIOperandInfo = (ops ADDR64:$base, ADDR64:$index, i32imm:$disp);
+ let MIOperandInfo = (ops ADDR64:$base, ADDR64:$index, i64imm:$disp);
}