[LLVMdev] New primitive type for 32/64 compatibility?
sabre at nondot.org
Sat Apr 16 08:38:10 PDT 2005
On Sat, 16 Apr 2005, Mike Hearn wrote:
> To be able to deal with the case of passing long/size_t into functions,
> shouldn't there be a first class type that has indeterminate width decided
> only at native code generation time?
Adding something like this would certainly be possible, but I'm not sure
it's really appropriate. The problem is that 'long' varies in different
ways on different platforms/os's, some of which make sense, and some of
which do not. Also, this is a very c-centric request, I am not sure if it
makes sense for other people.
While I don't think that having 'long_t' or something like that is
necessarily a good idea, I do think that having an 'intptr' type could be
a useful feature, with the advantage of it being a language-independent
construct. I think this would capture what you're really going for, and
have very simple and well-defined meaning. If other front-end people
think that this would be a useful abstraction for providing portable code,
and can give examples where it would be used, that would provide a lot of
credibility in my mind for the feature.
The bigger problem I suspect is that you'll need to modify the LLVM C
front-end, llvm-gcc, to produce these. I suspect that making it produce
these will be fairly hard, as GCC's internal representation is notoriously
for being not type-consistent. If you wanted to start on a project like
this, that would be the place to get started.
More information about the llvm-dev