[llvm] r363486 - [RISCV] Simplify RISCVAsmBackend::writeNopData(). NFC
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 14 23:14:15 PDT 2019
Author: maskray
Date: Fri Jun 14 23:14:15 2019
New Revision: 363486
URL: http://llvm.org/viewvc/llvm-project?rev=363486&view=rev
Log:
[RISCV] Simplify RISCVAsmBackend::writeNopData(). NFC
Modified:
llvm/trunk/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
Modified: llvm/trunk/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp?rev=363486&r1=363485&r2=363486&view=diff
==============================================================================
--- llvm/trunk/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp (original)
+++ llvm/trunk/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp Fri Jun 14 23:14:15 2019
@@ -162,16 +162,12 @@ bool RISCVAsmBackend::writeNopData(raw_o
return false;
// The canonical nop on RISC-V is addi x0, x0, 0.
- uint64_t Nop32Count = Count / 4;
- for (uint64_t i = Nop32Count; i != 0; --i)
+ for (; Count >= 4; Count -= 4)
OS.write("\x13\0\0\0", 4);
// The canonical nop on RVC is c.nop.
- if (HasStdExtC) {
- uint64_t Nop16Count = (Count - Nop32Count * 4) / 2;
- for (uint64_t i = Nop16Count; i != 0; --i)
- OS.write("\x01\0", 2);
- }
+ if (Count && HasStdExtC)
+ OS.write("\x01\0", 2);
return true;
}
More information about the llvm-commits
mailing list