Seung Jae Lee
2007-Jul-14 21:48 UTC
[LLVMdev] not to break 'for' statement into basic blocks
Dear LLVM guys, Hi. I first became to be interested in the compiler work, especially LLVM, since last October, still I'm a novice on here. (My major is not CS, either. :-\) Please forgive my ignorance. LLVM optimization and other tools are really fantastic. However I don't want LLVM breaks my 'for' statement in C code into basic blocks during compiling. I'm sure this sounds really strange but there is a reason for me. I almost made the backend for a target machine with LLVM. But a peculiar thing is the assembly uses 'for' statement directly, not branching among basic blocks. Furthermore, this assembly does not have the notion of 'br'instruction, phi-node and so on. Therefore, I have no choice without making 'for' in the assembly. (Of course, equilvant 'br' instruction is used for 'if' statement. But it should be nested in 'demux' and 'mux' so I can't use this to represent 'for') 1) First, I tried to re-unite basic blocks which llvm-gcc spits out to make 'for' again. But this is quite tricky. Generalizing it for the optimzed llvm bytecode is not easy. 2) So.. I wonder if it is possible to modify the llvm-gcc not to break 'for' but not sure about this. I've heard 'clang' is newly released so I'm also wondering whether this can be modified for my goal. 3) A person recommended me to use GNU lightning, but still not sure about that. 4) A person also recommended me to make this assembly to "purely functional". This assembly, fortunately, supports 'call' instruction. So this can be a good choice for me, but unfortunately I don't have enough time to implementing it on the code after studying. Could you, any body, tell me any advice, if you have? My head is steaming. Thanks, Seung J. Lee