Use the IR information to Modify the AST?

Hi,guys:

I am interested to use the IR information to modify the AST of the source code
But I am not sure whether the LLVM support or not.

Thanks,
yao

I think your question needs a bit more information - what do you want
to modify in the AST, based on what IR information? Overall, what are
you trying to achieve? [Maybe there is a "better" way to do that]

Hi Guys,

I see an intrinsic function call like this "call float @ir.sample_complex.f32(float a, int bitcast (i16 337203 to i32) , i32 1, <2 x float> %62, float %61) “,
Then I got trouble to process the third operand "int bitcast (i16 337203 to i32)”, the second operand I got is “constant 337203”.

I think something is messed up, but the getOperand(i) is llvm core function. So I suspect the above intrinsic call is legal or not?

any suggestions?

best
kevin

Bitcast only works between types of the same size. You shouldn't even
have been able to create that expression. It's strongly recommended
that you use a build of LLVM with assertions enabled for development,
are you doing that?

Either way, for i16 -> i32, your options are "zext" or "sext".

Cheers.

Tim.

Thank you Tom,

Sorry for the errors, obviously I made that example wrong.
Here is the one with little bit name changes:

call float @ir.sample_image(%struct.image_t addrspace(1)* %tex_unit0, %struct.sampler_t addrspace(2)* inttoptr (i64 -9223372036854542193 to %struct.sampler_t addrspace(2)*), i32 1, <2 x float> %62, float %61)

"%struct.sampler_t addrspace(2)* inttoptr (i64 -9223372036854542193 to %struct.sampler_t addrspace(2)*)” is the part give me problem, I got “constant “ for getOperand(3) call.

best

kevin