[PATCH] D146955: [Xtensa] Implement volatile load/store.
Andrei Safronov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 27 05:41:18 PDT 2023
andreisfr created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
andreisfr requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Implement volatile load/store from/to volatile memory location.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D146955
Files:
llvm/lib/Target/Xtensa/XtensaISelLowering.cpp
llvm/lib/Target/Xtensa/XtensaInstrInfo.td
Index: llvm/lib/Target/Xtensa/XtensaInstrInfo.td
===================================================================
--- llvm/lib/Target/Xtensa/XtensaInstrInfo.td
+++ llvm/lib/Target/Xtensa/XtensaInstrInfo.td
@@ -216,7 +216,7 @@
//===----------------------------------------------------------------------===//
// Load instructions
-let mayLoad = 1 in {
+let mayLoad = 1, usesCustomInserter = 1 in {
class Load_RRI8<bits<4> oper, string instrAsm, SDPatternOperator opNode,
ComplexPattern addrOp, Operand memOp>
@@ -237,7 +237,7 @@
def L32I : Load_RRI8<0x02, "l32i", load, addr_ish4, mem32>;
// Store instructions
-let mayStore = 1 in {
+let mayStore = 1, usesCustomInserter = 1 in {
class Store_II8<bits<4> oper, string instrAsm, SDPatternOperator opNode,
ComplexPattern addrOp, Operand memOp>
: RRI8_Inst<0x02, (outs), (ins AR:$t, memOp:$addr),
Index: llvm/lib/Target/Xtensa/XtensaISelLowering.cpp
===================================================================
--- llvm/lib/Target/Xtensa/XtensaISelLowering.cpp
+++ llvm/lib/Target/Xtensa/XtensaISelLowering.cpp
@@ -1472,6 +1472,11 @@
const TargetRegisterClass *RC = getRegClassFor(MVT::i32);
unsigned R1 = MRI.createVirtualRegister(RC);
+ const MachineMemOperand &MMO = **MI.memoperands_begin();
+ if (MMO.isVolatile()) {
+ BuildMI(*MBB, MI, DL, TII.get(Xtensa::MEMW));
+ }
+
BuildMI(*MBB, MI, DL, TII.get(Xtensa::L8UI), R1).add(Op1).add(Op2);
unsigned R2 = MRI.createVirtualRegister(RC);
@@ -1482,6 +1487,19 @@
MI.eraseFromParent();
return MBB;
}
+ case Xtensa::S8I:
+ case Xtensa::S16I:
+ case Xtensa::S32I:
+ case Xtensa::L8UI:
+ case Xtensa::L16SI:
+ case Xtensa::L16UI:
+ case Xtensa::L32I: {
+ const MachineMemOperand &MMO = **MI.memoperands_begin();
+ if (MMO.isVolatile()) {
+ BuildMI(*MBB, MI, DL, TII.get(Xtensa::MEMW));
+ }
+ return MBB;
+ }
default:
llvm_unreachable("Unexpected instr type to insert");
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146955.508604.patch
Type: text/x-patch
Size: 1998 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230327/aca4119e/attachment.bin>
More information about the llvm-commits
mailing list