can you elaborate on MachineDesc and how to construct one for the local machine?

Aaron Tomb aarontomb at gmail.com
Sun Sep 11 02:04:40 BST 2011


Hi,

The main use of MachineDesc at the moment is to calculate the results of "sizeof expr" and "alignof expr" for constant folding. So, if you have a new architecture that you want to support, you could write a C program something like:

  printf("%d\n", sizeof(int));
  pritnf("%d\n", alignof(int));

and so on for the other types, and compile and run it on the desired target. You can then use the results it prints to fill in a new MachineDesc value.

Aaron

On Aug 29, 2011, at 3:28 PM, Benedikt Huber wrote:

> On 24.08.2011, at 17:34, notsowelltyped at Safe-mail.net wrote:
>> subj.
>> 
>> also, it's should be noted, that after some time spent toying with language-c i would like to express my appreciation for the all work you done on it.
>> cool stuff, but requires more docs.
> Hi,
> (cc-ing list)
> thanks, glad you like it. MachineDesc specifies the size (in bytes) and alignment requirement (in bytes) on a certain architecture. I'm not too familiar with the internals (implemented by Aaron Tomb), but have a look at the machine description for i386 in src/Language/C/Analysis/AstAnalysis.hs, and how it is used in src/Language/C/Analysis/ConstEval.hs.
> cheers, benedikt
> 
> _______________________________________________
> Language-c mailing list
> Language-c at projects.haskell.org
> http://projects.haskell.org/cgi-bin/mailman/listinfo/language-c




More information about the Language-c mailing list