[PATCH] D57680: [llvm-objdump] Implement `-Mreg-names-raw`/`-std` options.

Eugene Leviant via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 5 05:27:48 PST 2019


evgeny777 added inline comments.


================
Comment at: lib/Target/ARM/ARMRegisterInfo.td:16
 // Registers are identified with 4-bit ID numbers.
-class ARMReg<bits<16> Enc, string n, list<Register> subregs = []> : Register<n> {
+class ARMReg<bits<16> Enc, string n, list<Register> subregs = [],
+             list<string> altNames = []> : Register<n, altNames> {
----------------
ikudrin wrote:
> evgeny777 wrote:
> > Can we simply use "r" + string(Enc) for `-Mreg-names-raw` ?
> I don't think I understand you. Could you explain where in the code you expect that line to be added?
Well, this patch is actually needed for llvm-objdump/ARM to be compatible with GNU objdump and not much else.
So instead of trying to be smart I suggest implementing the subclass of ARMInstPrinter in llvm-objdump

```
class ARMObjdumpInstPrinter : public ARMInstPrinter {
  bool DumpRaw = false;

  const char *getRegisterNameRaw(unsigned RegNo);
public:
  void printRegName(raw_ostream &OS, unsigned RegNo) const override {
     if (!DumpRaw) {
        ARMInstPrinter::printRegName(OS, RegNo);
        return;
     }
     OS << markup("<reg:") << getRegisterNameRaw(RegNo) << markup(">");
  }
};
```


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57680/new/

https://reviews.llvm.org/D57680





More information about the llvm-commits mailing list