From a387be19a015bf54d894954a8c8c8d858f1a6ff7 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Sun, 30 Apr 2006 20:50:37 +0000 Subject: [PATCH] + a_call_ref for ppc32 and ppc64 git-svn-id: trunk@3392 - --- .gitattributes | 1 + compiler/powerpc/cgcpu.pas | 4 +-- compiler/powerpc64/cgcpu.pas | 4 +-- compiler/ppcgen/cgppc.pas | 55 ++++++++++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 compiler/ppcgen/cgppc.pas diff --git a/.gitattributes b/.gitattributes index 25a3ede070..28c557af4f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -369,6 +369,7 @@ compiler/ppc.cfg -text compiler/ppc.conf -text compiler/ppc.dof -text compiler/ppc.dpr -text +compiler/ppcgen/cgppc.pas svneol=native#text/plain compiler/ppheap.pas svneol=native#text/plain compiler/ppu.pas svneol=native#text/plain compiler/procinfo.pas svneol=native#text/plain diff --git a/compiler/powerpc/cgcpu.pas b/compiler/powerpc/cgcpu.pas index cde931a256..11a53d37bb 100644 --- a/compiler/powerpc/cgcpu.pas +++ b/compiler/powerpc/cgcpu.pas @@ -27,13 +27,13 @@ unit cgcpu; uses globtype,symtype,symdef, - cgbase,cgobj, + cgbase,cgobj,cgppc, aasmbase,aasmcpu,aasmtai,aasmdata, cpubase,cpuinfo,cgutils,cg64f32,rgcpu, parabase; type - tcgppc = class(tcg) + tcgppc = class(tcgppcgen) procedure init_register_allocators;override; procedure done_register_allocators;override; diff --git a/compiler/powerpc64/cgcpu.pas b/compiler/powerpc64/cgcpu.pas index 0056c78b19..a9075cd540 100644 --- a/compiler/powerpc64/cgcpu.pas +++ b/compiler/powerpc64/cgcpu.pas @@ -27,13 +27,13 @@ interface uses globtype, symtype, symdef, symsym, - cgbase, cgobj, + cgbase, cgobj,cgppc, aasmbase, aasmcpu, aasmtai,aasmdata, cpubase, cpuinfo, cgutils, rgcpu, parabase; type - tcgppc = class(tcg) + tcgppc = class(tcgppcgen) procedure init_register_allocators; override; procedure done_register_allocators; override; diff --git a/compiler/ppcgen/cgppc.pas b/compiler/ppcgen/cgppc.pas new file mode 100644 index 0000000000..92adae4da8 --- /dev/null +++ b/compiler/ppcgen/cgppc.pas @@ -0,0 +1,55 @@ +{ + Copyright (c) 2006 by Florian Klaempfl + + This unit implements the common part of the code generator for the PowerPC + + 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 cgppc; + +{$i fpcdefs.inc} + + interface + + uses + globtype,symtype,symdef, + cgbase,cgobj, + aasmbase,aasmcpu,aasmtai,aasmdata, + cpubase,cpuinfo,cgutils,cg64f32,rgcpu, + parabase; + + type + tcgppcgen = class(tcg) + procedure a_call_ref(list : TAsmList;ref: treference); override; + end; + + implementation + + uses + globals,verbose,systems,cutils, + symconst,symsym,fmodule, + rgobj,tgobj,cpupi,procinfo,paramgr; + + procedure tcgppcgen.a_call_ref(list : TAsmList;ref: treference); + begin + a_reg_alloc(list,NR_R0); + a_load_ref_reg(list,OS_ADDR,OS_ADDR,ref,NR_R0); + a_call_reg(list,NR_R0); + a_reg_dealloc(list,NR_R0); + end; + +end.