[LLVMdev] Selection of multiple instructions

Artjom Kochtchi artjom.kochtchi at googlemail.com
Wed Jul 8 10:16:32 PDT 2009


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 code generation
(http://www.llvm.org/docs/CodeGenerator.html) and am unsure if I understand
it correctly, because I have trouble figuring out what actually to do in the
code to accomplish my aim.

There are the tablegen generated functions and custom C++ code (I guess that
will be X86DAGToDAGISel::Select(SDValue)) that deal with selection.

The runtime checks I want to add concern indirect jumps. So for example for
all calls that jump to register values like

call eax

I want to insert a check

... (some test) ...# perform test
jne error_label     # jump if test fails
call eax              # otherwise execute original call

So the check is a sequence of instructions before the call instruction.

Is it possible to do that at the selection level? If yes, could you give a
simple example or some hint how it would be done? I only find examples where
exactly one instruction is emitted (and/or returned).

Do you think it's the right approach or is there a better place?

I'd really appreciate your help.
Artjom Kochtchi 
-- 
View this message in context: http://www.nabble.com/Selection-of-multiple-instructions-tp24395706p24395706.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.




More information about the llvm-dev mailing list