-
Notifications
You must be signed in to change notification settings - Fork 2
Description
I am forced to add the inline keyword to the public Squint compiler due to a botched 'git stash' and merge on my part.
This was work in progress for the HPC version of MC, and was not supposed to be here.
Now that the cat is out of the bag, I have to let it ride here on the public branch of the compiler.
Note that what I have committed so far only has partial functionality, since it was in mid development.
It only works for a limited subset of void functions at the moment.
Of note: the inline keyword in the MC compiler can be applied in two ways -- either to the function or the call site.
This allows for optimized specializations of functions. For example:
void dot(float *result, float *a, float *b, int len)
{
float sum = 0.0;
for (int i=0; i<len; ++i)
sum += a[i]*b[i];
*result = sum;
}
void ddot(float *out, float *x, int n)
{
inline dot(out, x, x, n); // note speicialization here -- MC optimizer cuts number of mem reads in half
}
Inlining can be nested up to 16 levels. Error messages follow the context through all inline levels.