On Tue, Nov 22, 2011 at 10:32 PM, Jeff Garzik <jeff@xxxxxxxxxx> wrote: > The disassembler output is certainly sane and understandable. Here's an > example test case: > > extern int bar(int x); > > int foo (int x) > { > int y = 0; > while (y < 1000) { > y += bar(x); > } > > return y; > } > > The PHI operation in SSA being a union of control flows, we need to > reference all input pseudos ... including pseudos generated by operations > further down the in the code (i.e. pseudos not yet generated). > > A classic forward reference is needed, and I cannot figure out how to do > that in the LLVM C API, even though the forward reference is plain and > obvious in the LLVM text disassembly. My next step was going to trace > through the front end to see how it generates forward refs, or be lazy and > brain dump on an llvm mailing list somewhere. So pasting the above test program to http://llvm.org/demo/ and switching to "LLVM C++ API code" target seems to suggest you're interested in the LLVMReplaceAllUsesWith() API for forward references. Pekka -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html