~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to compiler/paramgr.pas

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
{
2
 
    $Id: paramgr.pas,v 1.74 2004/04/18 15:22:24 florian Exp $
3
 
    Copyright (c) 2002 by Florian Klaempfl
4
 
 
5
 
    Generic calling convention handling
6
 
 
7
 
    This program is free software; you can redistribute it and/or modify
8
 
    it under the terms of the GNU General Public License as published by
9
 
    the Free Software Foundation; either version 2 of the License, or
10
 
    (at your option) any later version.
11
 
 
12
 
    This program is distributed in the hope that it will be useful,
13
 
    but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 
    GNU General Public License for more details.
16
 
 
17
 
    You should have received a copy of the GNU General Public License
18
 
    along with this program; if not, write to the Free Software
19
 
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
 
 ****************************************************************************
21
 
}
22
 
{# Parameter passing manager. Used to manage how
23
 
   parameters are passed to routines.
24
 
}
25
 
unit paramgr;
26
 
 
27
 
{$i fpcdefs.inc}
28
 
 
29
 
  interface
30
 
 
31
 
    uses
32
 
       cclasses,globtype,
33
 
       cpubase,cgbase,
34
 
       aasmtai,
35
 
       symconst,symtype,symdef;
36
 
 
37
 
    type
38
 
       tvarargsinfo = (
39
 
         va_uses_float_reg
40
 
       );
41
 
 
42
 
       tvarargspara = class(tlinkedlist)
43
 
          varargsinfo : set of tvarargsinfo;
44
 
       end;
45
 
 
46
 
       {# This class defines some methods to take care of routine
47
 
          parameters. It should be overriden for each new processor
48
 
       }
49
 
       tparamanager = class
50
 
          {# Returns true if the return value is actually a parameter
51
 
             pointer.
52
 
          }
53
 
          function ret_in_param(def : tdef;calloption : tproccalloption) : boolean;virtual;
54
 
 
55
 
          function push_high_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;virtual;
56
 
 
57
 
          { Returns true if a parameter is too large to copy and only
58
 
            the address is pushed
59
 
          }
60
 
          function push_addr_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;virtual;
61
 
          { return the size of a push }
62
 
          function push_size(varspez:tvarspez;def : tdef;calloption : tproccalloption) : longint;
63
 
          { Returns true if a parameter needs to be copied on the stack, this
64
 
            is required for cdecl procedures
65
 
          }
66
 
          function copy_value_on_stack(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;virtual;
67
 
          {# Returns a structure giving the information on
68
 
            the storage of the parameter (which must be
69
 
            an integer parameter). This is only used when calling
70
 
            internal routines directly, where all parameters must
71
 
            be 4-byte values.
72
 
 
73
 
            In case the location is a register, this register is allocated.
74
 
            Call freeintparaloc() after the call to free the locations again.
75
 
            Default implementation: don't do anything at all (in case you don't
76
 
            use register parameter passing)
77
 
 
78
 
            @param(list Current assembler list)
79
 
            @param(nr Parameter number of routine, starting from 1)
80
 
          }
81
 
          function get_para_align(calloption : tproccalloption):byte;virtual;
82
 
          function get_volatile_registers_int(calloption : tproccalloption):tcpuregisterset;virtual;
83
 
          function get_volatile_registers_fpu(calloption : tproccalloption):tcpuregisterset;virtual;
84
 
          function get_volatile_registers_flags(calloption : tproccalloption):tcpuregisterset;virtual;
85
 
          function get_volatile_registers_mm(calloption : tproccalloption):tcpuregisterset;virtual;
86
 
          function getintparaloc(calloption : tproccalloption; nr : longint) : tparalocation;virtual;abstract;
87
 
 
88
 
          {# allocate a parameter location created with create_paraloc_info
89
 
 
90
 
            @param(list Current assembler list)
91
 
            @param(loc Parameter location)
92
 
          }
93
 
          procedure allocparaloc(list: taasmoutput; const loc: tparalocation); virtual;
94
 
 
95
 
          {# free a parameter location allocated with allocparaloc
96
 
 
97
 
            @param(list Current assembler list)
98
 
            @param(loc Parameter location)
99
 
          }
100
 
          procedure freeparaloc(list: taasmoutput; const loc: tparalocation); virtual;
101
 
 
102
 
          { This is used to populate the location information on all parameters
103
 
            for the routine as seen in either the caller or the callee. It returns
104
 
            the size allocated on the stack
105
 
          }
106
 
          function  create_paraloc_info(p : tabstractprocdef; side: tcallercallee):longint;virtual;abstract;
107
 
 
108
 
          { This is used to populate the location information on all parameters
109
 
            for the routine when it is being inlined. It returns
110
 
            the size allocated on the stack
111
 
          }
112
 
          function  create_inline_paraloc_info(p : tabstractprocdef):longint;virtual;
113
 
 
114
 
          { This is used to populate the location information on all parameters
115
 
            for the routine that are passed as varargs. It returns
116
 
            the size allocated on the stack (including the normal parameters)
117
 
          }
118
 
          function  create_varargs_paraloc_info(p : tabstractprocdef; varargspara:tvarargspara):longint;virtual;abstract;
119
 
 
120
 
          { Return the location of the low and high part of a 64bit parameter }
121
 
          procedure splitparaloc64(const locpara:tparalocation;var loclopara,lochipara:tparalocation);virtual;
122
 
 
123
 
          procedure alloctempregs(list: taasmoutput;var locpara:tparalocation);virtual;
124
 
          procedure alloctempparaloc(list: taasmoutput;calloption : tproccalloption;paraitem : tparaitem;var locpara:tparalocation);virtual;
125
 
 
126
 
          function parseparaloc(paraitem : tparaitem;const s : string) : boolean;virtual;abstract;
127
 
       end;
128
 
 
129
 
 
130
 
    var
131
 
       paramanager : tparamanager;
132
 
 
133
 
 
134
 
implementation
135
 
 
136
 
    uses
137
 
       cpuinfo,systems,
138
 
       cgutils,cgobj,tgobj,
139
 
       defutil,verbose;
140
 
 
141
 
    { true if uses a parameter as return value }
142
 
    function tparamanager.ret_in_param(def : tdef;calloption : tproccalloption) : boolean;
143
 
      begin
144
 
         ret_in_param:=(def.deftype in [arraydef,recorddef]) or
145
 
           ((def.deftype=stringdef) and (tstringdef(def).string_typ in [st_shortstring,st_longstring])) or
146
 
           ((def.deftype=procvardef) and (po_methodpointer in tprocvardef(def).procoptions)) or
147
 
           ((def.deftype=objectdef) and is_object(def)) or
148
 
           (def.deftype=variantdef) or
149
 
           ((def.deftype=setdef) and (tsetdef(def).settype<>smallset));
150
 
      end;
151
 
 
152
 
 
153
 
    function tparamanager.push_high_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;
154
 
      begin
155
 
         push_high_param:=not(calloption in [pocall_cdecl,pocall_cppdecl]) and
156
 
                          (
157
 
                           is_open_array(def) or
158
 
                           is_open_string(def) or
159
 
                           is_array_of_const(def)
160
 
                          );
161
 
      end;
162
 
 
163
 
 
164
 
    { true if a parameter is too large to copy and only the address is pushed }
165
 
    function tparamanager.push_addr_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;
166
 
      begin
167
 
        result:=false;
168
 
        { var,out always require address }
169
 
        if varspez in [vs_var,vs_out] then
170
 
          begin
171
 
            result:=true;
172
 
            exit;
173
 
          end;
174
 
        { Only vs_const, vs_value here }
175
 
        case def.deftype of
176
 
          variantdef,
177
 
          formaldef :
178
 
            result:=true;
179
 
          recorddef :
180
 
            result:=not(calloption in [pocall_cdecl,pocall_cppdecl]) and (def.size>pointer_size);
181
 
          arraydef :
182
 
            begin
183
 
              if (calloption in [pocall_cdecl,pocall_cppdecl]) then
184
 
               begin
185
 
                 { array of const values are pushed on the stack }
186
 
                 result:=not is_array_of_const(def);
187
 
               end
188
 
              else
189
 
               begin
190
 
                 result:=(
191
 
                          (tarraydef(def).highrange>=tarraydef(def).lowrange) and
192
 
                          (def.size>pointer_size)
193
 
                         ) or
194
 
                         is_open_array(def) or
195
 
                         is_array_of_const(def) or
196
 
                         is_array_constructor(def);
197
 
               end;
198
 
            end;
199
 
          objectdef :
200
 
            result:=is_object(def);
201
 
          stringdef :
202
 
            result:=not(calloption in [pocall_cdecl,pocall_cppdecl]) and (tstringdef(def).string_typ in [st_shortstring,st_longstring]);
203
 
          procvardef :
204
 
            result:=not(calloption in [pocall_cdecl,pocall_cppdecl]) and (po_methodpointer in tprocvardef(def).procoptions);
205
 
          setdef :
206
 
            result:=not(calloption in [pocall_cdecl,pocall_cppdecl]) and (tsetdef(def).settype<>smallset);
207
 
        end;
208
 
      end;
209
 
 
210
 
 
211
 
    { true if a parameter is too large to push and needs a concatcopy to get the value on the stack }
212
 
    function tparamanager.copy_value_on_stack(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;
213
 
      begin
214
 
        copy_value_on_stack:=false;
215
 
        { this is only for cdecl procedures with vs_const,vs_value }
216
 
        if not(
217
 
               (calloption in [pocall_cdecl,pocall_cppdecl]) and
218
 
               (varspez in [vs_value,vs_const])
219
 
              ) then
220
 
          exit;
221
 
        case def.deftype of
222
 
          variantdef,
223
 
          formaldef :
224
 
            copy_value_on_stack:=true;
225
 
          recorddef :
226
 
            copy_value_on_stack:=(def.size>pointer_size);
227
 
          arraydef :
228
 
            copy_value_on_stack:=(tarraydef(def).highrange>=tarraydef(def).lowrange) and
229
 
                                 (def.size>pointer_size);
230
 
          objectdef :
231
 
            copy_value_on_stack:=is_object(def);
232
 
          stringdef :
233
 
            copy_value_on_stack:=tstringdef(def).string_typ in [st_shortstring,st_longstring];
234
 
          procvardef :
235
 
            copy_value_on_stack:=(po_methodpointer in tprocvardef(def).procoptions);
236
 
          setdef :
237
 
            copy_value_on_stack:=(tsetdef(def).settype<>smallset);
238
 
        end;
239
 
      end;
240
 
 
241
 
 
242
 
    { return the size of a push }
243
 
    function tparamanager.push_size(varspez:tvarspez;def : tdef;calloption : tproccalloption) : longint;
244
 
      begin
245
 
        push_size:=-1;
246
 
        case varspez of
247
 
          vs_out,
248
 
          vs_var :
249
 
            push_size:=pointer_size;
250
 
          vs_value,
251
 
          vs_const :
252
 
            begin
253
 
                if push_addr_param(varspez,def,calloption) then
254
 
                  push_size:=pointer_size
255
 
                else
256
 
                  begin
257
 
                    { special array are normally pushed by addr, only for
258
 
                      cdecl array of const it comes here and the pushsize
259
 
                      is unknown }
260
 
                    if is_array_of_const(def) then
261
 
                      push_size:=0
262
 
                    else
263
 
                      push_size:=def.size;
264
 
                  end;
265
 
            end;
266
 
        end;
267
 
      end;
268
 
 
269
 
 
270
 
    function tparamanager.get_para_align(calloption : tproccalloption):byte;
271
 
      begin
272
 
        result:=std_param_align;
273
 
      end;
274
 
 
275
 
 
276
 
    function tparamanager.get_volatile_registers_int(calloption : tproccalloption):tcpuregisterset;
277
 
      begin
278
 
        result:=[];
279
 
      end;
280
 
 
281
 
 
282
 
    function tparamanager.get_volatile_registers_fpu(calloption : tproccalloption):tcpuregisterset;
283
 
      begin
284
 
        result:=[];
285
 
      end;
286
 
 
287
 
 
288
 
    function tparamanager.get_volatile_registers_flags(calloption : tproccalloption):tcpuregisterset;
289
 
      begin
290
 
        result:=[];
291
 
      end;
292
 
 
293
 
 
294
 
    function tparamanager.get_volatile_registers_mm(calloption : tproccalloption):tcpuregisterset;
295
 
      begin
296
 
        result:=[];
297
 
      end;
298
 
 
299
 
 
300
 
    procedure tparamanager.allocparaloc(list: taasmoutput; const loc: tparalocation);
301
 
      begin
302
 
        case loc.loc of
303
 
          LOC_REGISTER,
304
 
          LOC_CREGISTER,
305
 
          LOC_FPUREGISTER,
306
 
          LOC_CFPUREGISTER,
307
 
          LOC_MMREGISTER,
308
 
          LOC_CMMREGISTER :
309
 
            begin
310
 
              { NR_NO means we don't need to allocate the parameter.
311
 
                This is used for inlining parameters which allocates
312
 
                the parameters in gen_alloc_parast (PFV) }
313
 
              if loc.register<>NR_NO then
314
 
                cg.getexplicitregister(list,loc.register);
315
 
            end;
316
 
          LOC_REFERENCE,
317
 
          LOC_CREFERENCE :
318
 
            { do nothing by default, most of the time it's the framepointer }
319
 
          else
320
 
            internalerror(200306091);
321
 
        end;
322
 
        case loc.lochigh of
323
 
          LOC_INVALID :
324
 
            ;
325
 
          LOC_REGISTER,
326
 
          LOC_CREGISTER,
327
 
          LOC_FPUREGISTER,
328
 
          LOC_CFPUREGISTER,
329
 
          LOC_MMREGISTER,
330
 
          LOC_CMMREGISTER :
331
 
            begin
332
 
              { NR_NO means we don't need to allocate the parameter.
333
 
                This is used for inlining parameters which allocates
334
 
                the parameters in gen_alloc_parast (PFV) }
335
 
              if loc.registerhigh<>NR_NO then
336
 
                cg.getexplicitregister(list,loc.registerhigh);
337
 
            end;
338
 
          else
339
 
            internalerror(200306091);
340
 
        end;
341
 
      end;
342
 
 
343
 
 
344
 
    procedure tparamanager.freeparaloc(list: taasmoutput; const loc: tparalocation);
345
 
      var
346
 
        href : treference;
347
 
      begin
348
 
        case loc.loc of
349
 
          LOC_REGISTER, LOC_CREGISTER:
350
 
            begin
351
 
{$ifndef cpu64bit}
352
 
              if (loc.size in [OS_64,OS_S64,OS_F64]) then
353
 
                begin
354
 
                  cg.ungetregister(list,loc.registerhigh);
355
 
                  cg.ungetregister(list,loc.registerlow);
356
 
                end
357
 
              else
358
 
{$endif cpu64bit}
359
 
                cg.ungetregister(list,loc.register);
360
 
            end;
361
 
          LOC_MMREGISTER, LOC_CMMREGISTER,
362
 
          LOC_FPUREGISTER, LOC_CFPUREGISTER:
363
 
            cg.ungetregister(list,loc.register);
364
 
          LOC_REFERENCE,LOC_CREFERENCE:
365
 
            begin
366
 
{$ifdef cputargethasfixedstack}
367
 
              reference_reset_base(href,loc.reference.index,loc.reference.offset);
368
 
              tg.ungettemp(list,href);
369
 
{$endif cputargethasfixedstack}
370
 
            end;
371
 
          else
372
 
            internalerror(200306091);
373
 
        end;
374
 
        case loc.lochigh of
375
 
          LOC_INVALID :
376
 
            ;
377
 
          LOC_REGISTER,
378
 
          LOC_CREGISTER,
379
 
          LOC_FPUREGISTER,
380
 
          LOC_CFPUREGISTER,
381
 
          LOC_MMREGISTER,
382
 
          LOC_CMMREGISTER :
383
 
            cg.ungetregister(list,loc.register);
384
 
          else
385
 
            internalerror(200306091);
386
 
        end;
387
 
      end;
388
 
 
389
 
 
390
 
    procedure tparamanager.splitparaloc64(const locpara:tparalocation;var loclopara,lochipara:tparalocation);
391
 
      begin
392
 
        lochipara:=locpara;
393
 
        loclopara:=locpara;
394
 
        case locpara.size of
395
 
          OS_S128 :
396
 
            begin
397
 
              lochipara.size:=OS_S64;
398
 
              loclopara.size:=OS_64;
399
 
            end;
400
 
          OS_128 :
401
 
            begin
402
 
              lochipara.size:=OS_64;
403
 
              loclopara.size:=OS_64;
404
 
            end;
405
 
          OS_S64 :
406
 
            begin
407
 
              lochipara.size:=OS_S32;
408
 
              loclopara.size:=OS_32;
409
 
            end;
410
 
          OS_64 :
411
 
            begin
412
 
              lochipara.size:=OS_32;
413
 
              loclopara.size:=OS_32;
414
 
            end;
415
 
          else
416
 
            internalerror(200307023);
417
 
        end;
418
 
        loclopara.lochigh:=LOC_INVALID;
419
 
        lochipara.lochigh:=LOC_INVALID;
420
 
        case locpara.loc of
421
 
           LOC_REGISTER,
422
 
           LOC_CREGISTER,
423
 
           LOC_FPUREGISTER,
424
 
           LOC_CFPUREGISTER,
425
 
           LOC_MMREGISTER,
426
 
           LOC_CMMREGISTER :
427
 
             begin
428
 
               if locpara.lochigh=LOC_INVALID then
429
 
                 internalerror(200402061);
430
 
               loclopara.register:=locpara.registerlow;
431
 
               lochipara.register:=locpara.registerhigh;
432
 
             end;
433
 
           LOC_REFERENCE:
434
 
             begin
435
 
               if target_info.endian=endian_big then
436
 
                 inc(loclopara.reference.offset,tcgsize2size[loclopara.size])
437
 
               else
438
 
                 inc(lochipara.reference.offset,tcgsize2size[loclopara.size]);
439
 
             end;
440
 
           else
441
 
             internalerror(200307024);
442
 
        end;
443
 
      end;
444
 
 
445
 
 
446
 
    procedure tparamanager.alloctempregs(list: taasmoutput;var locpara:tparalocation);
447
 
      var
448
 
        cgsize : tcgsize;
449
 
      begin
450
 
        if locpara.lochigh<>LOC_INVALID then
451
 
          cgsize:=OS_INT
452
 
        else
453
 
          cgsize:=locpara.size;
454
 
        case locpara.loc of
455
 
          LOC_REGISTER:
456
 
            locpara.register:=cg.getintregister(list,cgsize);
457
 
          LOC_FPUREGISTER:
458
 
            locpara.register:=cg.getfpuregister(list,cgsize);
459
 
          LOC_MMREGISTER:
460
 
            locpara.register:=cg.getmmregister(list,cgsize);
461
 
          else
462
 
            internalerror(200308123);
463
 
        end;
464
 
        case locpara.lochigh of
465
 
          LOC_INVALID:
466
 
            ;
467
 
          LOC_REGISTER:
468
 
            locpara.registerhigh:=cg.getintregister(list,cgsize);
469
 
          LOC_FPUREGISTER:
470
 
            locpara.registerhigh:=cg.getfpuregister(list,cgsize);
471
 
          LOC_MMREGISTER:
472
 
            locpara.registerhigh:=cg.getmmregister(list,cgsize);
473
 
          else
474
 
            internalerror(200308124);
475
 
        end;
476
 
      end;
477
 
 
478
 
 
479
 
   procedure tparamanager.alloctempparaloc(list: taasmoutput;calloption : tproccalloption;paraitem : tparaitem;var locpara:tparalocation);
480
 
     var
481
 
       href : treference;
482
 
     begin
483
 
       tg.gettemp(list,paraitem.paratype.def.size,tt_persistent,href);
484
 
       locpara.loc:=LOC_REFERENCE;
485
 
       locpara.lochigh:=LOC_INVALID;
486
 
       locpara.reference.index:=href.base;
487
 
       locpara.reference.offset:=href.offset;
488
 
     end;
489
 
 
490
 
 
491
 
    function tparamanager.create_inline_paraloc_info(p : tabstractprocdef):longint;
492
 
      var
493
 
        hp : tparaitem;
494
 
        paraloc : tparalocation;
495
 
        parasize : longint;
496
 
      begin
497
 
        parasize:=0;
498
 
        hp:=tparaitem(p.para.first);
499
 
        while assigned(hp) do
500
 
          begin
501
 
            if push_addr_param(hp.paratyp,hp.paratype.def,p.proccalloption) then
502
 
              paraloc.size:=OS_ADDR
503
 
            else
504
 
              paraloc.size:=def_cgsize(hp.paratype.def);
505
 
            if paraloc.size=OS_NO then
506
 
              internalerror(200309301);
507
 
            { Indicate parameter is loaded in register, the register
508
 
              will be allocated when the allocpara is called }
509
 
            paraloc.loc:=LOC_REGISTER;
510
 
            paraloc.register:=NR_NO;
511
 
(*
512
 
                paraloc.loc:=LOC_REFERENCE;
513
 
                paraloc.reference.index:=NR_FRAME_POINTER_REG;
514
 
                l:=push_size(hp.paratyp,hp.paratype.def,p.proccalloption);
515
 
                varalign:=size_2_align(l);
516
 
                paraloc.reference.offset:=parasize+target_info.first_parm_offset;
517
 
                varalign:=used_align(varalign,p.paraalign,p.paraalign);
518
 
                parasize:=align(parasize+l,varalign);
519
 
*)
520
 
            hp.paraloc[callerside]:=paraloc;
521
 
            hp.paraloc[calleeside]:=paraloc;
522
 
            hp:=tparaitem(hp.next);
523
 
          end;
524
 
        { We need to return the size allocated }
525
 
        result:=parasize;
526
 
      end;
527
 
 
528
 
 
529
 
initialization
530
 
  ;
531
 
finalization
532
 
  paramanager.free;
533
 
end.
534
 
 
535
 
{
536
 
   $Log: paramgr.pas,v $
537
 
   Revision 1.74  2004/04/18 15:22:24  florian
538
 
     + location support for arguments, currently PowerPC/MorphOS only
539
 
 
540
 
   Revision 1.73  2004/03/07 00:16:59  florian
541
 
     * compilation of arm rtl fixed
542
 
 
543
 
   Revision 1.72  2004/03/06 20:35:19  florian
544
 
     * fixed arm compilation
545
 
     * cleaned up code generation for exported linux procedures
546
 
 
547
 
   Revision 1.71  2004/02/17 19:14:09  florian
548
 
     * temp. fix for lochigh para
549
 
 
550
 
   Revision 1.70  2004/02/09 22:48:45  florian
551
 
     * several fixes to parameter handling on arm
552
 
 
553
 
   Revision 1.69  2004/02/09 22:14:17  peter
554
 
     * more x86_64 parameter fixes
555
 
     * tparalocation.lochigh is now used to indicate if registerhigh
556
 
       is used and what the type is
557
 
 
558
 
   Revision 1.68  2003/12/28 22:09:12  florian
559
 
     + setting of bit 6 of cr for c var args on ppc implemented
560
 
 
561
 
   Revision 1.67  2003/12/06 01:15:22  florian
562
 
     * reverted Peter's alloctemp patch; hopefully properly
563
 
 
564
 
   Revision 1.66  2003/12/03 23:13:20  peter
565
 
     * delayed paraloc allocation, a_param_*() gets extra parameter
566
 
       if it needs to allocate temp or real paralocation
567
 
     * optimized/simplified int-real loading
568
 
 
569
 
   Revision 1.65  2003/10/29 21:24:14  jonas
570
 
     + support for fpu temp parameters
571
 
     + saving/restoring of fpu register before/after a procedure call
572
 
 
573
 
   Revision 1.64  2003/10/17 14:38:32  peter
574
 
     * 64k registers supported
575
 
     * fixed some memory leaks
576
 
 
577
 
   Revision 1.63  2003/10/11 16:06:42  florian
578
 
     * fixed some MMX<->SSE
579
 
     * started to fix ppc, needs an overhaul
580
 
     + stabs info improve for spilling, not sure if it works correctly/completly
581
 
     - MMX_SUPPORT removed from Makefile.fpc
582
 
 
583
 
   Revision 1.62  2003/10/10 17:48:13  peter
584
 
     * old trgobj moved to x86/rgcpu and renamed to trgx86fpu
585
 
     * tregisteralloctor renamed to trgobj
586
 
     * removed rgobj from a lot of units
587
 
     * moved location_* and reference_* to cgobj
588
 
     * first things for mmx register allocation
589
 
 
590
 
   Revision 1.61  2003/10/09 21:31:37  daniel
591
 
     * Register allocator splitted, ans abstract now
592
 
 
593
 
   Revision 1.60  2003/10/05 21:21:52  peter
594
 
     * c style array of const generates callparanodes
595
 
     * varargs paraloc fixes
596
 
 
597
 
   Revision 1.59  2003/10/03 22:00:33  peter
598
 
     * parameter alignment fixes
599
 
 
600
 
   Revision 1.58  2003/10/01 20:34:49  peter
601
 
     * procinfo unit contains tprocinfo
602
 
     * cginfo renamed to cgbase
603
 
     * moved cgmessage to verbose
604
 
     * fixed ppc and sparc compiles
605
 
 
606
 
   Revision 1.57  2003/09/30 21:02:37  peter
607
 
     * updates for inlining
608
 
 
609
 
   Revision 1.56  2003/09/23 17:56:05  peter
610
 
     * locals and paras are allocated in the code generation
611
 
     * tvarsym.localloc contains the location of para/local when
612
 
       generating code for the current procedure
613
 
 
614
 
   Revision 1.55  2003/09/16 16:17:01  peter
615
 
     * varspez in calls to push_addr_param
616
 
 
617
 
   Revision 1.54  2003/09/10 08:31:47  marco
618
 
    * Patch from Peter for paraloc
619
 
 
620
 
   Revision 1.53  2003/09/07 22:09:35  peter
621
 
     * preparations for different default calling conventions
622
 
     * various RA fixes
623
 
 
624
 
   Revision 1.52  2003/09/04 15:39:58  peter
625
 
     * released useparatemp
626
 
 
627
 
   Revision 1.51  2003/09/03 15:55:01  peter
628
 
     * NEWRA branch merged
629
 
 
630
 
   Revision 1.50.2.1  2003/08/29 17:28:59  peter
631
 
     * next batch of updates
632
 
 
633
 
   Revision 1.50  2003/08/11 21:18:20  peter
634
 
     * start of sparc support for newra
635
 
 
636
 
   Revision 1.49  2003/07/08 21:24:59  peter
637
 
     * sparc fixes
638
 
 
639
 
   Revision 1.48  2003/07/05 20:11:41  jonas
640
 
     * create_paraloc_info() is now called separately for the caller and
641
 
       callee info
642
 
     * fixed ppc cycle
643
 
 
644
 
   Revision 1.47  2003/07/02 22:18:04  peter
645
 
     * paraloc splitted in callerparaloc,calleeparaloc
646
 
     * sparc calling convention updates
647
 
 
648
 
   Revision 1.46  2003/06/17 16:32:03  peter
649
 
     * allocpara/freepara 64bit support
650
 
 
651
 
   Revision 1.45  2003/06/13 21:19:30  peter
652
 
     * current_procdef removed, use current_procinfo.procdef instead
653
 
 
654
 
   Revision 1.44  2003/06/12 21:11:10  peter
655
 
     * ungetregisterfpu gets size parameter
656
 
 
657
 
   Revision 1.43  2003/06/09 14:54:26  jonas
658
 
     * (de)allocation of registers for parameters is now performed properly
659
 
       (and checked on the ppc)
660
 
     - removed obsolete allocation of all parameter registers at the start
661
 
       of a procedure (and deallocation at the end)
662
 
 
663
 
   Revision 1.42  2003/06/08 10:54:41  jonas
664
 
     - disabled changing of LOC_*REGISTER to LOC_C*REGISTER in setparalocs,
665
 
       this is not necessary anymore (doesn't do anything anymore actually,
666
 
       except making sure the interface crc changes)
667
 
 
668
 
   Revision 1.41  2003/06/07 18:57:04  jonas
669
 
     + added freeintparaloc
670
 
     * ppc get/freeintparaloc now check whether the parameter regs are
671
 
       properly allocated/deallocated (and get an extra list para)
672
 
     * ppc a_call_* now internalerrors if pi_do_call is not yet set
673
 
     * fixed lot of missing pi_do_call's
674
 
 
675
 
   Revision 1.40  2003/05/31 15:05:28  peter
676
 
     * FUNCTION_RESULT64_LOW/HIGH_REG added for int64 results
677
 
 
678
 
   Revision 1.39  2003/05/30 23:57:08  peter
679
 
     * more sparc cleanup
680
 
     * accumulator removed, splitted in function_return_reg (called) and
681
 
       function_result_reg (caller)
682
 
 
683
 
   Revision 1.38  2003/05/13 15:16:13  peter
684
 
     * removed ret_in_acc, it's the reverse of ret_in_param
685
 
     * fixed ret_in_param for win32 cdecl array
686
 
 
687
 
   Revision 1.37  2003/04/30 22:15:59  florian
688
 
     * some 64 bit adaptions in ncgadd
689
 
     * x86-64 now uses ncgadd
690
 
     * tparamanager.ret_in_acc doesn't return true anymore for a void-def
691
 
 
692
 
   Revision 1.36  2003/04/27 11:21:33  peter
693
 
     * aktprocdef renamed to current_procinfo.procdef
694
 
     * procinfo renamed to current_procinfo
695
 
     * procinfo will now be stored in current_module so it can be
696
 
       cleaned up properly
697
 
     * gen_main_procsym changed to create_main_proc and release_main_proc
698
 
       to also generate a tprocinfo structure
699
 
     * fixed unit implicit initfinal
700
 
 
701
 
   Revision 1.35  2003/04/27 07:29:50  peter
702
 
     * current_procinfo.procdef cleanup, current_procdef is now always nil when parsing
703
 
       a new procdef declaration
704
 
     * aktprocsym removed
705
 
     * lexlevel removed, use symtable.symtablelevel instead
706
 
     * implicit init/final code uses the normal genentry/genexit
707
 
     * funcret state checking updated for new funcret handling
708
 
 
709
 
   Revision 1.34  2003/04/23 13:15:04  peter
710
 
     * fix push_high_param for cdecl
711
 
 
712
 
   Revision 1.33  2003/04/23 10:14:30  peter
713
 
     * cdecl array of const has no addr push
714
 
 
715
 
   Revision 1.32  2003/04/22 13:47:08  peter
716
 
     * fixed C style array of const
717
 
     * fixed C array passing
718
 
     * fixed left to right with high parameters
719
 
 
720
 
   Revision 1.31  2003/02/02 19:25:54  carl
721
 
     * Several bugfixes for m68k target (register alloc., opcode emission)
722
 
     + VIS target
723
 
     + Generic add more complete (still not verified)
724
 
 
725
 
   Revision 1.30  2003/01/08 18:43:56  daniel
726
 
    * Tregister changed into a record
727
 
 
728
 
   Revision 1.29  2002/12/23 20:58:03  peter
729
 
     * remove unused global var
730
 
 
731
 
   Revision 1.28  2002/12/17 22:19:33  peter
732
 
     * fixed pushing of records>8 bytes with stdcall
733
 
     * simplified hightree loading
734
 
 
735
 
   Revision 1.27  2002/12/06 16:56:58  peter
736
 
     * only compile cs_fp_emulation support when cpufpuemu is defined
737
 
     * define cpufpuemu for m68k only
738
 
 
739
 
   Revision 1.26  2002/11/27 20:04:09  peter
740
 
     * tvarsym.get_push_size replaced by paramanager.push_size
741
 
 
742
 
   Revision 1.25  2002/11/27 02:33:19  peter
743
 
     * copy_value_on_stack method added for cdecl record passing
744
 
 
745
 
   Revision 1.24  2002/11/25 17:43:21  peter
746
 
     * splitted defbase in defutil,symutil,defcmp
747
 
     * merged isconvertable and is_equal into compare_defs(_ext)
748
 
     * made operator search faster by walking the list only once
749
 
 
750
 
   Revision 1.23  2002/11/18 17:31:58  peter
751
 
     * pass proccalloption to ret_in_xxx and push_xxx functions
752
 
 
753
 
   Revision 1.22  2002/11/16 18:00:04  peter
754
 
     * only push small arrays on the stack for win32
755
 
 
756
 
   Revision 1.21  2002/10/05 12:43:25  carl
757
 
     * fixes for Delphi 6 compilation
758
 
      (warning : Some features do not work under Delphi)
759
 
 
760
 
   Revision 1.20  2002/09/30 07:07:25  florian
761
 
     * fixes to common code to get the alpha compiler compiled applied
762
 
 
763
 
   Revision 1.19  2002/09/30 07:00:47  florian
764
 
     * fixes to common code to get the alpha compiler compiled applied
765
 
 
766
 
   Revision 1.18  2002/09/09 09:10:51  florian
767
 
     + added generic tparamanager.getframepointerloc
768
 
 
769
 
   Revision 1.17  2002/09/07 19:40:39  florian
770
 
     * tvarsym.paraitem is set now
771
 
 
772
 
   Revision 1.16  2002/09/01 21:04:48  florian
773
 
     * several powerpc related stuff fixed
774
 
 
775
 
   Revision 1.15  2002/08/25 19:25:19  peter
776
 
     * sym.insert_in_data removed
777
 
     * symtable.insertvardata/insertconstdata added
778
 
     * removed insert_in_data call from symtable.insert, it needs to be
779
 
       called separatly. This allows to deref the address calculation
780
 
     * procedures now calculate the parast addresses after the procedure
781
 
       directives are parsed. This fixes the cdecl parast problem
782
 
     * push_addr_param has an extra argument that specifies if cdecl is used
783
 
       or not
784
 
 
785
 
   Revision 1.14  2002/08/17 22:09:47  florian
786
 
     * result type handling in tcgcal.pass_2 overhauled
787
 
     * better tnode.dowrite
788
 
     * some ppc stuff fixed
789
 
 
790
 
   Revision 1.13  2002/08/17 09:23:38  florian
791
 
     * first part of procinfo rewrite
792
 
 
793
 
   Revision 1.12  2002/08/16 14:24:58  carl
794
 
     * issameref() to test if two references are the same (then emit no opcodes)
795
 
     + ret_in_reg to replace ret_in_acc
796
 
       (fix some register allocation bugs at the same time)
797
 
     + save_std_register now has an extra parameter which is the
798
 
       usedinproc registers
799
 
 
800
 
   Revision 1.11  2002/08/12 15:08:40  carl
801
 
     + stab register indexes for powerpc (moved from gdb to cpubase)
802
 
     + tprocessor enumeration moved to cpuinfo
803
 
     + linker in target_info is now a class
804
 
     * many many updates for m68k (will soon start to compile)
805
 
     - removed some ifdef or correct them for correct cpu
806
 
 
807
 
   Revision 1.10  2002/08/10 17:15:20  jonas
808
 
     * register parameters are now LOC_CREGISTER instead of LOC_REGISTER
809
 
 
810
 
   Revision 1.9  2002/08/09 07:33:02  florian
811
 
     * a couple of interface related fixes
812
 
 
813
 
   Revision 1.8  2002/08/06 20:55:21  florian
814
 
     * first part of ppc calling conventions fix
815
 
 
816
 
   Revision 1.7  2002/08/05 18:27:48  carl
817
 
     + more more more documentation
818
 
     + first version include/exclude (can't test though, not enough scratch for i386 :()...
819
 
 
820
 
   Revision 1.6  2002/07/30 20:50:43  florian
821
 
     * the code generator knows now if parameters are in registers
822
 
 
823
 
   Revision 1.5  2002/07/26 21:15:39  florian
824
 
     * rewrote the system handling
825
 
 
826
 
   Revision 1.4  2002/07/20 11:57:55  florian
827
 
     * types.pas renamed to defbase.pas because D6 contains a types
828
 
       unit so this would conflicts if D6 programms are compiled
829
 
     + Willamette/SSE2 instructions to assembler added
830
 
 
831
 
   Revision 1.3  2002/07/13 19:38:43  florian
832
 
     * some more generic calling stuff fixed
833
 
 
834
 
   Revision 1.2  2002/07/13 07:17:15  jonas
835
 
     * fixed memory leak reported by  Sergey Korshunoff
836
 
 
837
 
   Revision 1.1  2002/07/11 14:41:28  florian
838
 
     * start of the new generic parameter handling
839
 
}
840
 
 
841