[llvm] d0828c5 - [RISCV][NFC] Use addExpr() instead of createExpr()

via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 13 19:48:48 PDT 2022


Author: wangpc
Date: 2022-04-14T10:48:25+08:00
New Revision: d0828c5af9cedf13e41b92a94a8e4e0417a8cd27

URL: https://github.com/llvm/llvm-project/commit/d0828c5af9cedf13e41b92a94a8e4e0417a8cd27
DIFF: https://github.com/llvm/llvm-project/commit/d0828c5af9cedf13e41b92a94a8e4e0417a8cd27.diff

LOG: [RISCV][NFC] Use addExpr() instead of createExpr()

It seems to be neater.

Reviewed By: asb

Differential Revision: https://reviews.llvm.org/D123675

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp
index 438e6933e1c11..7c062387fecda 100644
--- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp
+++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp
@@ -132,9 +132,7 @@ void RISCVMCCodeEmitter::expandFunctionCall(const MCInst &MI, raw_ostream &OS,
   const MCExpr *CallExpr = Func.getExpr();
 
   // Emit AUIPC Ra, Func with R_RISCV_CALL relocation type.
-  TmpInst = MCInstBuilder(RISCV::AUIPC)
-                .addReg(Ra)
-                .addOperand(MCOperand::createExpr(CallExpr));
+  TmpInst = MCInstBuilder(RISCV::AUIPC).addReg(Ra).addExpr(CallExpr);
   Binary = getBinaryCodeForInstr(TmpInst, Fixups, STI);
   support::endian::write(OS, Binary, support::little);
 


        


More information about the llvm-commits mailing list