fpc/compiler/i8086/n8086cnv.pas
nickysn e8b9d9bf41 * converted tcgtypeconvnode.second_nil_to_methodprocvar to the high level code
generator, so it handles i8086 near and far pointers generically
- removed t8086typeconvnode.second_nil_to_methodprocvar, since it's no longer
  necessary

git-svn-id: trunk@27678 -
2014-04-28 01:05:14 +00:00

78 lines
2.3 KiB
ObjectPascal

{
Copyright (c) 1998-2002 by Florian Klaempfl
Generate code for i8086 assembler for type converting nodes
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 n8086cnv;
{$i fpcdefs.inc}
interface
uses
node,ncgcnv,nx86cnv,defutil,defcmp;
type
{ t8086typeconvnode }
t8086typeconvnode = class(tx86typeconvnode)
protected
function typecheck_proc_to_procvar: tnode;override;
procedure second_proc_to_procvar;override;
end;
implementation
uses
verbose,systems,globals,globtype,
aasmbase,aasmtai,aasmdata,aasmcpu,
symconst,symdef,symcpu,
cgbase,cga,procinfo,pass_1,pass_2,
ncon,ncal,ncnv,
cpubase,cpuinfo,
cgutils,cgobj,hlcgobj,cgx86,ncgutil,
tgobj;
function t8086typeconvnode.typecheck_proc_to_procvar: tnode;
begin
if (current_settings.x86memorymodel in x86_far_code_models) and
not is_proc_far(tabstractprocdef(left.resultdef)) then
CGMessage1(type_e_procedure_must_be_far,left.resultdef.GetTypeName);
Result:=inherited typecheck_proc_to_procvar;
end;
procedure t8086typeconvnode.second_proc_to_procvar;
begin
if is_proc_far(tabstractprocdef(resultdef))<>
(current_settings.x86memorymodel in x86_far_code_models) then
internalerror(2014041302);
if is_proc_far(tabstractprocdef(left.resultdef))<>
(current_settings.x86memorymodel in x86_far_code_models) then
internalerror(2014041303);
inherited;
end;
begin
ctypeconvnode:=t8086typeconvnode
end.