fateme Hoseini via llvm-dev
2016-Apr-29 18:44 UTC
[llvm-dev] How to access Target Register Info?
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>
Krzysztof Parzyszek via llvm-dev
2016-Apr-29 19:00 UTC
[llvm-dev] How to access Target Register Info?
On 4/29/2016 1:44 PM, fateme Hoseini via llvm-dev wrote:> > 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); > } >TargetRegisterInfo is now in the TargetSubtargetInfo. So you need to do auto *TRI = MF.getSubtarget<yourtarget>().getRegisterInfo(); -Krzysztof -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation