I have a question regarding implementation of subclasses of MCInstPrinter.<br>I am implementing Machine IR layer to MC layer lowering for Mips.<br> <br>What's the best way to print the value of "Register" in the following code in MCAsmStreamer::EmitRegisterName? Do I have to convert the LLVM register number back to its corresponding dwarf register number in function InstPrinter->printRegName? I just want to have it output the same register number as before (the same output the false path would produce). <br>
<br>void MCAsmStreamer::EmitRegisterName(int64_t Register) {<br>  if (InstPrinter) {<br>    const TargetAsmInfo &asmInfo = getContext().getTargetAsmInfo();<br>    unsigned LLVMRegister = asmInfo.getLLVMRegNum(Register, true);<br>
    InstPrinter->printRegName(OS, LLVMRegister);<br>  } else {<br>    OS << Register;<br>  }<br>}<br><br>My current implementation of printRegName which I copied from other backends (X86, ARM and PowerPC) looks like this:<br>
<br>void MipsInstPrinter::printRegName(raw_ostream &OS, unsigned RegNo) const {<br>  OS << getRegisterName(RegNo);<br>}<br><br>This will result in code like this <br>.cfi_offset RA, -4<br>
, instead of something like this:<br>.cfi_offset 31, -4<br><br>