123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297 |
- {
- $Id$
- Copyright (c) 1999-2000 by Florian Klaempfl
- The declarations of the nodes for the new code generator
- 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.
- ****************************************************************************
- }
- {****************************************************************************
- TNODE
- ****************************************************************************}
- constructor tnode.init;
- begin
- inherited init;
- treetype:=nothingn;
- { this allows easier error tracing }
- location.loc:=LOC_INVALID;
- { save local info }
- fileinfo:=aktfilepos;
- localswitches:=aktlocalswitches;
- resulttype:=nil;
- registersint:=0;
- registersfpu:=0;
- {$ifdef SUPPORT_MMX}
- registersmmx:=0;
- {$endif SUPPORT_MMX}
- flags:=[];
- end;
- destructor tnode.done;
- begin
- { reference info }
- if (location.loc in [LOC_MEM,LOC_REFERENCE]) and
- assigned(location.reference.symbol) then
- dispose(location.reference.symbol,done);
- {$ifdef EXTDEBUG}
- if firstpasscount>maxfirstpasscount then
- maxfirstpasscount:=firstpasscount;
- {$endif EXTDEBUG}
- end;
- procedure tnode.pass_1;
- begin
- if not(assigned(resulttype)) then
- det_resulttype;
- det_temp;
- end;
- procedure tnode.det_resulttype;
- begin
- abstract;
- end;
- procedure tnode.det_temp;
- begin
- abstract;
- end;
- procedure tnode.secondpass;
- begin
- abstract;
- end;
- procedure tnode.concattolist(l : plinkedlist);
- begin
- l^.concat(@self);
- end;
- function tnode.ischild(p : pnode) : boolean;
- begin
- ischild:=false;
- end;
- {$ifdef EXTDEBUG}
- procedure tnode.dowrite;
- const treetype2str : array[ttreetyp] of string[20] = (
- 'addn',
- 'muln',
- 'subn',
- 'divn',
- 'symdifn',
- 'modn',
- 'assignn',
- 'loadn',
- 'rangen',
- 'ltn',
- 'lten',
- 'gtn',
- 'gten',
- 'equaln',
- 'unequaln',
- 'inn',
- 'orn',
- 'xorn',
- 'shrn',
- 'shln',
- 'slashn',
- 'andn',
- 'subscriptn',
- 'derefn',
- 'addrn',
- 'doubleaddrn',
- 'ordconstn',
- 'typeconvn',
- 'calln',
- 'callparan',
- 'realconstn',
- 'fixconstn',
- 'umminusn',
- 'asmn',
- 'vecn',
- 'stringconstn',
- 'funcretn',
- 'selfn',
- 'notn',
- 'inlinen',
- 'niln',
- 'errorn',
- 'typen',
- 'hnewn',
- 'hdisposen',
- 'newn',
- 'simpledisposen',
- 'setelementn',
- 'setconstn',
- 'blockn',
- 'statementn',
- 'loopn',
- 'ifn',
- 'breakn',
- 'continuen',
- 'repeatn',
- 'whilen',
- 'forn',
- 'exitn',
- 'withn',
- 'casen',
- 'labeln',
- 'goton',
- 'simplenewn',
- 'tryexceptn',
- 'raisen',
- 'switchesn',
- 'tryfinallyn',
- 'onn',
- 'isn',
- 'asn',
- 'caretn',
- 'failn',
- 'starstarn',
- 'procinlinen',
- 'arrayconstructn',
- 'arrayconstructrangen',
- 'nothingn',
- 'loadvmtn',
- 'pointerconstn');
- begin
- write(indention,'(',treetype2str[treetype]);
- end;
- {$endif EXTDEBUG}
- {****************************************************************************
- TUNARYNODE
- ****************************************************************************}
- constructor tunarynode.init(l : pnode);
- begin
- inherited init;
- left:=l;
- end;
- {$ifdef extdebug}
- procedure tunarynode.dowrite;
- begin
- inherited dowrite;
- writeln(',');
- writenode(left);
- writeln(')');
- dec(byte(indention[0]),2);
- end;
- {$endif}
- procedure tunarynode.concattolist(l : plinkedlist);
- begin
- left^.parent:=@self;
- left^.concattolist(l);
- inherited concattolist(l);
- end;
- function tunarynode.ischild(p : pnode) : boolean;
- begin
- ischild:=p=left;
- end;
- procedure tunarynode.det_resulttype;
- begin
- left^.det_resulttype;
- end;
- procedure tunarynode.det_temp;
- begin
- left^.det_temp;
- end;
- {****************************************************************************
- TBINARYNODE
- ****************************************************************************}
- constructor tbinarynode.init(l,r : pnode);
- begin
- inherited init(l);
- right:=r
- end;
- procedure tbinarynode.concattolist(l : plinkedlist);
- begin
- { we could change that depending on the number of }
- { required registers }
- left^.parent:=@self;
- left^.concattolist(l);
- left^.parent:=@self;
- left^.concattolist(l);
- inherited concattolist(l);
- end;
- function tbinarynode.ischild(p : pnode) : boolean;
- begin
- ischild:=(p=right) or (p=right);
- end;
- procedure tbinarynode.det_resulttype;
- begin
- left^.det_resulttype;
- right^.det_resulttype;
- end;
- procedure tbinarynode.det_temp;
- begin
- left^.det_temp;
- right^.det_temp;
- end;
- {****************************************************************************
- TBINOPYNODE
- ****************************************************************************}
- constructor tbinopnode.init(l,r : pnode);
- begin
- inherited init(l,r);
- swaped:=false;
- end;
- {
- $Log$
- Revision 1.2 2000-07-13 11:32:54 michael
- + removed logs
-
- }
|