C FFI

Stephen Weeks MLton@research.nj.nec.com
Tue, 6 Jun 2000 14:29:04 -0700 (PDT)


> True, but if you do it as early as CPS, then you won't be able to fold
> constants in the things that are currently #defines.

Well, sort of.  For the things that are #defines, the compiler is now
going to have to know the semantics of the primitive.  So, whenever we
need to, we can either recognize the desired Cprim (that currently
expands into a #define) in the optimization pass or we can transform
the Cprim into a full-fledged primitive recognized by the compiler
internals (like, e.g. ArraySub or ArrayLength).