Skip to content

Commit 025c920

Browse files
committed
[RISCV] Replace multiple ifs with a switch. NFC
D108961 will add more instructions to this.
1 parent 09a3aef commit 025c920

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,16 +189,17 @@ void RISCVMCCodeEmitter::encodeInstruction(const MCInst &MI, raw_ostream &OS,
189189
// RISCVInstrInfo::getInstSizeInBytes expects that the total size of the
190190
// expanded instructions for each pseudo is correct in the Size field of the
191191
// tablegen definition for the pseudo.
192-
if (MI.getOpcode() == RISCV::PseudoCALLReg ||
193-
MI.getOpcode() == RISCV::PseudoCALL ||
194-
MI.getOpcode() == RISCV::PseudoTAIL ||
195-
MI.getOpcode() == RISCV::PseudoJump) {
192+
switch (MI.getOpcode()) {
193+
default:
194+
break;
195+
case RISCV::PseudoCALLReg:
196+
case RISCV::PseudoCALL:
197+
case RISCV::PseudoTAIL:
198+
case RISCV::PseudoJump:
196199
expandFunctionCall(MI, OS, Fixups, STI);
197200
MCNumEmitted += 2;
198201
return;
199-
}
200-
201-
if (MI.getOpcode() == RISCV::PseudoAddTPRel) {
202+
case RISCV::PseudoAddTPRel:
202203
expandAddTPRel(MI, OS, Fixups, STI);
203204
MCNumEmitted += 1;
204205
return;

0 commit comments

Comments
 (0)