[LLVMdev] How to prevent an instruction to be executed more than once?

Xinfinity xinfinity_a at yahoo.com
Thu Jun 24 07:00:30 PDT 2010

I need to mark the beginning of some regions of code, that I want to patch at
In this case, I want to mark the beginning of BB4 and then to patch the
jumps, because I want to temporarily change the flow at runtime and then to
restore the previous version.

In order to patch, I need to know the exact structure of the generated code.
So, I might have a BasicBlock like:

 call void asm "label_BB4:\0A", ""()
 call void asm "jmp label_BB5\0A", ""()
 br label %BB5

and in the generated code the br label %BB5 will actually never be reached.
But I introduce the jmp in inline asm in hexa code with .byte in order to
control if it is a long or a short jump and to know how many bytes to patch.

I tried to keep it short, please let me know if it is not clear enough.
Mainly, what I need to know statically is the beginning of the code
contained in the BasicBlock BB4 and the size of jump, in the generated code.

View this message in context: http://old.nabble.com/How-to-prevent-an-instruction-to-be-executed-more-than-once--tp28981639p28982790.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.

More information about the llvm-dev mailing list