Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 7,913 Lines • ▼ Show 20 Lines | bool i32Stack = Op.getValueType() == MVT::i32 && Subtarget.hasSTFIWX() && | ||||
(Op.getOpcode() == ISD::FP_TO_SINT || Subtarget.hasFPCVT()); | (Op.getOpcode() == ISD::FP_TO_SINT || Subtarget.hasFPCVT()); | ||||
SDValue FIPtr = DAG.CreateStackTemporary(i32Stack ? MVT::i32 : MVT::f64); | SDValue FIPtr = DAG.CreateStackTemporary(i32Stack ? MVT::i32 : MVT::f64); | ||||
int FI = cast<FrameIndexSDNode>(FIPtr)->getIndex(); | int FI = cast<FrameIndexSDNode>(FIPtr)->getIndex(); | ||||
MachinePointerInfo MPI = | MachinePointerInfo MPI = | ||||
MachinePointerInfo::getFixedStack(DAG.getMachineFunction(), FI); | MachinePointerInfo::getFixedStack(DAG.getMachineFunction(), FI); | ||||
// Emit a store to the stack slot. | // Emit a store to the stack slot. | ||||
SDValue Chain; | SDValue Chain; | ||||
Align Alignment; | |||||
if (i32Stack) { | if (i32Stack) { | ||||
MachineFunction &MF = DAG.getMachineFunction(); | MachineFunction &MF = DAG.getMachineFunction(); | ||||
MachineMemOperand *MMO = | MachineMemOperand *MMO = | ||||
MF.getMachineMemOperand(MPI, MachineMemOperand::MOStore, 4, Align(4)); | MF.getMachineMemOperand(MPI, MachineMemOperand::MOStore, 4, Align(4)); | ||||
steven.zhang: Replace the Align(4) with Alignment. | |||||
Alignment = Align(4); | |||||
SDValue Ops[] = { DAG.getEntryNode(), Tmp, FIPtr }; | SDValue Ops[] = { DAG.getEntryNode(), Tmp, FIPtr }; | ||||
Chain = DAG.getMemIntrinsicNode(PPCISD::STFIWX, dl, | Chain = DAG.getMemIntrinsicNode(PPCISD::STFIWX, dl, | ||||
DAG.getVTList(MVT::Other), Ops, MVT::i32, MMO); | DAG.getVTList(MVT::Other), Ops, MVT::i32, MMO); | ||||
} else | } else | ||||
Chain = DAG.getStore(DAG.getEntryNode(), dl, Tmp, FIPtr, MPI); | Chain = DAG.getStore(DAG.getEntryNode(), dl, Tmp, FIPtr, MPI); | ||||
steven.zhangUnsubmitted Pass the Alignment to the getStore() as what we have done for getMachineMemOperand(). steven.zhang: Pass the Alignment to the getStore() as what we have done for getMachineMemOperand(). | |||||
// Result is a load from the stack slot. If loading 4 bytes, make sure to | // Result is a load from the stack slot. If loading 4 bytes, make sure to | ||||
// add in a bias on big endian. | // add in a bias on big endian. | ||||
if (Op.getValueType() == MVT::i32 && !i32Stack) { | if (Op.getValueType() == MVT::i32 && !i32Stack) { | ||||
FIPtr = DAG.getNode(ISD::ADD, dl, FIPtr.getValueType(), FIPtr, | FIPtr = DAG.getNode(ISD::ADD, dl, FIPtr.getValueType(), FIPtr, | ||||
DAG.getConstant(4, dl, FIPtr.getValueType())); | DAG.getConstant(4, dl, FIPtr.getValueType())); | ||||
MPI = MPI.getWithOffset(Subtarget.isLittleEndian() ? 0 : 4); | MPI = MPI.getWithOffset(Subtarget.isLittleEndian() ? 0 : 4); | ||||
} | } | ||||
RLI.Chain = Chain; | RLI.Chain = Chain; | ||||
RLI.Ptr = FIPtr; | RLI.Ptr = FIPtr; | ||||
RLI.MPI = MPI; | RLI.MPI = MPI; | ||||
RLI.Alignment = Alignment; | |||||
steven.zhangUnsubmitted Not Done ReplyInline ActionsYou are setting the RLI.Alignment to uninitialized value if it is not i32Stack. steven.zhang: You are setting the RLI.Alignment to uninitialized value if it is not i32Stack. | |||||
lkailAuthorUnsubmitted The default constructor of Align will set it to 1. This is consistent with Chain = DAG.getStore(DAG.getEntryNode(), dl, Tmp, FIPtr, MPI); which also will have alignment of 1 for the store. I don't have deep insight of if it's correct for the Chain to have alignment of 1 yet. lkail: The default constructor of `Align` will set it to 1. This is consistent with `Chain = DAG. | |||||
steven.zhangUnsubmitted Not Done ReplyInline ActionsYou shouldn't have the assumption of the value of the default arguments of the Alignment and the getStore(), as they can be changed. You should specify the explicit initial value of the Alignment. (i.e. Align Alignment(1)). steven.zhang: You shouldn't have the assumption of the value of the default arguments of the Alignment and… | |||||
} | } | ||||
/// Custom lowers floating point to integer conversions to use | /// Custom lowers floating point to integer conversions to use | ||||
/// the direct move instructions available in ISA 2.07 to avoid the | /// the direct move instructions available in ISA 2.07 to avoid the | ||||
/// need for load/store combinations. | /// need for load/store combinations. | ||||
SDValue PPCTargetLowering::LowerFP_TO_INTDirectMove(SDValue Op, | SDValue PPCTargetLowering::LowerFP_TO_INTDirectMove(SDValue Op, | ||||
SelectionDAG &DAG, | SelectionDAG &DAG, | ||||
const SDLoc &dl) const { | const SDLoc &dl) const { | ||||
▲ Show 20 Lines • Show All 8,161 Lines • Show Last 20 Lines |
Replace the Align(4) with Alignment.