================
@@ -133,10 +133,16 @@ void RISCVInstPrinter::printCSRSystemRegister(const 
MCInst *MI, unsigned OpNo,
                                               raw_ostream &O) {
   unsigned Imm = MI->getOperand(OpNo).getImm();
   auto Range = RISCVSysReg::lookupSysRegByEncoding(Imm);
+  bool PreferFeatureSpecific = llvm::any_of(Range, [&](const auto &Reg) {
----------------
zeyi2 wrote:

On why I modified this file:

I previously removed `FeaturesRequired` from `mspcs` and `sspcs` as suggested. 
And I found that it exposed an encoding collision with the SiFive CLIC CSRs 
`sf.mscratchcswl` and `sf.sscratchcswl`.

Although they use the same CSR encodings, they are not semantic aliases, so 
`AltSysRegName` does not seem appropriate. This change makes the printer prefer 
a feature-specific CSR name when its required feature is enabled, and otherwise 
fall back to the standard CSR name.

Does that seem like the appropriate way to handle the collision?


https://github.com/llvm/llvm-project/pull/211712
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to