getInstructionName() in XXXGenAsmWriter.cpp

Is this function required?

MCInstrInfo::getName(OpCode) returns the same string, and we have two copies of the string table now.

Can MCInstrPrinter refer to MCInstrInfo, and why not?

/jakob

Is this function required?

MCInstrInfo::getName(OpCode) returns the same string, and we have two copies of the string table now.

Can MCInstrPrinter refer to MCInstrInfo, and why not?

I looked into this at some point and if my memory serves me correctly using MCInstrInfo in the printer would create a cyclic dependency between the libXXXAsmPrinter and libXXXDesc for the target. I guess libXXXDesc could be refactored not to depend on libXXXAsmPrinter but I haven't checked what exactly uses it.

- Ben

I thought it was something like that.

The AsmPrinter wouldn't need to depend on the XXXMCTargetDesc library, though. It just needs an MCInstrInfo pointer. It already has an MCRegisterInfo pointer.

The regIsInRegisterClass() function also looks like it is identical to MCRegisterClass::contains(). It it even used anywhere?

/jakob

Is this function required?

MCInstrInfo::getName(OpCode) returns the same string, and we have two copies of the string table now.

Can MCInstrPrinter refer to MCInstrInfo, and why not?

I looked into this at some point and if my memory serves me correctly using MCInstrInfo in the printer would create a cyclic dependency between the libXXXAsmPrinter and libXXXDesc for the target. I guess libXXXDesc could be refactored not to depend on libXXXAsmPrinter but I haven't checked what exactly uses it.

I thought it was something like that.

The AsmPrinter wouldn't need to depend on the XXXMCTargetDesc library, though. It just needs an MCInstrInfo pointer. It already has an MCRegisterInfo pointer.

I see. Adding a MCInstrInfo pointer to MCInstPrinter and using it to get the instruction name should be possible then. It's another object just for debug output but still a lot cheaper than having copies of the huge tables for the names.

The regIsInRegisterClass() function also looks like it is identical to MCRegisterClass::contains(). It it even used anywhere?

It seems to be used by the asm printers for x86, I replaced the few users with MCRegisterClass::contains and removed the obsolete function in r153782.

- Ben