Displaying 20 results from an estimated 55 matches for "getbasicblocklist".
2011 Feb 28
3
[LLVMdev] Extending FunctionType
...new
> parameter and then clone the body of the old main() function into the new
> main() function.
I don't think a full clone is necessary, since he wants to replace the
function. He only needs to create the new function and splice in the
body of the old one.
Gabriel: look at Function::getBasicBlockList() and
iplist<>::splice(iterator, iplist). Something like
Function *NewF = Function::Create(NewFnType, OldF->getLinkage());
NewF->getBasicBlockList().splice(NewF->begin(), OldF->getBasicBlockList());
NewF->takeName(OldF);
OldF->eraseFromParent();
is probably what you&...
2011 Feb 28
2
[LLVMdev] Extending FunctionType
...ments to main(), implying the
old function didn't have any arguments. But for a general function
it'd be easy enough to call replaceAllUsesWith() on each old argument,
since there's no need to worry about preserving the integrity of the
old function.
>> Gabriel: look at Function::getBasicBlockList() and
>> iplist<>::splice(iterator, iplist). Something like
>> Function *NewF = Function::Create(NewFnType, OldF->getLinkage());
>> NewF->getBasicBlockList().splice(NewF->begin(),
>> OldF->getBasicBlockList());
>> NewF->takeName(OldF);
>&g...
2011 Feb 28
0
[LLVMdev] Extending FunctionType
...n in the new function. The old function
can be removed afterward if desired.
I'm not sure if the code below would work. I don't see a mechanism that
updates instructions that use the old function's arguments to use the
new function's arguments.
> Gabriel: look at Function::getBasicBlockList() and
> iplist<>::splice(iterator, iplist). Something like
> Function *NewF = Function::Create(NewFnType, OldF->getLinkage());
> NewF->getBasicBlockList().splice(NewF->begin(), OldF->getBasicBlockList());
> NewF->takeName(OldF);
> OldF->eraseFromPa...
2011 Sep 21
1
[LLVMdev] Segmentation fault while adding an addtional argument
...The below is a part of my code and generate segmentation fault. Can you help
me to fix it?
Thanks,
Shawn
// Since we have now created the new function, splice the body of the
old
// function right into the new function, leaving the old rotting hulk of
the
// function empty.
NF->getBasicBlockList().splice(NF->begin(), F.getBasicBlockList());
Value *Globals = NF->arg_end();
Globals->setName("globals");
==========================================================
150 Globals->setName("globals");
(gdb)
Program received signal SIGSEGV, Segmentatio...
2018 Dec 09
2
Parse LLVM IR
...).begin();
iter1 != m->getFunctionList().end(); iter1++) {
Function &f = *iter1;
std::cout << " Function: " << std::endl;
std::cout << " Function: " << f.getName().str() << std::endl;
for (auto iter2 = f.getBasicBlockList().begin();
iter2 != f.getBasicBlockList().end(); iter2++) {
BasicBlock &bb = *iter2;
std::cout << " BasicBlock: " << bb.getName().str() << std::endl;
for (auto iter3 = bb.begin(); iter3 != bb.end(); iter3++) {...
2008 Jul 08
0
[LLVMdev] Implementing llvm.atomic.cmp.swap.i32 on PowerPC
PPCTargetLowering::EmitInstrWithCustomInserter has a reference
to the current MachineFunction for other purposes. Can you use
MachineFunction::getRegInfo instead?
Dan
On Jul 8, 2008, at 1:56 PM, Gary Benson wrote:
> Would it be acceptable to change MachineInstr::getRegInfo from private
> to public so I can use it from
> PPCTargetLowering::EmitInstrWithCustomInserter?
>
>
2011 Feb 28
0
[LLVMdev] Extending FunctionType
On 2/28/11 6:31 AM, Gabriel RodrÃguez wrote:
> Hi all,
>
> I am trying to extend a FunctionType to include new parameters. In
> particular, I want to
> ensure that the main function has been declared with both argsc and
> argsv. However
> there seems to be no easy way to accomplish this:
> llvm::Function::getFunctionType() returns a
> a reference to a const object,
2008 Jul 10
0
[LLVMdev] Implementing llvm.atomic.cmp.swap.i32 on PowerPC
Just cast both values to const TargetRegisterClass*.
Evan
On Jul 10, 2008, at 7:36 AM, Gary Benson wrote:
> Evan Cheng wrote:
>> How about?
>>
>> const TargetRegisterClass *RC = is64Bit ? &PPC:GPRCRegClass :
>> &PPC:G8RCRegClass;
>> unsigned TmpReg = RegInfo.createVirtualRegister(RC);
>
> I tried something like that yesterday:
>
> const
2008 Jul 10
2
[LLVMdev] Implementing llvm.atomic.cmp.swap.i32 on PowerPC
Evan Cheng wrote:
> How about?
>
> const TargetRegisterClass *RC = is64Bit ? &PPC:GPRCRegClass :
> &PPC:G8RCRegClass;
> unsigned TmpReg = RegInfo.createVirtualRegister(RC);
I tried something like that yesterday:
const TargetRegisterClass *RC =
is64bit ? &PPC::GPRCRegClass : &PPC::G8RCRegClass;
but I kept getting this error no matter how I arranged it:
2008 Jun 30
0
[LLVMdev] Implementing llvm.atomic.cmp.swap.i32 on PowerPC
You need to insert new basic blocks and update CFG to accomplish this.
There is a hackish way to do this right now. Add a pseudo instruction
to represent this operation and mark it usesCustomDAGSchedInserter.
This means the intrinsic is mapped to a single (pseudo) node. But it
is then expanded into instructions that can span multiple basic
blocks. See
2008 Jul 09
2
[LLVMdev] Implementing llvm.atomic.cmp.swap.i32 on PowerPC
...LVM_BB);
- MachineBasicBlock *sinkMBB = new MachineBasicBlock(LLVM_BB);
- unsigned SelectPred = MI->getOperand(4).getImm();
- BuildMI(BB, TII->get(PPC::BCC))
- .addImm(SelectPred).addReg(MI->getOperand(1).getReg()).addMBB(sinkMBB);
- MachineFunction *F = BB->getParent();
- F->getBasicBlockList().insert(It, copy0MBB);
- F->getBasicBlockList().insert(It, sinkMBB);
- // Update machine-CFG edges by transferring all successors of the current
- // block to the new block which will contain the Phi node for the select.
- sinkMBB->transferSuccessors(BB);
- // Next, add the true and fal...
2008 Jul 08
2
[LLVMdev] Implementing llvm.atomic.cmp.swap.i32 on PowerPC
Would it be acceptable to change MachineInstr::getRegInfo from private
to public so I can use it from PPCTargetLowering::EmitInstrWithCustomInserter?
Cheers,
Gary
Evan Cheng wrote:
> Look for createVirtualRegister. These are examples in
> PPCISelLowering.cpp.
>
> Evan
> On Jul 8, 2008, at 8:24 AM, Gary Benson wrote:
>
> > Hi Evan,
> >
> > Evan Cheng wrote:
2008 Jun 30
2
[LLVMdev] Implementing llvm.atomic.cmp.swap.i32 on PowerPC
Chris Lattner wrote:
> On Jun 27, 2008, at 8:27 AM, Gary Benson wrote:
> > def CMP_UNRESw : Pseudo<(outs), (ins GPRC:$rA, GPRC:$rB, i32imm:
> > $label),
> > "cmpw $rA, $rB\n\tbne- La${label}_exit",
> > [(PPCcmp_unres GPRC:$rA, GPRC:$rB, imm:
> > $label)]>;
> > }
> >
> > ...and
2011 Feb 28
2
[LLVMdev] Extending FunctionType
Hi all,
I am trying to extend a FunctionType to include new parameters. In particular, I want to
ensure that the main function has been declared with both argsc and argsv. However
there seems to be no easy way to accomplish this: llvm::Function::getFunctionType() returns a
a reference to a const object, while modifying only the argument list yields an error during verification
since the
2008 Jul 02
2
[LLVMdev] Implementing llvm.atomic.cmp.swap.i32 on PowerPC
...LVM_BB);
- MachineBasicBlock *sinkMBB = new MachineBasicBlock(LLVM_BB);
- unsigned SelectPred = MI->getOperand(4).getImm();
- BuildMI(BB, TII->get(PPC::BCC))
- .addImm(SelectPred).addReg(MI->getOperand(1).getReg()).addMBB(sinkMBB);
- MachineFunction *F = BB->getParent();
- F->getBasicBlockList().insert(It, copy0MBB);
- F->getBasicBlockList().insert(It, sinkMBB);
- // Update machine-CFG edges by transferring all successors of the current
- // block to the new block which will contain the Phi node for the select.
- sinkMBB->transferSuccessors(BB);
- // Next, add the true and fal...
2010 Jan 13
2
[LLVMdev] How to create forward reference to BasicBlock?
...o I can create a forward reference to a block that's position in
the function is not yet known.
I've tried:
Function function
Builder builder;
bb = BasicBlock::Create(function,...)
bb.eraseFromParent()
...
add other blocks to function and build instructions in those blocks
...
function.getBasicBlockList.push_back(bb)
but I get an assert failure from push_back:
t1: SymbolTableListTraitsImpl.h:68: void
llvm::SymbolTableListTraits<ValueSubClass,
ItemParentClass>::addNodeToList(ValueSubClass*) [with ValueSubClass =
llvm::BasicBlock, ItemParentClass = llvm::Function]: Assertion
`V->getParen...
2008 Sep 13
3
[LLVMdev] Duplicate Function with duplicated Arguments
I'm now writing a pass and I wanna ask a question about how to
duplicate the function and add duplicated arguments in llvm, for
example:
func(int a, char *b) -> func(int a, char *b, int a1, char *b1)
I'm now stuck at using "getOrInsertFunction" and how to handle
"getArgumentList", please share your opinion, thanks a lot!
James
2004 Aug 17
5
[LLVMdev] JIT API example (fibonacci)
...ist().push_back(new ReturnInst(Add));
> > }
> >
> > // Create a branch on the SetCond
> > BranchInst* br_inst =
> > new BranchInst( true_bb, exit_bb, CondInst );
> >
> > BB->getInstList().push_back( br_inst );
> > FibF->getBasicBlockList().push_back(true_bb);
> > FibF->getBasicBlockList().push_back(exit_bb);
> > }
> >
> > // Now we going to create JIT
> > ExistingModuleProvider* MP = new ExistingModuleProvider(M);
> > ExecutionEngine* EE = ExecutionEngine::create( MP, false );
>...
2010 Jun 13
2
[LLVMdev] Block management
Hi,
In my code generator, I need to prepare a block and add instructions to it, then insert this block in a function defined later (that is I cannot create the function at the beginning stage become some info are not available yet). I tried to create a block without any "parent" (BasicBlock::Create(getGlobalContext(), "init"), fill it, but how to link it with the created
2010 Jun 13
0
[LLVMdev] Block management
...o create a block without any "parent" (BasicBlock::Create(getGlobalContext(), "init"), fill it, but how to link it with the created function? (i read about "moveBefore" and "moveAfter" but these methods are not usable in this context...
You can use Function::getBasicBlockList(). That list supports fully general list operations like "insert", so you can just plop it in wherever you'd like it.
-Chris