* create/destroy also the high level code generator for all architectures,

so it can be used in generic code

git-svn-id: branches/jvmbackend@18280 -
This commit is contained in:
Jonas Maebe 2011-08-20 07:21:16 +00:00
parent db203431b2
commit 72e9cfee24
12 changed files with 379 additions and 11 deletions

8
.gitattributes vendored
View File

@ -53,6 +53,7 @@ compiler/arm/cpunode.pas svneol=native#text/plain
compiler/arm/cpupara.pas svneol=native#text/plain compiler/arm/cpupara.pas svneol=native#text/plain
compiler/arm/cpupi.pas svneol=native#text/plain compiler/arm/cpupi.pas svneol=native#text/plain
compiler/arm/cputarg.pas svneol=native#text/plain compiler/arm/cputarg.pas svneol=native#text/plain
compiler/arm/hlcgcpu.pas svneol=native#text/plain
compiler/arm/itcpugas.pas svneol=native#text/plain compiler/arm/itcpugas.pas svneol=native#text/plain
compiler/arm/narmadd.pas svneol=native#text/plain compiler/arm/narmadd.pas svneol=native#text/plain
compiler/arm/narmcal.pas svneol=native#text/plain compiler/arm/narmcal.pas svneol=native#text/plain
@ -164,6 +165,7 @@ compiler/i386/cpupi.pas svneol=native#text/plain
compiler/i386/cputarg.pas svneol=native#text/plain compiler/i386/cputarg.pas svneol=native#text/plain
compiler/i386/csopt386.pas svneol=native#text/plain compiler/i386/csopt386.pas svneol=native#text/plain
compiler/i386/daopt386.pas svneol=native#text/plain compiler/i386/daopt386.pas svneol=native#text/plain
compiler/i386/hlcgcpu.pas svneol=native#text/plain
compiler/i386/i386att.inc svneol=native#text/plain compiler/i386/i386att.inc svneol=native#text/plain
compiler/i386/i386atts.inc svneol=native#text/plain compiler/i386/i386atts.inc svneol=native#text/plain
compiler/i386/i386int.inc svneol=native#text/plain compiler/i386/i386int.inc svneol=native#text/plain
@ -218,6 +220,7 @@ compiler/m68k/cpunode.pas svneol=native#text/plain
compiler/m68k/cpupara.pas svneol=native#text/plain compiler/m68k/cpupara.pas svneol=native#text/plain
compiler/m68k/cpupi.pas svneol=native#text/plain compiler/m68k/cpupi.pas svneol=native#text/plain
compiler/m68k/cputarg.pas svneol=native#text/plain compiler/m68k/cputarg.pas svneol=native#text/plain
compiler/m68k/hlcgcpu.pas svneol=native#text/plain
compiler/m68k/itcpugas.pas svneol=native#text/plain compiler/m68k/itcpugas.pas svneol=native#text/plain
compiler/m68k/m68kreg.dat svneol=native#text/plain compiler/m68k/m68kreg.dat svneol=native#text/plain
compiler/m68k/n68kadd.pas svneol=native#text/plain compiler/m68k/n68kadd.pas svneol=native#text/plain
@ -251,6 +254,7 @@ compiler/mips/cpunode.pas svneol=native#text/plain
compiler/mips/cpupara.pas svneol=native#text/plain compiler/mips/cpupara.pas svneol=native#text/plain
compiler/mips/cpupi.pas svneol=native#text/plain compiler/mips/cpupi.pas svneol=native#text/plain
compiler/mips/cputarg.pas svneol=native#text/pascal compiler/mips/cputarg.pas svneol=native#text/pascal
compiler/mips/hlcgcpu.pas svneol=native#text/plain
compiler/mips/itcpugas.pas svneol=native#text/plain compiler/mips/itcpugas.pas svneol=native#text/plain
compiler/mips/mipsreg.dat svneol=native#text/plain compiler/mips/mipsreg.dat svneol=native#text/plain
compiler/mips/ncpuadd.pas svneol=native#text/plain compiler/mips/ncpuadd.pas svneol=native#text/plain
@ -378,6 +382,7 @@ compiler/powerpc/cpunode.pas svneol=native#text/plain
compiler/powerpc/cpupara.pas svneol=native#text/plain compiler/powerpc/cpupara.pas svneol=native#text/plain
compiler/powerpc/cpupi.pas svneol=native#text/plain compiler/powerpc/cpupi.pas svneol=native#text/plain
compiler/powerpc/cputarg.pas svneol=native#text/plain compiler/powerpc/cputarg.pas svneol=native#text/plain
compiler/powerpc/hlcgcpu.pas svneol=native#text/plain
compiler/powerpc/itcpugas.pas svneol=native#text/plain compiler/powerpc/itcpugas.pas svneol=native#text/plain
compiler/powerpc/nppcadd.pas svneol=native#text/plain compiler/powerpc/nppcadd.pas svneol=native#text/plain
compiler/powerpc/nppccal.pas svneol=native#text/plain compiler/powerpc/nppccal.pas svneol=native#text/plain
@ -412,6 +417,7 @@ compiler/powerpc64/cpunode.pas svneol=native#text/plain
compiler/powerpc64/cpupara.pas svneol=native#text/plain compiler/powerpc64/cpupara.pas svneol=native#text/plain
compiler/powerpc64/cpupi.pas svneol=native#text/plain compiler/powerpc64/cpupi.pas svneol=native#text/plain
compiler/powerpc64/cputarg.pas svneol=native#text/plain compiler/powerpc64/cputarg.pas svneol=native#text/plain
compiler/powerpc64/hlcgcpu.pas svneol=native#text/plain
compiler/powerpc64/itcpugas.pas svneol=native#text/plain compiler/powerpc64/itcpugas.pas svneol=native#text/plain
compiler/powerpc64/nppcadd.pas svneol=native#text/plain compiler/powerpc64/nppcadd.pas svneol=native#text/plain
compiler/powerpc64/nppccal.pas svneol=native#text/plain compiler/powerpc64/nppccal.pas svneol=native#text/plain
@ -487,6 +493,7 @@ compiler/sparc/cpunode.pas svneol=native#text/plain
compiler/sparc/cpupara.pas svneol=native#text/plain compiler/sparc/cpupara.pas svneol=native#text/plain
compiler/sparc/cpupi.pas svneol=native#text/plain compiler/sparc/cpupi.pas svneol=native#text/plain
compiler/sparc/cputarg.pas svneol=native#text/plain compiler/sparc/cputarg.pas svneol=native#text/plain
compiler/sparc/hlcgcpu.pas svneol=native#text/plain
compiler/sparc/itcpugas.pas svneol=native#text/plain compiler/sparc/itcpugas.pas svneol=native#text/plain
compiler/sparc/ncpuadd.pas svneol=native#text/plain compiler/sparc/ncpuadd.pas svneol=native#text/plain
compiler/sparc/ncpucall.pas svneol=native#text/plain compiler/sparc/ncpucall.pas svneol=native#text/plain
@ -644,6 +651,7 @@ compiler/x86_64/cpunode.pas svneol=native#text/plain
compiler/x86_64/cpupara.pas svneol=native#text/plain compiler/x86_64/cpupara.pas svneol=native#text/plain
compiler/x86_64/cpupi.pas svneol=native#text/plain compiler/x86_64/cpupi.pas svneol=native#text/plain
compiler/x86_64/cputarg.pas svneol=native#text/plain compiler/x86_64/cputarg.pas svneol=native#text/plain
compiler/x86_64/hlcgcpu.pas svneol=native#text/plain
compiler/x86_64/nx64add.pas svneol=native#text/plain compiler/x86_64/nx64add.pas svneol=native#text/plain
compiler/x86_64/nx64cal.pas svneol=native#text/plain compiler/x86_64/nx64cal.pas svneol=native#text/plain
compiler/x86_64/nx64cnv.pas svneol=native#text/plain compiler/x86_64/nx64cnv.pas svneol=native#text/plain

45
compiler/arm/hlcgcpu.pas Normal file
View File

@ -0,0 +1,45 @@
{
Copyright (c) 1998-2010 by Florian Klaempfl and Jonas Maebe
Member of the Free Pascal development team
This unit contains routines to create a pass-through high-level code
generator. This is used by most regular code generators.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
****************************************************************************
}
unit hlcgcpu;
{$i fpcdefs.inc}
interface
procedure create_hlcodegen;
implementation
uses
hlcgobj, hlcg2ll,
cgcpu;
procedure create_hlcodegen;
begin
hlcg:=thlcg2ll.create;
create_codegen;
end;
end.

View File

@ -59,7 +59,7 @@ uses
aasmdata,aasmtai,aasmcpu, aasmdata,aasmtai,aasmcpu,
fmodule, fmodule,
cgbase,cgutils,cpubase,cgobj, cgbase,cgutils,cpubase,cgobj,
cgcpu, cgcpu,hlcgobj,hlcgcpu,
ncgutil, ncgutil,
verbose; verbose;
@ -136,7 +136,7 @@ var
r : treference; r : treference;
{$endif x86} {$endif x86}
begin begin
create_codegen; create_hlcodegen;
new_section(current_asmdata.asmlists[al_procedures],sec_code,'',0); new_section(current_asmdata.asmlists[al_procedures],sec_code,'',0);
hp2:=texported_item(current_module._exports.first); hp2:=texported_item(current_module._exports.first);
while assigned(hp2) do while assigned(hp2) do
@ -182,7 +182,7 @@ begin
end; end;
hp2:=texported_item(hp2.next); hp2:=texported_item(hp2.next);
end; end;
destroy_codegen; destroy_hlcodegen;
end; end;

45
compiler/i386/hlcgcpu.pas Normal file
View File

@ -0,0 +1,45 @@
{
Copyright (c) 1998-2010 by Florian Klaempfl and Jonas Maebe
Member of the Free Pascal development team
This unit contains routines to create a pass-through high-level code
generator. This is used by most regular code generators.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
****************************************************************************
}
unit hlcgcpu;
{$i fpcdefs.inc}
interface
procedure create_hlcodegen;
implementation
uses
hlcgobj, hlcg2ll,
cgcpu;
procedure create_hlcodegen;
begin
hlcg:=thlcg2ll.create;
create_codegen;
end;
end.

45
compiler/m68k/hlcgcpu.pas Normal file
View File

@ -0,0 +1,45 @@
{
Copyright (c) 1998-2010 by Florian Klaempfl and Jonas Maebe
Member of the Free Pascal development team
This unit contains routines to create a pass-through high-level code
generator. This is used by most regular code generators.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
****************************************************************************
}
unit hlcgcpu;
{$i fpcdefs.inc}
interface
procedure create_hlcodegen;
implementation
uses
hlcgobj, hlcg2ll,
cgcpu;
procedure create_hlcodegen;
begin
hlcg:=thlcg2ll.create;
create_codegen;
end;
end.

45
compiler/mips/hlcgcpu.pas Normal file
View File

@ -0,0 +1,45 @@
{
Copyright (c) 1998-2010 by Florian Klaempfl and Jonas Maebe
Member of the Free Pascal development team
This unit contains routines to create a pass-through high-level code
generator. This is used by most regular code generators.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
****************************************************************************
}
unit hlcgcpu;
{$i fpcdefs.inc}
interface
procedure create_hlcodegen;
implementation
uses
hlcgobj, hlcg2ll,
cgcpu;
procedure create_hlcodegen;
begin
hlcg:=thlcg2ll.create;
create_codegen;
end;
end.

View File

@ -174,7 +174,7 @@ implementation
regvars,dbgbase, regvars,dbgbase,
pass_1,pass_2, pass_1,pass_2,
nbas,ncon,nld,nmem,nutils, nbas,ncon,nld,nmem,nutils,
tgobj,cgobj,cgcpu tgobj,cgobj,cgcpu,hlcgobj,hlcgcpu
{$ifdef powerpc} {$ifdef powerpc}
, cpupi , cpupi
{$endif} {$endif}
@ -2482,7 +2482,7 @@ implementation
procedure gen_external_stub(list:TAsmList;pd:tprocdef;const externalname:string); procedure gen_external_stub(list:TAsmList;pd:tprocdef;const externalname:string);
begin begin
create_codegen; create_hlcodegen;
{ add the procedure to the al_procedures } { add the procedure to the al_procedures }
maybe_new_object_file(list); maybe_new_object_file(list);
new_section(list,sec_code,lower(pd.mangledname),current_settings.alignment.procalign); new_section(list,sec_code,lower(pd.mangledname),current_settings.alignment.procalign);
@ -2493,7 +2493,7 @@ implementation
list.concat(Tai_symbol.createname(pd.mangledname,AT_FUNCTION,0)); list.concat(Tai_symbol.createname(pd.mangledname,AT_FUNCTION,0));
cg.g_external_wrapper(list,pd,externalname); cg.g_external_wrapper(list,pd,externalname);
destroy_codegen; destroy_hlcodegen;
end; end;
{**************************************************************************** {****************************************************************************
@ -3030,7 +3030,7 @@ implementation
def : tdef; def : tdef;
begin begin
if not nested then if not nested then
create_codegen; create_hlcodegen;
for i:=0 to st.DefList.Count-1 do for i:=0 to st.DefList.Count-1 do
begin begin
def:=tdef(st.DefList[i]); def:=tdef(st.DefList[i]);
@ -3041,7 +3041,7 @@ implementation
gen_intf_wrapper(list,tobjectdef(def)); gen_intf_wrapper(list,tobjectdef(def));
end; end;
if not nested then if not nested then
destroy_codegen; destroy_hlcodegen;
end; end;

View File

@ -0,0 +1,45 @@
{
Copyright (c) 1998-2010 by Florian Klaempfl and Jonas Maebe
Member of the Free Pascal development team
This unit contains routines to create a pass-through high-level code
generator. This is used by most regular code generators.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
****************************************************************************
}
unit hlcgcpu;
{$i fpcdefs.inc}
interface
procedure create_hlcodegen;
implementation
uses
hlcgobj, hlcg2ll,
cgcpu;
procedure create_hlcodegen;
begin
hlcg:=thlcg2ll.create;
create_codegen;
end;
end.

View File

@ -0,0 +1,45 @@
{
Copyright (c) 1998-2010 by Florian Klaempfl and Jonas Maebe
Member of the Free Pascal development team
This unit contains routines to create a pass-through high-level code
generator. This is used by most regular code generators.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
****************************************************************************
}
unit hlcgcpu;
{$i fpcdefs.inc}
interface
procedure create_hlcodegen;
implementation
uses
hlcgobj, hlcg2ll,
cgcpu;
procedure create_hlcodegen;
begin
hlcg:=thlcg2ll.create;
create_codegen;
end;
end.

View File

@ -98,7 +98,7 @@ implementation
scanner,import,gendef, scanner,import,gendef,
pbase,pstatmnt,pdecl,pdecsub,pexports, pbase,pstatmnt,pdecl,pdecsub,pexports,
{ codegen } { codegen }
tgobj,cgbase,cgobj,cgcpu,dbgbase, tgobj,cgbase,cgobj,cgcpu,hlcgobj,hlcgcpu,dbgbase,
ncgutil,regvars, ncgutil,regvars,
optbase, optbase,
opttail, opttail,
@ -945,7 +945,7 @@ implementation
{ only do secondpass if there are no errors } { only do secondpass if there are no errors }
if (ErrorCount=0) then if (ErrorCount=0) then
begin begin
create_codegen; create_hlcodegen;
{ set the start offset to the start of the temp area in the stack } { set the start offset to the start of the temp area in the stack }
tg:=ttgobj.create; tg:=ttgobj.create;
@ -1259,7 +1259,7 @@ implementation
{ stop tempgen and ra } { stop tempgen and ra }
tg.free; tg.free;
cg.done_register_allocators; cg.done_register_allocators;
destroy_codegen; destroy_hlcodegen;
tg:=nil; tg:=nil;
end; end;

View File

@ -0,0 +1,45 @@
{
Copyright (c) 1998-2010 by Florian Klaempfl and Jonas Maebe
Member of the Free Pascal development team
This unit contains routines to create a pass-through high-level code
generator. This is used by most regular code generators.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
****************************************************************************
}
unit hlcgcpu;
{$i fpcdefs.inc}
interface
procedure create_hlcodegen;
implementation
uses
hlcgobj, hlcg2ll,
cgcpu;
procedure create_hlcodegen;
begin
hlcg:=thlcg2ll.create;
create_codegen;
end;
end.

View File

@ -0,0 +1,45 @@
{
Copyright (c) 1998-2010 by Florian Klaempfl and Jonas Maebe
Member of the Free Pascal development team
This unit contains routines to create a pass-through high-level code
generator. This is used by most regular code generators.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
****************************************************************************
}
unit hlcgcpu;
{$i fpcdefs.inc}
interface
procedure create_hlcodegen;
implementation
uses
hlcgobj, hlcg2ll,
cgcpu;
procedure create_hlcodegen;
begin
hlcg:=thlcg2ll.create;
create_codegen;
end;
end.