[PATCH] D41949: [RISCV] implement li pseudo instruction

Sameer AbuAsal via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 13 18:52:15 PDT 2018


sabuasal added inline comments.


================
Comment at: lib/Target/RISCV/MCTargetDesc/RISCVMCPseudoExpansion.cpp:44
+    if (Hi20) {
+      Out.EmitInstruction(
+          MCInstBuilder(RISCV::LUI).addReg(DestReg).addImm(Hi20), *STI);
----------------
Hi Mario @niosHD  ,

Thanks for the patch, this looks nice.

 just a small note about your comment addressing compression in case you want to update it in the future like @asb suggested.

Since you are calling your function (emitRISCVLoadImm) from the InstPrinter (RISCVAsmPrinter::EmitInstruction)  the standard way to Emit the Instructoin is by calling EmitToStreamer in your AsmPrinter. 

In other back-ends this will call ( AsmPrinter::EmitToStreamer), In RISCV, we define our own EmitToStreamer all what you have to do to support compression is calling your AsmPrinter->EmitToStreamer().




https://reviews.llvm.org/D41949





More information about the llvm-commits mailing list