[PATCH] D149891: [RISCV] Add DecoderNamespace to Zcmt instructions.
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 4 12:29:26 PDT 2023
craig.topper created this revision.
craig.topper added reviewers: jrtc27, VincentWu, asb.
Herald added subscribers: jobnoorman, luke, vkmr, frasercrmck, evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya, arichardson.
Herald added a project: All.
craig.topper requested review of this revision.
Herald added subscribers: pcwang-thead, eopXD, MaskRay.
Herald added a project: LLVM.
The Zcmt instructions overlap encoding space with some C extension
instructions. Isolate to a separate namespace.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D149891
Files:
llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
llvm/lib/Target/RISCV/RISCVInstrInfoZc.td
Index: llvm/lib/Target/RISCV/RISCVInstrInfoZc.td
===================================================================
--- llvm/lib/Target/RISCV/RISCVInstrInfoZc.td
+++ llvm/lib/Target/RISCV/RISCVInstrInfoZc.td
@@ -125,8 +125,8 @@
Sched<[WriteSTH, ReadStoreData, ReadMemBase]>;
}
-let Predicates = [HasStdExtZcmt],
-hasSideEffects = 0, mayLoad = 0, mayStore = 0 in {
+let DecoderNamespace = "RVZcmt", Predicates = [HasStdExtZcmt],
+ hasSideEffects = 0, mayLoad = 0, mayStore = 0 in {
def CM_JT : RVInst16CJ<0b101, 0b10, (outs), (ins uimm5:$index),
"cm.jt", "$index">{
bits<5> index;
Index: llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
===================================================================
--- llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
+++ llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
@@ -605,6 +605,14 @@
if (Result != MCDisassembler::Fail)
return Result;
}
+ if (STI.hasFeature(RISCV::FeatureStdExtZcmt)) {
+ LLVM_DEBUG(
+ dbgs() << "Trying Zcmt table (16-bit Table Jump Instructions):\n");
+ Result = decodeInstruction(DecoderTableRVZcmt16, MI, Insn, Address,
+ this, STI);
+ if (Result != MCDisassembler::Fail)
+ return Result;
+ }
LLVM_DEBUG(dbgs() << "Trying RISCV_C table (16-bit Instruction):\n");
// Calling the auto-generated decoder function.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149891.519603.patch
Type: text/x-patch
Size: 1426 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230504/291f5be2/attachment.bin>
More information about the llvm-commits
mailing list