[fpc-devel] Episode 4. Addressing and it's limits Part Two

Hans-Peter Diettrich DrDiettrich1 at aol.com
Wed Feb 8 12:28:49 CET 2012


Mark Morgan Lloyd schrieb:
> Hans-Peter Diettrich wrote:
>> steve smithers schrieb:
>>
>>> Regardless of what you may believe, FreePascal is not the first 
>>> compiler to be
>>> implemented on 370 architecture.
>>
>> I.e. you can study how they create code, before you reinvent the wheel 
>> :-)
> 
> :-) Had occurred to me as well, although obviously a lot is dictated by 
> FPC's higher-level parsing and structure.

This should not be a problem. It's up to the code generator to define 
its own strategies for allocating space for code and data items, and how 
to address them in generated code. The parse tree tells the back-end 
*what* should be done, the back-end then has to know *how* to do it.

> Might still be very useful for 
> getting calling conventions etc. right.

The implementation of calling conventions is up to the code generator as 
well. You can invent your own conventions, and map them to any 
predefined one. As a starting point it's sufficient to support only one 
calling convention, the one for system calls. More conventions for 
calling other external libraries may be required, depending on the 
target OS conventions.

DoDi




More information about the fpc-devel mailing list