I have a question regarding implementation of subclasses of MCInstPrinter.
I am implementing Machine IR layer to MC layer lowering for Mips.
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).
void MCAsmStreamer::EmitRegisterName(int64_t Register) {
if (InstPrinter) {
const TargetAsmInfo &asmInfo = getContext().getTargetAsmInfo();
unsigned LLVMRegister = asmInfo.getLLVMRegNum(Register, true);
InstPrinter->printRegName(OS, LLVMRegister);
} else {
OS << Register;
}
}
My current implementation of printRegName which I copied from other backends
(X86, ARM and PowerPC) looks like this:
void MipsInstPrinter::printRegName(raw_ostream &OS, unsigned RegNo) const {
OS << getRegisterName(RegNo);
}
This will result in code like this
.cfi_offset RA, -4
, instead of something like this:
.cfi_offset 31, -4
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20110706/50c883c9/attachment.html>