[LLVMdev] IR type safety
Renato Golin
rengolin at systemcall.org
Tue Sep 21 09:26:48 PDT 2010
Hi folks,
I have a few questions I was saving for later and never got around to
ask them, so I'll send a few emails to the list, one with each
question, to ease the further discussions that may come from them...
The first question is:
According to the language reference, LLVM IR is type safe. It means,
for instance, that you won't be able to perform ADD operations in two
different types or call functions with the wrong arguments, etc.
But, when declaring two types that happen to (supposedly) have the
same layout, LLVM ignores the second type and use the first's name
instead.
In one module, it doesn't matter, but once you join different modules
with, possibly, different data layouts, the data types are not the
same any more.
Is this a declaration that you will never be able (with an error
message, assert or whatever) to join two IRs with different data
layouts? Or it was never thought that you could mix them?
In my view, that is the precise reason why we have the data layout.
Unions can't rely on them (why we don't have unions any more) and
compiler data (RTTI, VT, VTT, etc) are all statically created with the
correct size.
--
cheers,
--renato
http://systemcall.org/
Reclaim your digital rights, eliminate DRM, learn more at
http://www.defectivebydesign.org/what_is_drm
More information about the llvm-dev
mailing list