Difference between revisions of "ZSeries/Part 2"

From Free Pascal wiki
Jump to navigationJump to search
 
(31 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
:''[[ZSeries|Go back to zSeries]]'' — [[ZSeries/Part 1|Go Back to Part 1]] — [[ZSeries/Part 3|Go Forward to Part 3]]  
 
:''[[ZSeries|Go back to zSeries]]'' — [[ZSeries/Part 1|Go Back to Part 1]] — [[ZSeries/Part 3|Go Forward to Part 3]]  
 +
 +
Because the number of places I have to look is ''lots of them'', the list of units I go through is broken up into more than one page.  I'll try to keep page lengths to a reasonable factor, if a page seems to be too large, I will split it and start a new section.
 +
 +
I'm also dropping references to files, units and modules that I don't have to change.  This will keep the overhead low.
 +
 
=To Begin=
 
=To Begin=
This compiler is ''huge''.  It's hundreds of source files, and is going to be an enormous task.  Where do you start?  Well, you start with the main program of the command-line compiler, and you look at it.  That file is '''pp.pas'''.
+
This compiler is ''huge''. (I've (re-)compiled it, and the rebuild of the Windows version is 262,000 lines of code.) It's hundreds of source files, and is going to be an enormous task.  Where do you start?  Well, you start with the main program of the command-line compiler, and you look at it.  That file is '''pp.pas'''.  Then you collect all of the units it uses, and you look at each one's source file, then you repeat this recursively, finding every place where there is a reference to a particular machine type or operating system and you add the particular cpu or operating system (or both) to it.
  
Note that line numbers indicated in any source file are from the version 2.6.0 compiler sources and as such, as lines are added, other line numbers where things were found and changed will increase.  So line numbers will be referenced in a file from top to bottom so the references should match.  Also, so as not to brand this as "windows centric" since the hope is to build a cross-compiler for I370 that could run on either Windows or Linux, when file names are specified, directory separators will use /.
+
Note that line numbers indicated in any source file are from the version 2.6.0 compiler sources (I'll also look at the 2.6.2. sources which have just recently been released) and as such, as lines are added, other line numbers where things were found and changed will increase.  So line numbers will be referenced in a file from top to bottom so the references should match.  Also, so as not to brand this as "windows centric" since the hope is to build a cross-compiler for s370 that could run on either Windows or Linux, when file names are specified, directory separators will use /.
  
 
Note that from this point on, all editing occurs in our "sandbox" directory separate from the original compiler.
 
Note that from this point on, all editing occurs in our "sandbox" directory separate from the original compiler.
 
==How units and include files are listed==
 
==How units and include files are listed==
 
Since this series of articles is intended to be a tutorial on how to add a new architecture to the compiler, files that call other files or units are listed at the top of the section dealing with that file.  Where a unit is called by another, that caller is listed.  Same for files that are included by other files.  Any units the unit or file '''uses''', are also listed.  As new units which are referenced are found, they are added to the list of all the units that need to be checked and inspected, and potentially edited, as well as new units that have to be created.
 
Since this series of articles is intended to be a tutorial on how to add a new architecture to the compiler, files that call other files or units are listed at the top of the section dealing with that file.  Where a unit is called by another, that caller is listed.  Same for files that are included by other files.  Any units the unit or file '''uses''', are also listed.  As new units which are referenced are found, they are added to the list of all the units that need to be checked and inspected, and potentially edited, as well as new units that have to be created.
 +
 +
This also helps since the list of modules is broken over several pages, so you can see where a module cross-references another one even if the references for both are not on the same page.
  
 
The format of the first line is generally like this (items not used will not appear on the line):
 
The format of the first line is generally like this (items not used will not appear on the line):
Line 13: Line 20:
 
If the file is not normally in the Compiler directory that is noted, or if it is in a subdirectory.  As items are noted in the source code of that file or unit, they will be mentioned.
 
If the file is not normally in the Compiler directory that is noted, or if it is in a subdirectory.  As items are noted in the source code of that file or unit, they will be mentioned.
  
 +
=The Free Pascal Compiler=
 
==pp.pas==
 
==pp.pas==
 +
===Version 2.6.0===
 
:'''''main program''', includes '''fpcdefs.inc''', calls units '''cmem, profile, catch, globals, compiler'''''
 
:'''''main program''', includes '''fpcdefs.inc''', calls units '''cmem, profile, catch, globals, compiler'''''
'''pp.pas''' is the main program of the compiler.  We're going to edit this file to create an IBM-370 cross-compiler.  First, we'll decide what is the switch for this, and we'll use I370. So we'll add that to the source comments to indicate that, by inserting the middle line in the comment block (about line 35):
+
'''pp.pas''' is the main program of the compiler.  We're going to edit this file to create an IBM-370 cross-compiler.  First, we'll decide what is the switch for this, as well as the names of the components.  For the compiler switch or target environment, we'll use S370. Within the code, the cpu name is '''cpu_S370''', floating-point processor is '''fpu_s370''', and the operating system target is '''vse''' or '''linux''' because I have access to both environments.
 +
 
 +
So we'll start by adding "S370" to the source comments and wherever else needed to indicate that, by inserting the middle line in the comment block (line 34):
 
   VIS                generate a compiler for the VIS
 
   VIS                generate a compiler for the VIS
   I370               generate a compiler for the IBM 370/390/zSeries mainframes
+
   S370               generate a compiler for the IBM 370/390/zSeries mainframes
   DEBUG              version with debug code is generated       
+
   DEBUG              version with debug code is generated  
This program includes '''fpcdefs.inc''' so we'll check that later.  We have to add the indication to only select one target compiler, so we'll select for I370 (about line 142, where we'll add everything starting at the sixth line where we check to see if i370 is defined):
+
        
{$ifdef support_mmx}
+
This program includes '''fpcdefs.inc''' so we'll check that later.  We have to add the indication to only select one target compiler, so we'll select for I370 (about line 139, before the check that no CPU was defined:<tt><br/>
  {$ifndef i386}
+
  {$endif AVR}
    {$fatal I386 switch must be on for MMX support}
+
  {$ifdef S370}
  {$endif i386}
 
  {$endif support_mmx}
 
  {$ifdef i370}
 
 
   {$ifdef CPUDEFINED}
 
   {$ifdef CPUDEFINED}
 
     {$fatal ONLY one of the switches for the CPU type must be defined}
 
     {$fatal ONLY one of the switches for the CPU type must be defined}
 
   {$endif CPUDEFINED}
 
   {$endif CPUDEFINED}
 
   {$define CPUDEFINED}
 
   {$define CPUDEFINED}
  {$endif i370}
+
  {$endif S370}
The rest of the main program seems to be okay, but we will have to go through and look at all the units that this program uses, which, depending on which options have been set, are or can be: '''<code>cmem, profile, catch, globals,</code> and <code>compiler</code>'''.  The rest of this file seems okay, so we'll save it.
+
{$ifndef CPUDEFINED}
 +
  {$fatal A CPU type switch must be defined}
 +
{$endif CPUDEFINED}</tt><br/>
 +
 
 +
The rest of the main program seems to be okay, but we will have to go through and look at all the units that this program uses, which, depending on which options have been set, are or can be: '''<code>cmem, profile, catch, globals,</code> and <code>compiler</code>'''. Then follow those and see where they lead, and "lather, rinse, repeat." The rest of this file seems okay, so we'll save it. (If we don't change a file, we don't re-save it so as not to change the date and time of the last edit.)
 +
===Version 2.6.2===
 +
Line 34:<br/><tt>
 +
  VIS                generate a compile for the VIS</tt>
 +
 
 +
Becomes:<br/><tt>
 +
  VIS                generate a compiler for the VIS
 +
  S370                generate a compiler for the IBM 370/390/zSeries mainframes</tt>
 +
 
 +
Lines 138 and 139:<br/><tt>
 +
{$endif AVR}
 +
{$ifndef CPUDEFINED}</tt>
 +
 
 +
become:<br/><tt>
 +
{$endif AVR}
 +
{$ifdef S370}
 +
&nbsp;  {$ifdef CPUDEFINED}
 +
&nbsp;    {$fatal ONLY one of the switches for the CPU type must be defined}
 +
&nbsp;  {$endif CPUDEFINED}
 +
&nbsp;  {$define CPUDEFINED}
 +
{$endif S370}
 +
{$ifndef CPUDEFINED}
 +
</tt><br/>
  
 
==fpcdefs.inc==
 
==fpcdefs.inc==
 
:''Called as include file from '''pp.pas''', called as include file from units '''catch, compiler, verbose''' (and virtually all other units), no called units noted''
 
:''Called as include file from '''pp.pas''', called as include file from units '''catch, compiler, verbose''' (and virtually all other units), no called units noted''
 
'''fpcdefs.inc''' provides various definitions regarding what processor we're compiling for to most units and many other files.  We need to define the processor, so we'll borrow the generic one, and add or remove items as we need them.  So we'll start with the block beginning with the line <code>{$ifdef generic_cpu}</code> through the line <code>{$endif generic_cpu}</code>.  From later work, I discover I'll have to mark the target machine as big endian, so I'll include that.  (Note that the definitions will include things as I discover them, so this may include things I haven't explained.)
 
'''fpcdefs.inc''' provides various definitions regarding what processor we're compiling for to most units and many other files.  We need to define the processor, so we'll borrow the generic one, and add or remove items as we need them.  So we'll start with the block beginning with the line <code>{$ifdef generic_cpu}</code> through the line <code>{$endif generic_cpu}</code>.  From later work, I discover I'll have to mark the target machine as big endian, so I'll include that.  (Note that the definitions will include things as I discover them, so this may include things I haven't explained.)
 +
===Version 2.6.0===
 +
So on line 146, replace
 +
{$endif mips}
 +
 +
{$IFDEF MACOS}   
 +
 
 +
With:
 +
{$endif mips}
 +
 +
{$ifdef S370}
 +
  {$define cpu32bit}
 +
  {$define cpu32bitaddr}
 +
  {$define cpu32bitalu}
 +
  {$define cpuflags}
 +
  {$define cpuextended}
 +
  {$define ENDIAN_BIG}
 +
{$endif S370}
 +
 +
{$IFDEF MACOS}     
  
So around line 151, between the lines
+
Otherwise, now, '''fpcdefs.inc''' looks okay, so I'll save it.
 +
===Version 2.6.2===
 +
Line 153, replace:
 
  {$endif mips}
 
  {$endif mips}
 
   
 
   
  {$IFDEF MACOS}    
+
  {$IFDEF MACOS}  
We'll update this to the following:
+
 
 +
With:
 
  {$endif mips}
 
  {$endif mips}
 
   
 
   
  {$ifdef i370}
+
  {$ifdef S370}
 
   {$define cpu32bit}
 
   {$define cpu32bit}
 
   {$define cpu32bitaddr}
 
   {$define cpu32bitaddr}
Line 51: Line 107:
 
   {$define cpuextended}
 
   {$define cpuextended}
 
   {$define ENDIAN_BIG}
 
   {$define ENDIAN_BIG}
  {$endif i370}
+
  {$endif S370}
 
   
 
   
 
  {$IFDEF MACOS}       
 
  {$IFDEF MACOS}       
Otherwise, now, '''fpcdefs.inc''' looks okay.
 
  
==Unit cmem==
 
:''Called from: '''pp.pas''', file located in directory '''rtl/inc''' outside of the ''compiler'' directory, requires external procedures '''malloc, free, realloc, calloc''', no called units noted''
 
This is used as a bridge to the C memory management library and its functions <code>malloc, free, realloc, calloc</code>. In some architectures it uses a specific library. I will probably borrow these from an existing C library or simulate them.  Or this module may be rewritten.  For now, there is nothing I need to do here.
 
 
==Unit profile==
 
:''Called from: '''pp.pas''', file located in directory '''rtl/go32v2''' outside of the ''compiler'' directory, no units noted
 
This is only used for profiling under the Go32 system, so this module is not relevant to our cross-compiler.
 
 
==Unit catch==
 
:''Called from: '''pp.pas''', includes '''fpcdefs.inc''',  no called units noted''
 
'''catch.pas''' deals with handling control-c and segfaults.  We might have to throw some flags to enable this or to handle it since the compiler doesn't run locally on the mainframe, it runs on the user's PC.  Right now, we're just trying to get to the point of being able to create code for the zSeries.  So in the absence of anything requiring we deal with this, we'll leave it alone for now.
 
 
==Unit globals==
 
==Unit globals==
:''Called from: '''pp.pas''', includes '''fpcdefs.inc''', calls unit '''comphook'''''
+
===Version 2.6.0===
 +
:''Called from: '''pp.pas; options.pas ''', includes '''fpcdefs.inc''', calls unit '''comphook'''''
 
'''globals.pas''', starting at about line 372, has some definitions for specific target processors.  So, again, I'll borrow from <code>{$ifdef GENERIC_CPU}</code> and change as necessary.  At line 424, we have
 
'''globals.pas''', starting at about line 372, has some definitions for specific target processors.  So, again, I'll borrow from <code>{$ifdef GENERIC_CPU}</code> and change as necessary.  At line 424, we have
 
   {$endif mips}
 
   {$endif mips}
 
so we'll add the 370 after this, and put in the following:
 
so we'll add the 370 after this, and put in the following:
 
   {$endif mips}
 
   {$endif mips}
   {$ifdef i370}
+
   {$ifdef S370}
         cputype : cpu_i370;
+
         cputype : cpu_s370;
         optimizecputype : cpu_i370;
+
         optimizecputype : cpu_s370;
         fputype : fpu_i370;
+
         fputype : fpu_s370;
   {$endif i370}
+
   {$endif s370}
 
Note, these values will be defined elsewhere. Note that this unit references a few other units depending on the OS and machine, but the only one relevant to us will be '''<code>comphook</code>''' so we'll put that on the "stack" of units that have to be inspected and possibly edited.
 
Note, these values will be defined elsewhere. Note that this unit references a few other units depending on the OS and machine, but the only one relevant to us will be '''<code>comphook</code>''' so we'll put that on the "stack" of units that have to be inspected and possibly edited.
 +
===Version 2.6.2===
 +
There were no changes, the above edits are the same.
  
 
==Unit compiler==
 
==Unit compiler==
 +
===Version 2.6.0===
 
:''Called from: '''pp.pas''', includes '''fpcdefs.inc''', calls units '''fksysutils, sysutils, math, verbose, comphook, systems, cutils, cfileutl, cclasses, globals, options, fmodule, parser, symtable, assemble, link, dbgbase, import, export, tokens, pass_1, wpobase, wpo, cpupara, cpupi, cgcpu, cpunode, cputarg, i_i370, globtype'''''
 
:''Called from: '''pp.pas''', includes '''fpcdefs.inc''', calls units '''fksysutils, sysutils, math, verbose, comphook, systems, cutils, cfileutl, cclasses, globals, options, fmodule, parser, symtable, assemble, link, dbgbase, import, export, tokens, pass_1, wpobase, wpo, cpupara, cpupi, cgcpu, cpunode, cputarg, i_i370, globtype'''''
  
 
Starting at about line 24, this unit lists the units it uses.  Some units depend on other flags, but the units it does always require are: '''<code>verbose, comphook, systems, cutils, cfileutl, cclasses, globals, options, fmodule, parser, symtable, assemble, link, dbgbase, import, export, tokens, pass_1, wpobase, wpo, cpupara, cpupi, cgcpu, cpunode,</code>''' and '''<code>cputarg</code>'''.  These are also added to the "stack" for checking on references.
 
Starting at about line 24, this unit lists the units it uses.  Some units depend on other flags, but the units it does always require are: '''<code>verbose, comphook, systems, cutils, cfileutl, cclasses, globals, options, fmodule, parser, symtable, assemble, link, dbgbase, import, export, tokens, pass_1, wpobase, wpo, cpupara, cpupi, cgcpu, cpunode,</code>''' and '''<code>cputarg</code>'''.  These are also added to the "stack" for checking on references.
  
At this point I do not know whether or not I need to set the flag '''<code>USE_FAKE_SYSUTILS</code>''', if I do, I only need to add one unit, '''<code>fksysutils</code>''', but if I do need the "real" sysutils unit, then it will automatically include the units '''<code>sysutils, math</code>'''.  So I'll presume all three have to be looked at.  They also go on the stack for checking.  Doing a directory scan, apparently ''every'' architecture does use the <code>sysutils</code> unit, and ''none'' use '''<code>fksysutils</code>''', so I'll presume that to be the case.
+
This unit also defines the operaring that is the target for this compiler, so we have to add a unit which will define our target environment.  There are units for every one being targeted, so we have to insert one.  At line 116, change:
 
 
This unit also defines the machine that is the target for this compiler, so we have to add a unit which will define our target architecture.  There are units for every machine, so we have to insert one.  At the code around line 116:
 
 
  {$ifdef nativent}
 
  {$ifdef nativent}
 
   ,i_nativent
 
   ,i_nativent
 
  {$endif nativent}
 
  {$endif nativent}
 
   ,globtype;     
 
   ,globtype;     
we change to:
+
 
 +
Replace with:
 
  {$ifdef nativent}
 
  {$ifdef nativent}
 
   ,i_nativent
 
   ,i_nativent
 
  {$endif nativent}
 
  {$endif nativent}
  {$ifdef i370}
+
  {$ifdef vs1}
   ,i_i370
+
   ,i_vs1
  {$endif i370}
+
  {$endif vs1}
 
   ,globtype;     
 
   ,globtype;     
This means we've now added a new source file which will eventually have to be created, '''i_i370.pas''' for the new unit '''<code>i_i370</code>''', which almost certainly will be in the I370 subdirectory. Also unit '''<code>globtype</code>''' which is at the end of the list of units used.  The rest looks okay so for the moment we're done with this unit.
+
This means we've now added a new source file which will eventually have to be created, '''i_vs1.pas''' for the new unit '''<code>i_vs1</code>''', which almost certainly will be in the I370 subdirectory.
 +
===Version 2.6.2===
 +
This file has not been changed, the above changes are the same.
 +
 
 
==Unit fksysutils==
 
==Unit fksysutils==
This is only used if the particular architecture sets the flag that says it does not use the '''<code>sysutils</code>''' and '''<code>math</code>''' units.  Given that all of them do use them, I will presume for now I do not need to create this file.
+
This is only used if the particular architecture sets the flag that says it does not use the '''<code>sysutils</code>''' and '''<code>math</code>''' units.  Given that all of them do use them, I will presume for now I do not need to create this file. Presume every unit that includes sysutils includes this file if necessary.
 
==Unit sysutils==
 
==Unit sysutils==
:''Called from: '''compiler.pas; verbose.pas'''; '''rtl/objpas/math.pas''' (outside Compiler directory) located in '''rtl/i370''' (outside ''Compiler'' directory), includes '''fpcdefs.inc''', no called units noted''
+
===Version 2.6.0===
This file is a local file for each architecture, so it will be in the rtl subdirectory in its i370 subdirectory.  I'll take a look at a couple of architectures to see what's expected to be included.  It is used for platform dependent calls, is used by units '''<code>math, verbose</code>''', and if there are no platform dependent calls, it will simply be a stub unit.  For the moment, I'll just create a stub file and come back later if I need to.
+
:''Called from: '''compiler.pas; verbose.pas; cclasses.pas; parser.pas; assemble.pas'''; located in '''rtl/s370''', includes '''fpcdefs.inc''', no called units noted''
 +
This file is a local file for each architecture, so it will be in the '''s370''' subdirectory of the '''rtl''' subdirectory. Need to make an '''s370''' subdirectory in '''rtl'''  as this is the first file included in it.  I'll take a look at a couple of architectures to see what's expected to be included.  It is used for platform dependent calls, is used by the listed units, and if there are no platform dependent calls, it will simply be a stub unit.  For the moment, I'll just create a stub file and come back later <s>if</s> ''when'' I need to.
 
  {
 
  {
 
   
 
   
Line 128: Line 179:
 
  end.
 
  end.
  
==Unit math==
+
Note that I'm using copyright in my company's name; this is to show that the Free Pascal team is not responsible for this code, if they want to include it as part of the regular distribution then they can have their name on it.
:''Called from: '''compiler.pas''', located in '''rtl/objpas''' outside the ''compiler'' directory, includes '''fpcdefs.inc''', calls unit '''sysutils'''''
+
 
This might need to be changed later.  The IBM 370 series uses a different floating point system and its numeric limits are not the same as IEEE.  For the moment I'll leave this alone and come back later.  Note that when it is compiled, a copy of the PPU needs to be in '''rtl/i370''' (outside of the '''Compiler''' directory).
+
===Version 2.6.2===
==Unit verbose==
+
No difference; use above.
:''Called from: '''compiler.pas''', includes '''msgtxt.inc, msgidx.inc''', uses units '''sysutils, fksysutl, cutils, globtype, finput, cmsgs'''''
 
'''verbose.pas''' handles generating long ("verbose") error messages.  It uses unit '''<code>sysutils</code>''' unless <code>USE_FAKE_SYSUTILS</code> is defined, then it uses unit '''<code>fksysutl</code>''' instead.  If '''<code>EXTERN_MSG</code>''' is not defined, it includes '''msgtxt.inc'''.  Always includes '''msgidx.inc'''.  Since this is in the compiler, not the user's code I can ignore it for now.
 
  
==msgtxt.inc==
 
:''Called as include file from '''verbose.pas''', no called units noted''
 
Causes the entire 253 different error messages to be included in the '''<code>verbose</code>''' unit as a block of strings. Since it's in the compiler, not the user's program, it's nothing I have to worry about right now.
 
==msgidx.inc==
 
:''Called as include file from '''verbose.pas''', no called units noted''
 
This is a list of constants that translate the names of error messages into reference numbers.  It is intended to be included into the '''<code>verbose</code>''' unit.  Again, I can ignore this for now.
 
==Unit comphook==
 
:''Called from: '''compiler.pas''', includes '''fpcdefs.inc''', uses units '''sysutils, fksysutl,  globtype,  finput; '''''
 
'''comphook.pas''' only uses fksysutl if sysutils isn't present. Is a compiler hook to external programs, right now I don't need to do anything with it.
 
 
==Unit systems==
 
==Unit systems==
:''Called from: '''compiler.pas''', includes '''fpcdefs.inc; systems.inc''', calls unit '''cutils'''''
+
===Version 2.6.0===
Relates to information about the target systems supported. Lines 303-305 need to be altered to add the 370 ('''TsystemCpu''' will be adjusted to compensate):
+
:''Called from: '''compiler.pas; cfileutl.pas; options.pas; parser.pas; assemble.pas''', includes '''fpcdefs.inc; systems.inc''', calls unit '''cutils'''''
 +
Lines 243-245:
 +
      systems_allow_section = systems_embedded;
 +
 +
      systems_allow_section_no_semicolon = systems_allow_section
 +
 
 +
replaced with:
 +
      systems_allow_section = systems_embedded;
 +
 
 +
      systems_s370 = [system_s370_vs1,system_s370_linux];  
 +
 +
      systems_allow_section_no_semicolon = systems_allow_section
 +
 
 +
Lines 305-307 need to be altered to add the 370 ('''TsystemCpu''' will be adjusted to compensate):
 
       cpu2str : array[TSystemCpu] of string[10] =
 
       cpu2str : array[TSystemCpu] of string[10] =
 
             ('','i386','m68k','alpha','powerpc','sparc','vm','ia64','x86_64',
 
             ('','i386','m68k','alpha','powerpc','sparc','vm','ia64','x86_64',
             'mips','arm', 'powerpc64', 'avr', 'mipsel','i370');
+
             'mips','arm', 'powerpc64', 'avr', 'mipsel');
At around line 851 we have to indicate the target, replacing the one line
+
 
 +
becomes:
 +
      cpu2str : array[TSystemCpu] of string[10] =
 +
            ('','i386','m68k','alpha','powerpc','sparc','vm','ia64','x86_64',
 +
            'mips','arm', 'powerpc64', 'avr', 'mipsel','s370');
 +
At around line 851 we have to indicate the target operating system, which can be VS1 or Linux. We replace
 
  {$endif mips}
 
  {$endif mips}
to
+
with
 
  {$endif mips}
 
  {$endif mips}
  {$ifdef i370}
+
  {$ifdef s370}
   default_target(system_i370_mainframe);
+
  {$ifndef default_target_set}
  {$endif i370}
+
   default_target(system_s370_linux);
 +
  {$define default_target_set}
 +
  {$endif}
 +
  {$endif s370}
  
 
==systems.inc==
 
==systems.inc==
Line 164: Line 225:
 
to
 
to
 
             cpu_mipsel,                  { 13 }
 
             cpu_mipsel,                  { 13 }
             cpu_i370                     { 14 }     
+
             cpu_s370                     { 14 }     
About line 67, change
+
About line 67, change to add use of the gas assembler on linux, and the hlasm assembler under VS/1:
 
             ,asmmode_avr_gas
 
             ,asmmode_avr_gas
 
to
 
to
 
             ,asmmode_avr_gas
 
             ,asmmode_avr_gas
             ,asmmode_i370
+
             ,asmmode_s370_gas
About line 151, change
+
            ,asmmode_s370_hlasm
 +
About line 152, change
 
             system_powerpc_wii        { 70 }
 
             system_powerpc_wii        { 70 }
 
to
 
to
 
             system_powerpc_wii,        { 70 }
 
             system_powerpc_wii,        { 70 }
             system_i370_mainframe      { 71 }
+
             system_s370_linux,        { 71 }
 +
            system_s370_vs1,          { 72 }
 
About line 185, change
 
About line 185, change
 
             ,as_i386_nlmcoff
 
             ,as_i386_nlmcoff
 
to
 
to
 
             ,as_i386_nlmcoff
 
             ,as_i386_nlmcoff
             ,as_i370   
+
             ,as_s370_as
 +
            ,as_s370_hlasm
 
Otherwise seems okay for now.
 
Otherwise seems okay for now.
  
==Unit cutils==
 
:''Called from: '''compiler.pas; verbose.pas; systems.pas''', includes '''fpcdefs.inc''', no called units noted''
 
This provides a number of utility functions.  It also requires the target be defined as big endian, although that may only be important if the compiler is running on the target rather than on the cross-compiling host.
 
 
==Unit cfileutl==
 
:''Called from: '''compiler.pas''', includes '''fpcdefs.inc''', no called units noted''
 
(To be added later)
 
==Unit cclasses==
 
:''Called from: '''compiler.pas''', includes '''fpcdefs.inc''', no called units noted''
 
(To be added later)
 
 
==Unit globals==
 
==Unit globals==
:''Called from: '''compiler.pas''', includes '''fpcdefs.inc''', no called units noted''
+
:''Called from: '''compiler.pas; parser.pas; assemble.pas''', includes '''fpcdefs.inc''', no called units noted''
(To be added later)
+
'''globals.pas''' definitely provides direct processor-dependent information. We'll copy the default <code>{$ifdef GENERIC_CPU}</code> and change it for the i370.  At about line 424 substitute
==Unit options==
+
  {$endif mips}
:''Called from: '''compiler.pas''', includes '''fpcdefs.inc''', no called units noted''
+
with
(To be added later)
+
  {$endif mips}
==Unit fmodule==
+
  {$ifdef s370}
:''Called from: '''compiler.pas''', includes '''fpcdefs.inc''', no called units noted''
+
        cputype : cpu_s370;
(To be added later)
+
        optimizecputype : cpu_s370;
==Unit parser==
+
        fputype : fpu_s370;
:''Called from: '''compiler.pas''', includes '''fpcdefs.inc''', no called units noted''
+
  {$endif s370}
(To be added later)
 
==Unit symtable==
 
:''Called from: '''compiler.pas''', includes '''fpcdefs.inc''', no called units noted''
 
(To be added later)
 
==Unit assemble==
 
:''Called from: '''compiler.pas''', includes '''fpcdefs.inc''', no called units noted''
 
(To be added later)
 
==Unit link==
 
:''Called from: '''compiler.pas''', includes '''fpcdefs.inc''', no called units noted''
 
(To be added later)
 
==Unit dbgbase==
 
:''Called from: '''compiler.pas''', includes '''fpcdefs.inc''', no called units noted''
 
(To be added later)
 
==Unit import==
 
:''Called from: '''compiler.pas''', includes '''fpcdefs.inc''', no called units noted''
 
(To be added later)
 
==Unit export==
 
:''Called from: '''compiler.pas''', includes '''fpcdefs.inc''', no called units noted''
 
(To be added later)
 
==Unit tokens==
 
:''Called from: '''compiler.pas''', includes '''fpcdefs.inc''', no called units noted''
 
(To be added later)
 
==Unit pass_1==
 
:''Called from: '''compiler.pas''', includes '''fpcdefs.inc''', no called units noted''
 
(To be added later)
 
==Unit wpobase==
 
:''Called from: '''compiler.pas''', includes '''fpcdefs.inc''', no called units noted''
 
(To be added later)
 
==Unit wpo==
 
:''Called from: '''compiler.pas''', includes '''fpcdefs.inc''', no called units noted''
 
(To be added later)
 
==Unit cpupara==
 
:''Called from: '''compiler.pas''', includes '''fpcdefs.inc''', no called units noted''
 
(To be added later)
 
==Unit cpupi==
 
:''Called from: '''compiler.pas''', includes '''fpcdefs.inc''', no called units noted''
 
(To be added later)
 
==Unit cgcpu==
 
:''Called from: '''compiler.pas''', includes '''fpcdefs.inc''', no called units noted''
 
(To be added later)
 
==Unit cpunode==
 
:''Called from: '''compiler.pas''', includes '''fpcdefs.inc''', no called units noted''
 
(To be added later)
 
==Unit cputarg==
 
:''Called from: '''compiler.pas''', includes '''fpcdefs.inc''', no called units noted''
 
(To be added later)
 
==Unit globtype==
 
:''Called from: '''compiler.pas; verbose.pas; comphook.pas''', includes '''fpcdefs.inc''', no called units noted''
 
(To be added later)
 
==Unit finput==
 
:''Called from: '''verbose.pas; comphook.pas''', includes '''fpcdefs.inc''', no called units noted''
 
(To be added later)
 
==Unit cmsgs==
 
:''Called from: '''verbose.pas''', includes '''fpcdefs.inc''', no called units noted''
 
(To be added later)
 
==Unit i_i370==
 
:''Called from: '''compiler.pas''', includes '''fpcdefs.inc''', no called units noted''
 
(This will be created later once I know what has to go into it)
 
==t_i370.pas==
 
(The cross-compiler instructions say I'll need this.  Will figure out later.)
 
 
 
=Other files=
 
From the description for porting the compiler, a few other files have to be edited.
 
* utils/fpcm/fpcmmain.pp - add a new entry at the end of TCpu and TOs, near line 85:
 
<code>
 
      TCpu=(
 
        c_i386,c_m68k,c_powerpc,c_sparc,c_x86_64,c_arm,c_powerpc64,c_avr,c_armeb,
 
        c_armel,c_mips,c_mipsel,c_mips64,c_mips64el,c_i370
 
      );
 
 
 
      TOS=(
 
        o_linux,o_go32v2,o_win32,o_os2,o_freebsd,o_beos,o_haiku,o_netbsd,
 
        o_amiga,o_atari, o_solaris, o_qnx, o_netware, o_openbsd,o_wdosx,
 
        o_palmos,o_macos,o_darwin,o_emx,o_watcom,o_morphos,o_netwlibc,
 
        o_win64,o_wince,o_gba,o_nds,o_embedded,o_symbian,o_nativent,o_iphonesim,
 
        o_wii,o_i370
 
      );
 
</code>
 
About line 81, add the new item to these entries:
 
<code>
 
      CpuStr : array[TCpu] of string=(
 
        'i386','m68k','powerpc','sparc','x86_64','arm','powerpc64','avr','armeb',
 
        'armel', 'mips', 'mipsel', 'mips64', 'mips64el','i370'
 
      );
 
 
 
      CpuSuffix : array[TCpu] of string=(
 
        '_i386','_m68k','_powerpc','_sparc','_x86_64','_arm','_powerpc64','avr',
 
        '_armeb', '_armel', '_mips', '_mipsel', '_mips64', '_mips64el','_i370'
 
      );
 
 
 
      ppcSuffix : array[TCpu] of string=(
 
        '386','m68k','ppc','sparc','x86_64','arm','ppc64','avr','armeb', 'armel',
 
        'mips', 'mipsel', 'mips64', 'mips64el','i370'
 
      );
 
  
      OSStr : array[TOS] of string=(
+
At some point I probably should set the switches for a compiler for the i386 under windows and recompile, to be sure that my changes have not left the compiler in an unrebuildable state even if I don't implement anything for the S370 for a while.
        'linux','go32v2','win32','os2','freebsd','beos','haiku','netbsd',
 
        'amiga','atari','solaris', 'qnx', 'netware','openbsd','wdosx',
 
        'palmos','macos','darwin','emx','watcom','morphos','netwlibc',
 
        'win64','wince','gba','nds','embedded','symbian','nativent',
 
        'iphonesim', 'wii','i370'
 
      );
 
  
      OSSuffix : array[TOS] of string=(
+
To make this page a reasonable size, this list continues in [[ZSeries/Part 3|part 3]].
        '_linux','_go32v2','_win32','_os2','_freebsd','_beos','_haiku','_netbsd',
 
        '_amiga','_atari','_solaris', '_qnx', '_netware','_openbsd','_wdosx',
 
        '_palmos','_macos','_darwin','_emx','_watcom','_morphos','_netwlibc',
 
        '_win64','_wince','_gba','_nds','_embedded','_symbian','_nativent',
 
        '_iphonesim','_wii','_i370'
 
      );
 
</code>
 
And then this huge table is changed to the following:
 
<code>
 
  
      { This table is kept OS,Cpu because it is easier to maintain (PFV) }
 
      OSCpuPossible : array[TOS,TCpu] of boolean = (
 
        { os          i386    m68k  ppc    sparc  x86_64 arm    ppc64  avr    armeb  armel  mips  mipsel mips64 misp64el, i370}
 
        { linux }  ( true,  true,  true,  true,  true,  true,  true,  false, true,  false, false, true,  false,  false,  true),
 
        { go32v2 }  ( true,  false, false, false, false, false, false, false, false, false, false, false, false,  false,  false),
 
        { win32 }  ( true,  false, false, false, false, false, false, false, false, false, false, false, false,  false,  false),
 
        { os2 }    ( true,  false, false, false, false, false, false, false, false, false, false, false, false,  false,  false),
 
        { freebsd } ( true,  true,  false, false, true,  false, false, false, false, false, false, false, false,  false,  false),
 
        { beos }    ( true,  false, false, false, false, false, false, false, false, false, false, false, false,  false,  false),
 
        { haiku }  ( true,  false, false, false, false, false, false, false, false, false, false, false, false,  false,  false),
 
        { netbsd }  ( true,  true,  true,  true,  false, false, false, false, false, false, false, false, false,  false,  false),
 
        { amiga }  ( false, true,  true,  false, false, false, false, false, false, false, false, false, false,  false,  false),
 
        { atari }  ( false, true,  false, false, false, false, false, false, false, false, false, false, false,  false,  false),
 
        { solaris } ( true,  false, false, true,  true,  false, false, false, false, false, false, false, false,  false,  false),
 
        { qnx }    ( true,  false, false, false, false, false, false, false, false, false, false, false, false,  false,  false),
 
        { netware } ( true,  false, false, false, false, false, false, false, false, false, false, false, false,  false,  false),
 
        { openbsd } ( true,  true,  false, false, false, false, false, false, false, false, false, false, false,  false,  false),
 
        { wdosx }  ( true,  false, false, false, false, false, false, false, false, false, false, false, false,  false,  false),
 
        { palmos }  ( false, true,  false, false, false, true,  false, false, false, false, false, false, false,  false,  false),
 
        { macos }  ( false, false, true,  false, false, false, false, false, false, false, false, false, false,  false,  false),
 
        { darwin }  ( true,  false, true,  false, true,  true,  true,  false, false, false, false, false, false,  false,  false),
 
        { emx }    ( true,  false, false, false, false, false, false, false, false, false, false, false, false,  false,  false),
 
        { watcom }  ( true,  false, false, false ,false, false, false, false, false, false, false, false, false,  false,  false),
 
        { morphos } ( false, false, true,  false ,false, false, false, false, false, false, false, false, false,  false,  false),
 
        { netwlibc }( true,  false, false, false, false, false, false, false, false, false, false, false, false,  false,  false),
 
        { win64  } ( false, false, false, false, true,  false, false, false, false, false, false, false, false,  false,  false),
 
        { wince    }( true,  false, false, false, false, true,  false, false, false, false, false, false, false,  false,  false),
 
        { gba    }  ( false, false, false, false, false, true,  false, false, false, false, false, false, false,  false,  false),
 
        { nds    }  ( false, false, false, false, false, true,  false, false, false, false, false, false, false,  false,  false),
 
        { embedded }( true,  true,  true,  true,  true,  true,  true,  true,  true , false, false, false, false,  false,  false),
 
        { symbian } ( true,  false, false, false, false, true,  false, false, false, false, false, false, false,  false,  false),
 
        { nativent }( true,  false, false, false, false, false, false, false, false, false, false, false, false,  false,  false),
 
        { iphonesim }( true,  false, false, false, false, false, false, false, false, false, false, false, false, false,  false),
 
        { wii }    ( false, false, true,  false, false, false, false, false, false, false, false, false, false,  false,  false),
 
        { i370 }    ( false, false, false, false, false, false, false, false, false, false, false, false, false,  false,  true)
 
      );
 
</code>
 
  
  
 +
:''[[ZSeries|Go back to zSeries]]'' &mdash; [[ZSeries/Part 1|Go Back to Part 1]] &mdash; [[ZSeries/Part 3|Go Forward to Part 3]]
  
:''[[ZSeries|Go back to zSeries]]'' &mdash; [[ZSeries/Part 1|Go Back to Part 1]] &mdash; [[ZSeries/Part 3|Go Forward to Part 3]]
+
[[Category:Mainframes]]
{{Stub}}
+
[[Category:High-performance computing]]

Latest revision as of 16:41, 28 January 2014

Go back to zSeriesGo Back to Part 1Go Forward to Part 3

Because the number of places I have to look is lots of them, the list of units I go through is broken up into more than one page. I'll try to keep page lengths to a reasonable factor, if a page seems to be too large, I will split it and start a new section.

I'm also dropping references to files, units and modules that I don't have to change. This will keep the overhead low.

To Begin

This compiler is huge. (I've (re-)compiled it, and the rebuild of the Windows version is 262,000 lines of code.) It's hundreds of source files, and is going to be an enormous task. Where do you start? Well, you start with the main program of the command-line compiler, and you look at it. That file is pp.pas. Then you collect all of the units it uses, and you look at each one's source file, then you repeat this recursively, finding every place where there is a reference to a particular machine type or operating system and you add the particular cpu or operating system (or both) to it.

Note that line numbers indicated in any source file are from the version 2.6.0 compiler sources (I'll also look at the 2.6.2. sources which have just recently been released) and as such, as lines are added, other line numbers where things were found and changed will increase. So line numbers will be referenced in a file from top to bottom so the references should match. Also, so as not to brand this as "windows centric" since the hope is to build a cross-compiler for s370 that could run on either Windows or Linux, when file names are specified, directory separators will use /.

Note that from this point on, all editing occurs in our "sandbox" directory separate from the original compiler.

How units and include files are listed

Since this series of articles is intended to be a tutorial on how to add a new architecture to the compiler, files that call other files or units are listed at the top of the section dealing with that file. Where a unit is called by another, that caller is listed. Same for files that are included by other files. Any units the unit or file uses, are also listed. As new units which are referenced are found, they are added to the list of all the units that need to be checked and inspected, and potentially edited, as well as new units that have to be created.

This also helps since the list of modules is broken over several pages, so you can see where a module cross-references another one even if the references for both are not on the same page.

The format of the first line is generally like this (items not used will not appear on the line):

Called from: [file names that call this file as a unit, printed in bold] (or) main program, included by [files that call this file using include], includes [files that this file calls as include files], requires external procedures [non-Pascal procedures this unit uses], calls units [units that this unit or file uses] or "no called units noted" if it does not use any units

If the file is not normally in the Compiler directory that is noted, or if it is in a subdirectory. As items are noted in the source code of that file or unit, they will be mentioned.

The Free Pascal Compiler

pp.pas

Version 2.6.0

main program, includes fpcdefs.inc, calls units cmem, profile, catch, globals, compiler

pp.pas is the main program of the compiler. We're going to edit this file to create an IBM-370 cross-compiler. First, we'll decide what is the switch for this, as well as the names of the components. For the compiler switch or target environment, we'll use S370. Within the code, the cpu name is cpu_S370, floating-point processor is fpu_s370, and the operating system target is vse or linux because I have access to both environments.

So we'll start by adding "S370" to the source comments and wherever else needed to indicate that, by inserting the middle line in the comment block (line 34):

 VIS                 generate a compiler for the VIS
 S370                generate a compiler for the IBM 370/390/zSeries mainframes
 DEBUG               version with debug code is generated 
     

This program includes fpcdefs.inc so we'll check that later. We have to add the indication to only select one target compiler, so we'll select for I370 (about line 139, before the check that no CPU was defined:

{$endif AVR}
{$ifdef S370}
  {$ifdef CPUDEFINED}
    {$fatal ONLY one of the switches for the CPU type must be defined}
  {$endif CPUDEFINED}
  {$define CPUDEFINED}
{$endif S370}
{$ifndef CPUDEFINED}
  {$fatal A CPU type switch must be defined}
{$endif CPUDEFINED}

The rest of the main program seems to be okay, but we will have to go through and look at all the units that this program uses, which, depending on which options have been set, are or can be: cmem, profile, catch, globals, and compiler. Then follow those and see where they lead, and "lather, rinse, repeat." The rest of this file seems okay, so we'll save it. (If we don't change a file, we don't re-save it so as not to change the date and time of the last edit.)

Version 2.6.2

Line 34:

  VIS                 generate a compile for the VIS

Becomes:

  VIS                 generate a compiler for the VIS
  S370                generate a compiler for the IBM 370/390/zSeries mainframes

Lines 138 and 139:

{$endif AVR}
{$ifndef CPUDEFINED}

become:

{$endif AVR}
{$ifdef S370}
   {$ifdef CPUDEFINED}
     {$fatal ONLY one of the switches for the CPU type must be defined}
   {$endif CPUDEFINED}
   {$define CPUDEFINED}
{$endif S370}
{$ifndef CPUDEFINED}


fpcdefs.inc

Called as include file from pp.pas, called as include file from units catch, compiler, verbose (and virtually all other units), no called units noted

fpcdefs.inc provides various definitions regarding what processor we're compiling for to most units and many other files. We need to define the processor, so we'll borrow the generic one, and add or remove items as we need them. So we'll start with the block beginning with the line {$ifdef generic_cpu} through the line {$endif generic_cpu}. From later work, I discover I'll have to mark the target machine as big endian, so I'll include that. (Note that the definitions will include things as I discover them, so this may include things I haven't explained.)

Version 2.6.0

So on line 146, replace

{$endif mips}

{$IFDEF MACOS}    
 

With:

{$endif mips}

{$ifdef S370}
  {$define cpu32bit}
  {$define cpu32bitaddr}
  {$define cpu32bitalu}
  {$define cpuflags}
  {$define cpuextended}
  {$define ENDIAN_BIG}
{$endif S370}

{$IFDEF MACOS}      

Otherwise, now, fpcdefs.inc looks okay, so I'll save it.

Version 2.6.2

Line 153, replace:

{$endif mips}

{$IFDEF MACOS}    
 

With:

{$endif mips}

{$ifdef S370}
  {$define cpu32bit}
  {$define cpu32bitaddr}
  {$define cpu32bitalu}
  {$define cpuflags}
  {$define cpuextended}
  {$define ENDIAN_BIG}
{$endif S370}

{$IFDEF MACOS}      

Unit globals

Version 2.6.0

Called from: pp.pas; options.pas , includes fpcdefs.inc, calls unit comphook

globals.pas, starting at about line 372, has some definitions for specific target processors. So, again, I'll borrow from {$ifdef GENERIC_CPU} and change as necessary. At line 424, we have

 {$endif mips}

so we'll add the 370 after this, and put in the following:

 {$endif mips}
 {$ifdef S370}
       cputype : cpu_s370;
       optimizecputype : cpu_s370;
       fputype : fpu_s370;
 {$endif s370}

Note, these values will be defined elsewhere. Note that this unit references a few other units depending on the OS and machine, but the only one relevant to us will be comphook so we'll put that on the "stack" of units that have to be inspected and possibly edited.

Version 2.6.2

There were no changes, the above edits are the same.

Unit compiler

Version 2.6.0

Called from: pp.pas, includes fpcdefs.inc, calls units fksysutils, sysutils, math, verbose, comphook, systems, cutils, cfileutl, cclasses, globals, options, fmodule, parser, symtable, assemble, link, dbgbase, import, export, tokens, pass_1, wpobase, wpo, cpupara, cpupi, cgcpu, cpunode, cputarg, i_i370, globtype

Starting at about line 24, this unit lists the units it uses. Some units depend on other flags, but the units it does always require are: verbose, comphook, systems, cutils, cfileutl, cclasses, globals, options, fmodule, parser, symtable, assemble, link, dbgbase, import, export, tokens, pass_1, wpobase, wpo, cpupara, cpupi, cgcpu, cpunode, and cputarg. These are also added to the "stack" for checking on references.

This unit also defines the operaring that is the target for this compiler, so we have to add a unit which will define our target environment. There are units for every one being targeted, so we have to insert one. At line 116, change:

{$ifdef nativent}
  ,i_nativent
{$endif nativent}
  ,globtype;    

Replace with:

{$ifdef nativent}
  ,i_nativent
{$endif nativent}
{$ifdef vs1}
  ,i_vs1
{$endif vs1}
  ,globtype;    

This means we've now added a new source file which will eventually have to be created, i_vs1.pas for the new unit i_vs1, which almost certainly will be in the I370 subdirectory.

Version 2.6.2

This file has not been changed, the above changes are the same.

Unit fksysutils

This is only used if the particular architecture sets the flag that says it does not use the sysutils and math units. Given that all of them do use them, I will presume for now I do not need to create this file. Presume every unit that includes sysutils includes this file if necessary.

Unit sysutils

Version 2.6.0

Called from: compiler.pas; verbose.pas; cclasses.pas; parser.pas; assemble.pas; located in rtl/s370, includes fpcdefs.inc, no called units noted

This file is a local file for each architecture, so it will be in the s370 subdirectory of the rtl subdirectory. Need to make an s370 subdirectory in rtl as this is the first file included in it. I'll take a look at a couple of architectures to see what's expected to be included. It is used for platform dependent calls, is used by the listed units, and if there are no platform dependent calls, it will simply be a stub unit. For the moment, I'll just create a stub file and come back later if when I need to.

{

    This file is part of the Free Pascal run time library.
    Copyright (c) 2012 by Viridian Development Corporation

    Sysutils unit for IBM 370/390/zSystem

    See the file COPYING.FPC, included in this distribution,
    for details about the copyright.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 **********************************************************************}
unit sysutils;

interface
implementation

end.

Note that I'm using copyright in my company's name; this is to show that the Free Pascal team is not responsible for this code, if they want to include it as part of the regular distribution then they can have their name on it.

Version 2.6.2

No difference; use above.

Unit systems

Version 2.6.0

Called from: compiler.pas; cfileutl.pas; options.pas; parser.pas; assemble.pas, includes fpcdefs.inc; systems.inc, calls unit cutils

Lines 243-245:

      systems_allow_section = systems_embedded;

      systems_allow_section_no_semicolon = systems_allow_section

replaced with:

      systems_allow_section = systems_embedded;
	   
      systems_s370 = [system_s370_vs1,system_s370_linux];	   

      systems_allow_section_no_semicolon = systems_allow_section

Lines 305-307 need to be altered to add the 370 (TsystemCpu will be adjusted to compensate):

      cpu2str : array[TSystemCpu] of string[10] =
           (,'i386','m68k','alpha','powerpc','sparc','vm','ia64','x86_64',
            'mips','arm', 'powerpc64', 'avr', 'mipsel');

becomes:

      cpu2str : array[TSystemCpu] of string[10] =
           (,'i386','m68k','alpha','powerpc','sparc','vm','ia64','x86_64',
            'mips','arm', 'powerpc64', 'avr', 'mipsel','s370');

At around line 851 we have to indicate the target operating system, which can be VS1 or Linux. We replace

{$endif mips}

with

{$endif mips}
{$ifdef s370}
 {$ifndef default_target_set}
  default_target(system_s370_linux);
 {$define default_target_set}
 {$endif}
{$endif s370}

systems.inc

Called as include file from: systems.pas, no called units noted

This adds the cpu types available. About line 50, change

            cpu_mipsel                    { 13 }

to

            cpu_mipsel,                   { 13 }
            cpu_s370                      { 14 }    

About line 67, change to add use of the gas assembler on linux, and the hlasm assembler under VS/1:

           ,asmmode_avr_gas

to

           ,asmmode_avr_gas
           ,asmmode_s370_gas
           ,asmmode_s370_hlasm

About line 152, change

            system_powerpc_wii         { 70 }

to

            system_powerpc_wii,        { 70 }
            system_s370_linux,         { 71 }
            system_s370_vs1,           { 72 }

About line 185, change

            ,as_i386_nlmcoff

to

            ,as_i386_nlmcoff
            ,as_s370_as
            ,as_s370_hlasm

Otherwise seems okay for now.

Unit globals

Called from: compiler.pas; parser.pas; assemble.pas, includes fpcdefs.inc, no called units noted

globals.pas definitely provides direct processor-dependent information. We'll copy the default {$ifdef GENERIC_CPU} and change it for the i370. At about line 424 substitute

  {$endif mips}

with

  {$endif mips}
  {$ifdef s370}
        cputype : cpu_s370;
        optimizecputype : cpu_s370;
        fputype : fpu_s370;
  {$endif s370} 

At some point I probably should set the switches for a compiler for the i386 under windows and recompile, to be sure that my changes have not left the compiler in an unrebuildable state even if I don't implement anything for the S370 for a while.

To make this page a reasonable size, this list continues in part 3.


Go back to zSeriesGo Back to Part 1Go Forward to Part 3