[llvm-dev] How to access Target Register Info?

fateme Hoseini via llvm-dev llvm-dev at lists.llvm.org
Fri Apr 29 11:44:43 PDT 2016


Hi,
I am writing a register renaming pass for loops. I want to printout livein
variables at a specific basic block and find a registerset A = target
register - livein regs.
I am using the following code

for (MachineBasicBlock::livein_iterator LI = mb->livein_begin(), E =
mb->livein_end(); LI != E; ++LI){
     const TargetRegisterInfo *TRI = MF.getTarget().getRegisterInfo();
     errs() << ' ' << PrintReg(*LI,  TRI);
}

but I get the following error:
error: member access into incomplete type 'const llvm::TargetMachine' const
TargetRegisterInfo *TRI = MF.getTarget().getRegisterInfo(); ^
/home/lab154/fateme/LLVM/llvm-3.7/include/llvm/CodeGen/MachineOperand.h:31:7:
note: forward declaration of 'llvm::TargetMachine' class TargetMachine;

So what is the correct way to access TRI?
Also, I know that ARM has 13 GPRs (r0-r12). but how to get this from the
code?
I am sorry if my questions are stupid, but spend a lot of time on them and
did not find the solution.

Regards,
Fami
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160429/b645ef72/attachment.html>


More information about the llvm-dev mailing list