[PATCH] Change MCRegisterInfo::getLLVMRegNum() not to assert on unknown register.

Frederic Riss friss at apple.com
Wed Nov 12 18:34:09 PST 2014


I want to use this method in llvm-dwarfdump to be able to pretty
print register names in dwarf expressions. As the data I'll feed
to the method comes directly from the binary file, it might be
anything and I'd like to avoid asserting when an unknown register
number is requested.

This patch makes the method return -1 when the register isn't found.
The new behavior is the same as its inverse function getDwarfRegNum.
Note that although this method returns an 'int', each and every user I
could find stores the result in an 'unsigned' variable. Would it
make sense to change the method return type to unsigned? Should the
assert be kept and propagated to the callers? Any other suggestion
to achieve what I want?

http://reviews.llvm.org/D6243

Files:
  lib/MC/MCRegisterInfo.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6243.16128.patch
Type: text/x-patch
Size: 440 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141113/78b87bef/attachment.bin>


More information about the llvm-commits mailing list