[LLVMdev] indirectbr and phi instructions
Joshua Warner
joshuawarner32 at gmail.com
Mon Aug 2 15:19:39 PDT 2010
Hi,
How does the requirement that phi instructions have one value per
predecessor basic block interact with indirectbr instructions? For
instance, take the following code:
L1:
br i1 %somevalue, label %L2, label %L3
L2:
%ret1 = i8* blockaddress(@myfunction, %L5)
br label %L4
L3:
%ret2 = i8* blockaddress(@myfunction, %L6)
br label %L4
L4:
%ret = phi i8* [%ret1, L2], [%ret2, L3]
indirectbr i8* %ret, [label %L5, label %L6]
L5:
%myval = phi i32 [0, %L2], [1, %L3] ; are both of these values required,
even though the only *real* possible predecessor block is L2?
ret i32 %myval
L6:
%myval = phi i32 [0, %L2], [1, %L3] ; likewise
ret i32 %myval
Boiled down, I think my question is, "how strict is the 'one value per
predecessor block' rule on a phi instruction?"
FYI, I am planning on using indirectbr to implement jsr and ret instructions
in Java. I fully expect that there are syntax errors in the above code -
but I hope you get the idea.
Thanks,
Joshua
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100802/2037dda4/attachment.html>
More information about the llvm-dev
mailing list