search for: getinstrinfo

Displaying 20 results from an estimated 68 matches for "getinstrinfo".

2014 Oct 10
2
[LLVMdev] eliminateFrameIndex
...mpty programs so far. I implemented the method ::eliminateFrameIndex() similar to the Sparc and ARM backend. The method looks like this: // frame pointer is in reg of class mytarget::ARegsRegClass unsigned ScratchReg = MF.getRegInfo().createVirtualRegister(&mytarget::ARegsRegClass); const TargetInstrInfo &TII = *MF.getTarget().getInstrInfo(); BuildMI(*MI.getParent(), II, dl, TII.get(mytarget::ADD_AReg), ScratchReg).addReg(FramePtr).addImm(Offset); // Update the original instruction to use the scratch register. MI.getOperand(FIOperandNum).ChangeToRegister(ScratchReg, false); But for the test c...
2020 Nov 12
2
LLVM X86 MachineBasicBlock inserting push and pop instructions causes segmentation fault
...immediately followed by pop rcx before each basic block (only the relevant logic portions are included): /* Inserts push rcx followed by pop rcx before each MachineBasicBlock */ void VirtualTimeManager::__insertVtlLogic(MachineFunction &MF, MachineBasicBlock* origMBB) { const llvm::TargetInstrInfo &TII = *MF.getSubtarget().getInstrInfo(); auto MMI = &MF.getMMI(); llvm::Module &M = const_cast<Module &>(*MMI->getModule()); if (origMBB->empty() || !origMBB->isLegalToHoistInto()) return; llvm::BuildMI(*origMBB, origMBB->begin(), DebugLoc...
2010 Oct 20
1
[LLVMdev] MachineBasicBlock insertion
...ction::iterator I){ const BasicBlock* LLVM_BB = Pred->getBasicBlock(); MachineBasicBlock * MBB = MF.CreateMachineBasicBlock(LLVM_BB); // create a MBB MBB->setNumber(19880616); // set the number of MBB to be 19880616 which is used as an ID Pred->addSuccessor(MBB); const TargetInstrInfo *TII = MF.getTarget().getInstrInfo(); DebugLoc dl; // CALLpcrel32 abort BuildMI(MBB,dl,TII->get(X86::CALLpcrel32)).addExternalSymbol("abort"); // JNE_4 error_label BuildMI(MBB,dl,TII->get(X86::JNE_4)).addExternalSymbol("error_label"); // MOV32ri %eax, 0...
2013 Jul 16
1
[LLVMdev] Instantiating Target-Specifc ASM Parser
Hello, I am working on backend development and would like to utilize my target's MCAsmParser inside of an MCInst-level class implementation. I noticed that the AsmParser is registered with the target registry however I am having no luck grepping for a "template" of how to instantiate it and have yet to find specific documentation on how it is done. Any ideas or help is greatly
2012 Nov 29
0
[LLVMdev] [llvm-commits] RFC: Merge branches/R600 into TOT for 3.2 release
...passRep, +»······»·······»·······»·······»·······»·······»·······»·······»·······branchDL); No tabs, please. +AMDGPUCFGStructurizer::AMDGPUCFGStructurizer(char &pid, TargetMachine &tm + ) +: MachineFunctionPass(pid), TM(tm), TII(tm.getInstrInfo()), + TRI(static_cast<const AMDGPURegisterInfo *>(tm.getRegisterInfo()) + ) { +} Both right parentheses should be on previous lines. +}; //end of class AMDGPUCFGPrepare In general I don't see "end of class" and "end of function" comments in LLVM, just namespaces...
2006 Jul 09
2
[LLVMdev] Critical edges
...into the machine function. ilist<MachineBasicBlock>::iterator mbb_it = mf.getLastBlock(); ++mbb_it; mf.getBasicBlockList().insert(mbb_it, crit_mbb); /// insert a unconditional branch linking the new block to dst const TargetMachine & tm = mf.getTarget(); const TargetInstrInfo * tii = tm.getInstrInfo(); tii->insertGoto(*crit_mbb, dst); /// modify every branch in src that points to dst to point to the new /// machine basic block instead: MachineBasicBlock::iterator mii = src.end(); while (mii != src.begin()) { mii--; // if there is...
2013 Sep 25
2
[LLVMdev] Register scavenger and SP/FP adjustments
...-- void PEI::replaceFrameIndices(MachineBasicBlock *BB, MachineFunction &Fn, int &SPAdj) { const TargetMachine &TM = Fn.getTarget(); assert(TM.getRegisterInfo() && "TM::getRegisterInfo() must be implemented!"); const TargetInstrInfo &TII = *Fn.getTarget().getInstrInfo(); const TargetRegisterInfo &TRI = *TM.getRegisterInfo(); const TargetFrameLowering *TFI = TM.getFrameLowering(); bool StackGrowsDown = TFI->getStackGrowthDirection() == TargetFrameLowering::StackGrowsDown; int FrameSe...
2013 May 13
1
[LLVMdev] Problem with MachineFunctionPass and JMP
...newEntry); std::vector<MachineBasicBlock*> origBB; for(MachineFunction::iterator i = MF.begin(); i != MF.end(); ++i) origBB.push_back(i); for(unsigned int i = 0; i < origBB.size(); ++i) origBB.at(i)->moveAfter(newEntry); MCInstrInfo tii = *MF.getTarget().getInstrInfo(); MachineInstr *plop = BuildMI(MF, DebugLoc(),tii.get(X86::JMP_4)).addMBB(origBB.at(1)); newEntry->push_back(plop); return false; } And here is the resulting code (it's a simple program with some 'if'): (null) BB#4 JMP_4 <BB#0> if.end BB#3 %RDI<def> = LEA64...
2018 Sep 10
3
How to avoid multiple registers definitions in customInserter.
...my customInserter. Are there any additional actions to perform during the customInserter. MachineBasicBlock * CLPTargetLowering::emitLOpcodeHOpcode(MachineInstr &MI, MachineBasicBlock *MBB, unsigned LOpcode, unsigned HOpcode) const { const TargetInstrInfo *TII = Subtarget->getInstrInfo(); DebugLoc Loc = MI.getDebugLoc(); const MachineOperand operand0 = MI.getOperand(0); const MachineOperand operand1 = MI.getOperand(1); BuildMI(*MBB, MI, Loc, TII->get(LOpcode)) .add(operand0) .add(operand1);...
2014 Dec 08
2
[LLVMdev] Virtual register problem in X86 backend
...t the content of the stack to zero at the end of each function. Here is my code: MachineBasicBlock * X86TargetLowering::EmitBURNSTACKWithCustomInserter( MachineInstr *MI, MachineBasicBlock *MBB) const { DebugLoc db = MI->getDebugLoc(); const TargetInstrInfo *TII = getTargetMachine().getInstrInfo(); const BasicBlock *LLVM_BB = MBB->getBasicBlock(); MachineFunction *F = MBB->getParent(); // Create all the basicblocks MachineBasicBlock *MBB_cond = F->CreateMachineBasicBlock(LLVM_BB); MachineBasicBlock *MBB_erase = F->Crea...
2013 Sep 26
0
[LLVMdev] Register scavenger and SP/FP adjustments
...placeFrameIndices(MachineBasicBlock *BB, > MachineFunction &Fn, int &SPAdj) { > const TargetMachine &TM = Fn.getTarget(); > assert(TM.getRegisterInfo() && > "TM::getRegisterInfo() must be implemented!"); > const TargetInstrInfo &TII = *Fn.getTarget().getInstrInfo(); > const TargetRegisterInfo &TRI = *TM.getRegisterInfo(); > const TargetFrameLowering *TFI = TM.getFrameLowering(); > bool StackGrowsDown = > TFI->getStackGrowthDirection() == > TargetFrameLowering::StackGrowsDown;...
2020 Nov 12
0
LLVM X86 MachineBasicBlock inserting push and pop instructions causes segmentation fault
...rcx before each basic block (only > the relevant logic portions are included): > > /* Inserts push rcx followed by pop rcx before each MachineBasicBlock */ > void VirtualTimeManager::__insertVtlLogic(MachineFunction &MF, > MachineBasicBlock* origMBB) { > const llvm::TargetInstrInfo &TII = *MF.getSubtarget().getInstrInfo(); > auto MMI = &MF.getMMI(); > llvm::Module &M = const_cast<Module &>(*MMI->getModule()); > if (origMBB->empty() || !origMBB->isLegalToHoistInto()) > return; > llvm::BuildMI(*origMBB, orig...
2008 Oct 08
1
[LLVMdev] Getting target machine specific information at run-time
...get for cross-compilation by doing > > --march=sparc or --march=alpha. > > I did the once-per-module solution to this exact problem. Here's what it > looks like: > > class RA { > const TargetMachine* tm_; > const TargetRegisterInfo* tri_; > const TargetInstrInfo * tii_; > [...] > bool RA::runOnMachineFunction(MachineFunction &fn) { > mf_ = &fn; > tm_ = &fn.getTarget(); > tri_ = tm_->getRegisterInfo(); > tii_ = tm_->getInstrInfo(); > > if (!initialized) { > build_class_tree(); > initialized...
2017 Apr 27
4
-msave-args backend support for x86_64
...ery function. unsigned stackAlignment; + /// Whether function prologues should save register arguments on the stack. + bool SaveArgs; + /// Max. memset / memcpy size that is turned into rep/movs, rep/stos ops. /// unsigned MaxInlineSizeThreshold; @@ -356,6 +359,8 @@ return &getInstrInfo()->getRegisterInfo(); } + bool getSaveArgs() const { return SaveArgs; } + /// Returns the minimum alignment known to hold of the /// stack frame on entry to the function and which must be maintained by every /// function for this subtarget.
2006 Jul 09
0
[LLVMdev] Critical edges
...> ilist<MachineBasicBlock>::iterator mbb_it = mf.getLastBlock(); > ++mbb_it; > mf.getBasicBlockList().insert(mbb_it, crit_mbb); > > /// insert a unconditional branch linking the new block to dst > const TargetMachine & tm = mf.getTarget(); > const TargetInstrInfo * tii = tm.getInstrInfo(); > tii->insertGoto(*crit_mbb, dst); > > /// modify every branch in src that points to dst to point to the new > /// machine basic block instead: > MachineBasicBlock::iterator mii = src.end(); > while (mii != src.begin()) { > mi...
2010 Oct 20
1
[LLVMdev] MachineBasicBlock insertion and use/def list update
...getBasicBlock(); >> MachineBasicBlock * MBB = MF.CreateMachineBasicBlock(LLVM_BB); // >> create a MBB >> MBB->setNumber(19880616); // set the number of MBB to be 19880616 >> which is used as an ID >> >> Pred->addSuccessor(MBB); >> const TargetInstrInfo *TII = MF.getTarget().getInstrInfo(); >> DebugLoc dl; >> // CALLpcrel32 abort >> BuildMI(MBB,dl,TII->get(X86::CALLpcrel32)).addExternalSymbol("abort"); >> // JNE_4 error_label >> BuildMI(MBB,dl,TII->get(X86::JNE_4)).addExternalSymbol(&quo...
2014 Oct 28
2
[LLVMdev] Problem in X86 backend (again)
...of my custom inserter... The goal of this code is to erase the stack in the epilogue of a function: MachineBasicBlock * X86TargetLowering::EmitBURNSTACKWithCustomInserter( MachineInstr *MI, MachineBasicBlock *MBB) const { MBB->getParent()->dump(); DebugLoc db = MI->getDebugLoc(); const TargetInstrInfo *TII = getTargetMachine().getInstrInfo(); const BasicBlock *LLVM_BB = MBB->getBasicBlock(); MachineFunction *F = MBB->getParent(); // Create all the basicblocks MachineBasicBlock *MBB_cond = F->CreateMachineBasicBlock(LLVM_BB); MachineBasicBlock *MBB_erase = F->CreateMachineBasicBlock(L...
2008 Jan 27
0
[LLVMdev] BreakCriticalMachineEdge.h
...l edges in machine > functions? I > just compiled the top of the LLVM tree, and I found > llvm/CodeGen/BreakCriticalMachineEdge.h. But this file seems not to be > up-to-date with the other classes in the top of the tree. For > instance, it > calls isTerminatorInstr on llvm::TargetInstrInfo, but this method is > no > longer there. > If I want to break critical edges of machine basic blocks, does > LLVM > 2.2 give me something to work with? > > best, > > Fernando > _______________________________________________ > LLVM Developers mailing list &g...
2012 Nov 29
3
[LLVMdev] [llvm-commits] RFC: Merge branches/R600 into TOT for 3.2 release
...····»·······»·······»·······»·······»·······»·······»·······»·······branchDL); > > No tabs, please. > > +AMDGPUCFGStructurizer::AMDGPUCFGStructurizer(char &pid, TargetMachine &tm > + ) > +: MachineFunctionPass(pid), TM(tm), TII(tm.getInstrInfo()), > + TRI(static_cast<const AMDGPURegisterInfo *>(tm.getRegisterInfo()) > + ) { > +} > > Both right parentheses should be on previous lines. > > +}; //end of class AMDGPUCFGPrepare > > In general I don't see "end of class" and "end of fun...
2008 Jan 27
2
[LLVMdev] BreakCriticalMachineEdge.h
...the status of breaking critical edges in machine functions? I just compiled the top of the LLVM tree, and I found llvm/CodeGen/BreakCriticalMachineEdge.h. But this file seems not to be up-to-date with the other classes in the top of the tree. For instance, it calls isTerminatorInstr on llvm::TargetInstrInfo, but this method is no longer there. If I want to break critical edges of machine basic blocks, does LLVM 2.2 give me something to work with? best, Fernando