Stephen Checkoway
2013-Oct-28 18:23 UTC
[LLVMdev] Are Opcode and register mappings exposed anywhere?
On Oct 28, 2013, at 2:02 PM, Tyler Hardin <tghardin1 at catamount.wcu.edu> wrote:> See the source here: https://github.com/earl/llvm-mirror/blob/master/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp. It looks like getRegisterName might do what you want, but I don't know where it's coming from. (Whether it's a function or a member of a super class. Hopefully, if it's a member, it's public.)Looks like X86ATTInstPrinter::getRegisterName() and X86IntelInstPrinter::getRegisterName() are static, public members. It would still be handy to expose an enum somewhere. This is to support something like: if (Inst.getOpcode() == X86::CALL64r) { if (Inst.getOperand(0).getReg() == X86::RIP) { // ... } } E.g., exposing some of the tablegened enums in X86GenRegisterInfo.inc and X86GenInstrInfo.inc would be very handy. Steve> > > On Oct 28, 2013 12:03 PM, "Stephen Checkoway" <s at pahtak.org> wrote: > I'm iterating over MCInsts and I'd like to examine particular instructions. For example, I'd like to look at all x86 CALL64m instructions. I may be missing something, but it seems like my only option is to use MCInstPrinter::getOpcodeName and compare strings. (Of course, I could iterate through the opcodes and build up a table of the ones I'm interested in to avoid string comparisons.) > > Register mappings to names seem to be even worse. It appears you have to go through MCInstPrinter::printRegName(raw_ostream&, unsigned). > > Is there a better way? > > -- > Stephen Checkoway > > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-- Stephen Checkoway
Craig Topper
2013-Oct-29 03:18 UTC
[LLVMdev] Are Opcode and register mappings exposed anywhere?
Can't you just include the generated files? What different way would you like them exposed? On Mon, Oct 28, 2013 at 11:23 AM, Stephen Checkoway <s at pahtak.org> wrote:> > On Oct 28, 2013, at 2:02 PM, Tyler Hardin <tghardin1 at catamount.wcu.edu> > wrote: > > > See the source here: > https://github.com/earl/llvm-mirror/blob/master/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp. > It looks like getRegisterName might do what you want, but I don't know > where it's coming from. (Whether it's a function or a member of a super > class. Hopefully, if it's a member, it's public.) > > Looks like X86ATTInstPrinter::getRegisterName() and > X86IntelInstPrinter::getRegisterName() are static, public members. It would > still be handy to expose an enum somewhere. This is to support something > like: > > if (Inst.getOpcode() == X86::CALL64r) { > if (Inst.getOperand(0).getReg() == X86::RIP) { > // ... > } > } > > E.g., exposing some of the tablegened enums in X86GenRegisterInfo.inc and > X86GenInstrInfo.inc would be very handy. > > Steve > > > > > > > On Oct 28, 2013 12:03 PM, "Stephen Checkoway" <s at pahtak.org> wrote: > > I'm iterating over MCInsts and I'd like to examine particular > instructions. For example, I'd like to look at all x86 CALL64m > instructions. I may be missing something, but it seems like my only option > is to use MCInstPrinter::getOpcodeName and compare strings. (Of course, I > could iterate through the opcodes and build up a table of the ones I'm > interested in to avoid string comparisons.) > > > > Register mappings to names seem to be even worse. It appears you have to > go through MCInstPrinter::printRegName(raw_ostream&, unsigned). > > > > Is there a better way? > > > > -- > > Stephen Checkoway > > > > > > > > > > _______________________________________________ > > LLVM Developers mailing list > > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > -- > Stephen Checkoway > > > > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-- ~Craig -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131028/59828f93/attachment.html>
Stephen Checkoway
2013-Oct-29 04:02 UTC
[LLVMdev] Are Opcode and register mappings exposed anywhere?
On Oct 28, 2013, at 11:18 PM, Craig Topper <craig.topper at gmail.com> wrote:> Can't you just include the generated files? What different way would you like them exposed?It would be handy if they were installed along with the headers. Otherwise relying on them requires building LLVM and linking against that particular version of the libraries. That's all I meant by exposed. -- Stephen Checkoway
Possibly Parallel Threads
- [LLVMdev] Are Opcode and register mappings exposed anywhere?
- [LLVMdev] Are Opcode and register mappings exposed anywhere?
- [LLVMdev] Are Opcode and register mappings exposed anywhere?
- [LLVMdev] MCInstPrinter::printRegName
- [LLVMdev] Proposal: release MDNodes for source modules (LTO+debug info)