[fpc-devel] Questions regarding pushing more onto assembler

Peter Vreman peter at freepascal.org
Thu Sep 15 09:58:34 CEST 2005


> I have some questions regarding porting of FPC to another machine type.
> One of the things I am considering doing is the "pushing" of more of the
> code processing onto the assembler, and whether this might be a better
> idea, or if it was thought about and rejected for some reasons and it
> might be worth noting if it was thought about.
>
> For example, I am thinking that code such as
>
>                if  xray = 5 then
>                     do_something
>                else
>                     do_something_else;
>
> Where 'do_something' and 'do_something_else' could be one line or a
> BEGIN / END block.  This could, with use of a good macro assembler, be
> handled as something like
>
>                  IF   XRAY,EQ,F5
>                         do_something                    ; code as
> generated
>                  ELSE
>                         do_something_else            ; more code
>                  ENDIF
>
> F5             DC     F'5'                                 Constant
> defined
>
> Now, the idea is the IF, ELSE and ENDIF macros will handle the creation
> of the particular code for testing and such.
>
> There are a number of (already written) macros available to do this, and
> I think it will reduce the complexity of the compiler (at a slight
> increase in complexity of the generated code via macros) .  I am
> wondering if there are any thoughts on this idea.

This is not possible with fpc. The compiler is made to generate the
instructions itself in a list. See cgobj.pas and cgcpu.pas what is
required for a new processor.






More information about the fpc-devel mailing list