I am implementing a jit compiler with libgccjit and am stuck when trying to retrieve the result of a binary operation.
It isn't getting the result that's the issue, but declaring the type of the result.
I have two gcc_jit_rvalues and want to perform a simple binary op on them.
These two rvalues's could have any type.
For the fourth parameter of gcc_jit_context_new_binary_op I have to specify a result type.
Given that I don't know the types of the rvalue's but can get the gcc_jit_type* of them, how can I find out the standard C result type (the result type GCC would use when compiling a C expression a + b) of the expression?
I know I can write a bunch of if and else or switch statements to go over every single god-damn combination of integer and float and return what would be expected in C, but that is a lot of typing I really don't want to have to do.
Is there some easier way I can find the result type GCC would use if it were compiling C code?