3 ms·
Will have to take another look, but it still sounds to me like LLVM IR is more comparable to RTL (https://gcc.gnu.org/onlinedocs/gccint/RTL.html#RTL https://gcc
by bedatadriven 12y ago
Will have to take another look, but it still sounds to me like LLVM IR is more comparable to RTL (https://gcc.gnu.org/onlinedocs/gccint/RTL.html#RTL https://gcc.gnu.org/onlinedocs/gccint/RTL.html#RTL).
Gimple variables have types comparable with C types - you get pointers, arrays.
For example:
int sum10(int values[10]) {
int i;
int sum = 0;
for(i=0;i<10;++i) { sum += values[i]; }
values[0] = 342;
return sum;
}
is compiled down to:
sum10 (int * values)
{
long unsigned int D.1598;
long unsigned int D.1599;
int * D.1600;
int D.1601;
int D.1602;
int i;
int sum;
sum = 0;
i = 0;
goto <D.1595>;
<D.1594>:
D.1598 = (long unsigned int) i;
D.1599 = D.1598 * 4;
D.1600 = values + D.1599;
D.1601 = *D.1600;
sum = D.1601 + sum;
i = i + 1;
<D.1595>:
if (i <= 9) goto <D.1594>; else goto <D.1596>;
<D.1596>:
*values = 342;
D.1602 = sum;
return D.1602;
}
- rwallace 12y agoAs far as I know, LLVM does exactly the same thing; the LLVM representation of that code would have a different syntax of course, but semantically would be exactly equivalent to the Gimple version you've presented.