mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
[SelectionDAG] Inline a single use helper function, and remove last non-MMO interface [NFC]
For D57601, we need to know whether the instruction is volatile. We'd either have to pass yet another parameter, or just standardize on the MMO interface. I chose the second. llvm-svn: 353989
This commit is contained in:
parent
c3c7e5c75a
commit
17e2ed961b
@ -979,12 +979,6 @@ public:
|
||||
/// valid Opcodes. ISD::ATOMIC_CMO_SWAP produces the value loaded and a
|
||||
/// chain result. ISD::ATOMIC_CMP_SWAP_WITH_SUCCESS produces the value loaded,
|
||||
/// a success flag (initially i1), and a chain.
|
||||
SDValue getAtomicCmpSwap(unsigned Opcode, const SDLoc &dl, EVT MemVT,
|
||||
SDVTList VTs, SDValue Chain, SDValue Ptr,
|
||||
SDValue Cmp, SDValue Swp, MachinePointerInfo PtrInfo,
|
||||
unsigned Alignment, AtomicOrdering SuccessOrdering,
|
||||
AtomicOrdering FailureOrdering,
|
||||
SyncScope::ID SSID);
|
||||
SDValue getAtomicCmpSwap(unsigned Opcode, const SDLoc &dl, EVT MemVT,
|
||||
SDVTList VTs, SDValue Chain, SDValue Ptr,
|
||||
SDValue Cmp, SDValue Swp, MachineMemOperand *MMO);
|
||||
|
@ -6382,32 +6382,6 @@ SDValue SelectionDAG::getAtomic(unsigned Opcode, const SDLoc &dl, EVT MemVT,
|
||||
return SDValue(N, 0);
|
||||
}
|
||||
|
||||
SDValue SelectionDAG::getAtomicCmpSwap(
|
||||
unsigned Opcode, const SDLoc &dl, EVT MemVT, SDVTList VTs, SDValue Chain,
|
||||
SDValue Ptr, SDValue Cmp, SDValue Swp, MachinePointerInfo PtrInfo,
|
||||
unsigned Alignment, AtomicOrdering SuccessOrdering,
|
||||
AtomicOrdering FailureOrdering, SyncScope::ID SSID) {
|
||||
assert(Opcode == ISD::ATOMIC_CMP_SWAP ||
|
||||
Opcode == ISD::ATOMIC_CMP_SWAP_WITH_SUCCESS);
|
||||
assert(Cmp.getValueType() == Swp.getValueType() && "Invalid Atomic Op Types");
|
||||
|
||||
if (Alignment == 0) // Ensure that codegen never sees alignment 0
|
||||
Alignment = getEVTAlignment(MemVT);
|
||||
|
||||
MachineFunction &MF = getMachineFunction();
|
||||
|
||||
// FIXME: Volatile isn't really correct; we should keep track of atomic
|
||||
// orderings in the memoperand.
|
||||
auto Flags = MachineMemOperand::MOVolatile | MachineMemOperand::MOLoad |
|
||||
MachineMemOperand::MOStore;
|
||||
MachineMemOperand *MMO =
|
||||
MF.getMachineMemOperand(PtrInfo, Flags, MemVT.getStoreSize(), Alignment,
|
||||
AAMDNodes(), nullptr, SSID, SuccessOrdering,
|
||||
FailureOrdering);
|
||||
|
||||
return getAtomicCmpSwap(Opcode, dl, MemVT, VTs, Chain, Ptr, Cmp, Swp, MMO);
|
||||
}
|
||||
|
||||
SDValue SelectionDAG::getAtomicCmpSwap(unsigned Opcode, const SDLoc &dl,
|
||||
EVT MemVT, SDVTList VTs, SDValue Chain,
|
||||
SDValue Ptr, SDValue Cmp, SDValue Swp,
|
||||
|
@ -4405,19 +4405,34 @@ void SelectionDAGBuilder::visitMaskedGather(const CallInst &I) {
|
||||
|
||||
void SelectionDAGBuilder::visitAtomicCmpXchg(const AtomicCmpXchgInst &I) {
|
||||
SDLoc dl = getCurSDLoc();
|
||||
AtomicOrdering SuccessOrder = I.getSuccessOrdering();
|
||||
AtomicOrdering FailureOrder = I.getFailureOrdering();
|
||||
AtomicOrdering SuccessOrdering = I.getSuccessOrdering();
|
||||
AtomicOrdering FailureOrdering = I.getFailureOrdering();
|
||||
SyncScope::ID SSID = I.getSyncScopeID();
|
||||
|
||||
SDValue InChain = getRoot();
|
||||
|
||||
MVT MemVT = getValue(I.getCompareOperand()).getSimpleValueType();
|
||||
SDVTList VTs = DAG.getVTList(MemVT, MVT::i1, MVT::Other);
|
||||
SDValue L = DAG.getAtomicCmpSwap(
|
||||
ISD::ATOMIC_CMP_SWAP_WITH_SUCCESS, dl, MemVT, VTs, InChain,
|
||||
getValue(I.getPointerOperand()), getValue(I.getCompareOperand()),
|
||||
getValue(I.getNewValOperand()), MachinePointerInfo(I.getPointerOperand()),
|
||||
/*Alignment=*/ 0, SuccessOrder, FailureOrder, SSID);
|
||||
|
||||
auto Alignment = DAG.getEVTAlignment(MemVT);
|
||||
|
||||
// FIXME: Volatile isn't really correct; we should keep track of atomic
|
||||
// orderings in the memoperand.
|
||||
auto Flags = MachineMemOperand::MOVolatile | MachineMemOperand::MOLoad |
|
||||
MachineMemOperand::MOStore;
|
||||
|
||||
MachineFunction &MF = DAG.getMachineFunction();
|
||||
MachineMemOperand *MMO =
|
||||
MF.getMachineMemOperand(MachinePointerInfo(I.getPointerOperand()),
|
||||
Flags, MemVT.getStoreSize(), Alignment,
|
||||
AAMDNodes(), nullptr, SSID, SuccessOrdering,
|
||||
FailureOrdering);
|
||||
|
||||
SDValue L = DAG.getAtomicCmpSwap(ISD::ATOMIC_CMP_SWAP_WITH_SUCCESS,
|
||||
dl, MemVT, VTs, InChain,
|
||||
getValue(I.getPointerOperand()),
|
||||
getValue(I.getCompareOperand()),
|
||||
getValue(I.getNewValOperand()), MMO);
|
||||
|
||||
SDValue OutChain = L.getValue(2);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user