Hello LLVM, I'd like to check TSFlags in my AsmBackend code. However AsmBackend objects don't have a reference to MCInstrInfo, which is the only way I've seen to reach TSFlags. A quickie grep shows that none of the existing targets check TSFlags in their AsmBackends. Is there any reason I shouldn't check TSFlags in AsmBackend? If not, what's the best way to go about it? Thanks, -steve
Not clean but you could add something like this in your AsmBackend: namespace llvm { extern const MCInstrDesc XInsts[]; } static const MCInstrDesc &getInstDesc(unsigned Opcode) { return XInsts[Opcode]; } (replace X with your target) TSFlags will be in MCInstrDesc On Fri, Oct 31, 2014 at 1:51 PM, Steve King <steve at metrokings.com> wrote:> Hello LLVM, > I'd like to check TSFlags in my AsmBackend code. However AsmBackend > objects don't have a reference to MCInstrInfo, which is the only way > I've seen to reach TSFlags. A quickie grep shows that none of the > existing targets check TSFlags in their AsmBackends. Is there any > reason I shouldn't check TSFlags in AsmBackend? If not, what's the > best way to go about it? > Thanks, > -steve > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141031/9eea3e9d/attachment.html>
Thanks, Francois. Your answer was very helpful and worked fine. After some experimenting, I wrapped your approach inside a XMCInst() class defined like so: namespace llvm { class XMCInst : public MCInst { public: const MCInstrDesc& getInstrDesc() const; }; } Now, anywhere I have an MCInst I can static_cast to XMCInst and get the MCInstrDesc. Best Regards, -steve On Fri, Oct 31, 2014 at 11:16 AM, Francois Pichet <pichet2000 at gmail.com> wrote:> Not clean but you could add something like this in your AsmBackend: > > namespace llvm { > extern const MCInstrDesc XInsts[]; > } > static const MCInstrDesc &getInstDesc(unsigned Opcode) { > return XInsts[Opcode]; > } > (replace X with your target) > > TSFlags will be in MCInstrDesc > > On Fri, Oct 31, 2014 at 1:51 PM, Steve King <steve at metrokings.com> wrote: >> >> Hello LLVM, >> I'd like to check TSFlags in my AsmBackend code. However AsmBackend >> objects don't have a reference to MCInstrInfo, which is the only way >> I've seen to reach TSFlags. A quickie grep shows that none of the >> existing targets check TSFlags in their AsmBackends. Is there any >> reason I shouldn't check TSFlags in AsmBackend? If not, what's the >> best way to go about it? >> Thanks, >> -steve >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >