Displaying 20 results from an estimated 400 matches similar to: "[LLVMdev] Split MachineBasicBlocks"
2009 Aug 03
0
[LLVMdev] code-altering Passes for llc
Does the error function *have* to be auto-generated in your pass?
Perhaps the original code should use invokes, and your pass insert the
error check with a jne to the "unwind" block.
On Mon, Aug 3, 2009 at 5:18 AM, Artjom
Kochtchi<artjom.kochtchi at googlemail.com> wrote:
>
>
> Dan Gohman-2 wrote:
>>
>> You don't need a ModulePass to modify a CFG. A
2009 Jul 08
0
[LLVMdev] Selection of multiple instructions
On Jul 8, 2009, at 10:16 AM, Artjom Kochtchi wrote:
>
> Hi,
>
> I'm currently trying to modify LLVM to include runtime checks into X86
> binaries. I've looked into some of the possibilities during the phases
> happening in LLVM and have the impression that inserting runtime
> checks
> during selection would be great, since lots of optimizations are
> already
2009 Jul 08
2
[LLVMdev] Selection of multiple instructions
Hi,
I'm currently trying to modify LLVM to include runtime checks into X86
binaries. I've looked into some of the possibilities during the phases
happening in LLVM and have the impression that inserting runtime checks
during selection would be great, since lots of optimizations are already
done and I can work directly with X86 instructions.
I've read through the documentation for
2009 Aug 02
2
[LLVMdev] code-altering Passes for llc
Greetinigs,
I am extending llc to include runtime checks for calls (in X86). So a call
'call target' is altered to look like this:
[some check]
jne error_function
call target
I've done this by implementing a MachineFunctionPass that is instantiated
and added to the PassManager in X86TargetMachine::addPreRegAlloc.
In order to create the jne-instruction I need some BasicBlock
2009 Aug 02
0
[LLVMdev] code-altering Passes for llc
On Aug 2, 2009, at 7:09 AM, Artjom Kochtchi wrote:
>
> Greetinigs,
>
> I am extending llc to include runtime checks for calls (in X86). So
> a call
> 'call target' is altered to look like this:
>
> [some check]
> jne error_function
> call target
>
> I've done this by implementing a MachineFunctionPass that is
> instantiated
> and added
2009 Sep 06
0
[LLVMdev] How to differentiate between external and internal calls in llc?
I have a MachineFunctionPass plugged into llc during
LLVMTargetMachine::addPreRegAlloc. In this Pass I need to extend calls (i.
e. CALL32m, CALL32r) iff they call function within the program.
CALL32m has, I think, ten different possibilities for the four operands
giving the target address. At the moment I have excluded calls that give the
displacement as GlobalAddress or JumpTableIndex
2009 Aug 06
2
[LLVMdev] code-altering Passes for llc
Kenneth Uildriks wrote:
>
> Does the error function *have* to be auto-generated in your pass?
> Perhaps the original code should use invokes, and your pass insert the
> error check with a jne to the "unwind" block.
>
If I understand correctly, unwind is some kind of exception handling in LLVM
IR? I'm not sure if this is the right thing.
First, I include runtime
2009 Aug 06
0
[LLVMdev] code-altering Passes for llc
On Aug 6, 2009, at 5:45 AM, Artjom Kochtchi wrote:
> So I was searching for a possibility to include an additional
> (Machine)BasicBlock (or rather a MachineFunction?) somewhere in the
> program
> that contains the program termination and that I can jump to on check
> failure. Can't I do that during a Pass in llc?
If you just have a magic block of instructions you want to
2009 Jun 29
2
[LLVMdev] Inserting nodes into SelectionDAG (X86)
Sorry to ask again, but I still can't get it right.
The following code compiles and runs, but produces no instructions:
Ops.push_back(DAG.getRegister(X86::EAX, MVT::i32));
Ops.push_back(DAG.getConstant(1, MVT::i32));
DAG.getNode(ISD::ADD, DAG.getVTList(MVT::i32), &Ops[0], Ops.size());
I reckon that has something to do with the fact that I am not using the
Chain object. But as soon
2009 Jul 03
0
[LLVMdev] Inserting nodes into SelectionDAG (X86)
Thanks to your help I've actually made some progress... Especially the
SelectionDAGNodes.h was a good hint.
But there are still some things that I can't figure out:
// 'mov eax, 41'
Chain = DAG.getCopyToReg(Chain, DAG.getRegister(X86::EAX, MVT::i32),
DAG.getConstant(41, MVT::i32), InFlag);
InFlag = Chain.getValue(1);
// 'inc eax'
SDValue eaxVal =
2009 Jul 01
0
[LLVMdev] Inserting nodes into SelectionDAG (X86)
On Jun 29, 2009, at 9:00 AM, Artjom Kochtchi wrote:
>
> Sorry to ask again, but I still can't get it right.
>
> The following code compiles and runs, but produces no instructions:
> Ops.push_back(DAG.getRegister(X86::EAX, MVT::i32));
> Ops.push_back(DAG.getConstant(1, MVT::i32));
> DAG.getNode(ISD::ADD, DAG.getVTList(MVT::i32), &Ops[0], Ops.size());
To read the
2009 Jun 25
2
[LLVMdev] Inserting nodes into SelectionDAG (X86)
Greetings,
I am rather new to LLVM, so please excuse my limited knowledge about it.
Currently I am trying to modify the X86TargetLowering::LowerCALL method by
inserting additional instructions before the call.
As far as I understand, nodes are created by calling the getNode method on
the DAG. If, for example, I insert the following code
Ops.push_back(Chain);
Chain = DAG.getNode(ISD::TRAP,
2016 Mar 24
0
Problem with inserting a function call after certain x86 instructions
Hi all,
I am writing a pass subclassing the MachineFunctionPass and doing the
instrumentation in runOnMachineFunction(). But I do not know how to insert
a function call. In my work, I write a special function for a program to be
compiled and I need to insert this function after certain instructions
whose destination register is esp. In X86InstrInfo.cpp, there are two kinds
of call may be
2013 Jul 31
1
[LLVMdev] MachineBasicBlocks Cloning
Hi,
For some schedulers like Trace Scheduling it is necessary to clone basic blocks.
Instinctively I would think the "Machine Instruction Scheduler" would be the right place to do so.
Is it possible to clone MachineBasicBlocks in the "Machine Instruction Scheduler" pass? Any snares? Or is it to much effort to implement it there and there is a better place for such things?
2014 Feb 14
2
[LLVMdev] Custom allocators for MachineBasicBlocks and STL containers
Hello,
I was looking at how the memory for MachineBasicBlocks is managed and
something seems strange.
On one hand, a MachineFunction uses a recycling allocator to create and
destroy MBBs without costly heap allocation (the same is done for
MachineInstrs, MachineOperands, etc.).
On the other hand, each MBB also has a number of STL vectors within it. For
example, for Predecessors, Successors,
2008 Sep 30
2
[LLVMdev] Inserting MachineBasicBlock(s) before a MachineBasicBlock
I want to be able to do two things with LLVM (both just before code
emission):
1. Insert a MachineBasicBlock just before a MachineBasicBlock.
There is a function called AddPredecessor(). However, the comment says that
it does not update the actual CFG. I want to redirect all CFG edges that are
incoming to this MachineBasicBlock to the new one I create, and add just one
outgoing edge (no branch)
2009 Aug 03
2
[LLVMdev] code-altering Passes for llc
Dan Gohman-2 wrote:
>
> You don't need a ModulePass to modify a CFG. A MachineFunctionPass
> is fine for this.
>
Well, okay. But I need to insert some BasicBlock that contains the error
handling (that the runtime check jumpts to on failure). Just putting another
MachineBasicBlock at the beginning of some arbitrary MachineFunction doesn't
seem to be the right way to go, does
2009 Jun 27
0
[LLVMdev] Inserting nodes into SelectionDAG (X86)
On Jun 26, 2009, at 4:49 AM, Artjom K. wrote:
>
> Thank you for your help.
>
> I think I managed to create the instruction I wanted:
>
> // mov eax, 41
> Chain = DAG.getCopyToReg(Chain, DAG.getRegister(X86::EAX, MVT::i32),
> DAG.getConstant(41, MVT::i32), InFlag);
> InFlag = Chain.getValue(1);
>
> I don't understand though what InFlag is for. As I read the
2009 Jun 26
2
[LLVMdev] Inserting nodes into SelectionDAG (X86)
Thank you for your help.
I think I managed to create the instruction I wanted:
// mov eax, 41
Chain = DAG.getCopyToReg(Chain, DAG.getRegister(X86::EAX, MVT::i32),
DAG.getConstant(41, MVT::i32), InFlag);
InFlag = Chain.getValue(1);
I don't understand though what InFlag is for. As I read the code, it even
remains uninitialized when first passed to some node creation method.
2009 Jul 01
3
[LLVMdev] Inserting nodes into SelectionDAG (X86)
On Jul 1, 2009, at 2:22 PMPDT, Dan Gohman wrote:
>> Ops.push_back(DAG.getConstant(1, MVT::i32));
>> Chain = DAG.getNode(ISD::ADD, DAG.getVTList(MVT::Other, MVT::i32),
>> &Ops[0], Ops.size());
>>
>> Isn't that the way how it is supposed to work?
>
> ADD does not use a chain, so there's no chain operand, or
> MVT::Other result for it in an ADD