Hello,
I am a bit confused about the nature of LLVM’s SSA and IR in general.
Questions:
- Is it possible to get LLVM to generate code as in /2/ (bellow)?
- if not, how can I tell if an operand has been previously defined?
Here is why:
I thought (wrongly) that all operands of an instruction must have been
previously defined or some constants.
I see that the ‘bitcast’ instruction is certainly standalone in certain cases, such as
%[65]“alloca point” = bitcast i32 [34]0 to i32; [#uses=0]
However the following instruction has a ‘bitcast’ inserted as an operand,
rather then the result of a previous bitcast:
/1/
(void)store i32 (…)* bitcast (i32 ()* @pf to i32 (…)*), i32 (…)** @[2]pf0, align 8
In this case, the bitcast is a constant, but it does DEFINE a new value
and that value is the operand. I would have thought that the above code
should have been “pure IR/SSA”:
/2/
%TMP = bitcast (i32 ()* @pf to i32 (…))
(void)store i32 (…) %TMP, i32 (…)** @[2]pf0, align 8
or something like that…
Thank you,
Dan