[M3devel] How to integrate llvm into cm3

Jay jay.krell at cornell.edu
Sat May 23 03:58:43 CEST 2015


We use things with varying levels of abstraction. & concrete details are filled in at varying stages. C "long" is NOT specified as having an exact size and does NOT necessarily hold a pointer, and this is ok.


C99 is pretty complete, messy.
For each of 8, 16, 32, 64,
It gives "least", "fast", and "exact" types. And pointer sized. Signed and unsigned. 32 types!


INTEGER is always pointer sized.
LONGINT is on all platforms.


C# has this feature too. IntPtr & UIntPtr. But C# is dubious -- array indexes are always 32 bit signed. 


 - Jay

On May 22, 2015, at 5:26 AM, Elmar Stellnberger <estellnb at elstel.org> wrote:

> 
> Am 22.05.2015 um 13:06 schrieb Henning Thielemann:
> 
>> 
>> 
>> On Fri, 22 May 2015, dirk muysers wrote:
>> 
>>>>> What about the said platform dependencies you have discovered?
>> 
>>> Not me (I never seriously considered using it), but many people on the llvm forums pointed to the fact. One example among many:
>> 
>> Why should the LLVM IR be platform independent? Like object files, the ll bitcode files are platform dependent. Of course, there must be a way to address processor specific instructions. Intrinsics are used for that purpose. If you want processor specific optimizations, then LL cannot be platform independent.
> 
> 
> You are right; not an issue of llvm though someone who is used to Java or C#/.net bytecode would not expect such a 'feature'.
> 
> 
> Am 22.05.2015 um 12:53 schrieb Elmar Stellnberger:
> 
>> Now let us think of Modula-3. I believe we had a long type for cm3 the last
>> time I have seen it. However an equivalent to long long which does also 
>> exist on 32bit platforms would be an absolute requirement to not break 
>> things for llvm! Many Thanks for notifying us about this issue, Dirk.
>> 
>> As far as I can see a Modula-3 programmer will need a good core for
>> portable programming anyway as we did not even uphold a guarantee for
>> WIDECHAR to be either 16 or 32bit.
> 
> Nonetheless we actually need to demand the necessary precautions from Modula-3 for platform independent programming.
> Having a type
> 
> (1) which is at least 64bit long (why not also 128bit) for numeric purposes (at best also available on 32bit platforms)
> (2) a type which is exactly as long as a pointer (f.i. for subtracting two pointers)
> (3) the regular INTEGER defined to be at most 32bit in order to avoid an overkill in memory consumption and computing power
> 
> Anyone here who can tell me about the current state of LONGINT support for cm3?
> As far as I can remember we had a LONGINT but only on 64bit machines.
> For portable programming we will at least need types for (2) and (3).
> (1) would be an additional plus.
> 
> So writing code which will execute seamlessly either in a 32bit or 64bit environment as I have frequently tested it and done in 
> the last eight years should at least become possible with Modula-3. It needs to be doable when using gcc as well as llvm though
> the 'advantages' are more obvious when it comes to arch-all llvm bytecode.
> 



More information about the M3devel mailing list