[LLVMdev] Indirect Branch Representation

Álvaro Castro Castilla alvaro.castro.castilla at gmail.com
Sat Jul 26 06:03:58 PDT 2008


2008/7/24 kapil anand <kapilanand2 at gmail.com>:
> Actually, I am trying to implement a frontend for conversion from binary to
> LLVM. In binary, we would encounter branch indirect instructions like,  Br
> Reg, where Reg would be an equivalent virtual register in LLVM. So, we can't
> directly implement Switch block method here to represent this instruction as
> we don't know how the values of Reg are mapped to basic blocks.
>
> I was going through the documentation and found that indirect branch are
> produced by virtual function calls. Are there any other cases which result
> into CodeGen procuding Indirect Branch?


Curiously, the previous thread of this list (titled "Indirect Branch
Representation") points towards one of the two possible
implementations of microthreads that I'm aware of:

1) A method inspired in Duff's Device:
http://en.wikipedia.org/wiki/Duff%27s_device

2) The GCC label-as-value extension + a goto statement
http://lists.cs.uiuc.edu/pipermail/llvmdev/2008-July/016071.html

Both methods could be used for creating local continuations, which is
the most important requirement for green threads. It could be nice to
have some way of achieving GCC's extension in LLVM. At this point, I
don't have a deep enough knowledge of llvm to figure it out.


Thanks for all your help!

.alvaro.castro.



More information about the llvm-dev mailing list