~ubuntu-branches/ubuntu/dapper/fpc/dapper

« back to all changes in this revision

Viewing changes to compiler/x86/agx86att.pas

  • Committer: Bazaar Package Importer
  • Author(s): Carlos Laviola
  • Date: 2005-05-30 11:59:10 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050530115910-x5pbzm4qqta4i94h
Tags: 2.0.0-2
debian/fp-compiler.postinst.in: forgot to reapply the patch that
correctly creates the slave link to pc(1).  (Closes: #310907)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
{
2
 
    $Id: agx86att.pas,v 1.13 2004/02/27 10:21:06 florian Exp $
 
2
    $Id: agx86att.pas,v 1.19 2005/02/14 17:13:10 peter Exp $
3
3
    Copyright (c) 1998-2002 by Florian Klaempfl
4
4
 
5
5
    This unit implements an asmoutput class for i386 AT&T syntax
30
30
 
31
31
    uses
32
32
      cclasses,cpubase,
33
 
      globals,
 
33
      globals,cgutils,
34
34
      aasmbase,aasmtai,assemble,aggas;
35
35
 
36
36
    type
50
50
      cutils,systems,
51
51
      verbose,
52
52
      itcpugas,
53
 
      cpuinfo,
54
53
      cgbase,
55
54
      aasmcpu;
56
55
 
71
70
             AsmWrite(gas_regname(segment)+':');
72
71
           if assigned(symbol) then
73
72
             AsmWrite(symbol.name);
 
73
           if ref.refaddr=addr_pic then
 
74
             AsmWrite('@GOTPCREL');
74
75
           if offset<0 then
75
76
             AsmWrite(tostr(offset))
76
77
           else
112
113
          top_reg :
113
114
            AsmWrite(gas_regname(o.reg));
114
115
          top_ref :
115
 
            if o.ref^.refaddr=addr_no then
 
116
            if o.ref^.refaddr in [addr_no,addr_pic] then
116
117
              WriteReference(o.ref^)
117
118
            else
118
119
              begin
129
130
                   AsmWrite('0');
130
131
              end;
131
132
          top_const :
132
 
            AsmWrite('$'+tostr(aint(o.val)));
 
133
              AsmWrite('$'+tostr(o.val));
133
134
          else
134
135
            internalerror(10001);
135
136
        end;
159
160
                end;
160
161
            end;
161
162
          top_const :
162
 
            AsmWrite(tostr(aint(o.val)));
 
163
            AsmWrite(tostr(o.val));
163
164
          else
164
165
            internalerror(10001);
165
166
        end;
177
178
        taicpu(hp).SetOperandOrder(op_att);
178
179
        op:=taicpu(hp).opcode;
179
180
        calljmp:=is_calljmp(op);
180
 
        { call maybe not translated to call }
181
 
        AsmWrite(#9+gas_op2str[op]+cond2str[taicpu(hp).condition]);
 
181
        AsmWrite(#9);
 
182
        { movsd should not be translated to movsl when there
 
183
          are (xmm) arguments }
 
184
        if (op=A_MOVSD) and (taicpu(hp).ops>0) then
 
185
          AsmWrite('movsd')
 
186
        else
 
187
          AsmWrite(gas_op2str[op]);
 
188
        AsmWrite(cond2str[taicpu(hp).condition]);
182
189
        { suffix needed ?  fnstsw,fldcw don't support suffixes
183
190
          with binutils 2.9.5 under linux }
184
191
{        if (Taicpu(hp).oper[0]^.typ=top_reg) and
234
241
            asmbin : 'as';
235
242
            asmcmd : '-o $OBJ $ASM';
236
243
            supported_target : system_any;
237
 
            outputbinary: false;
238
 
            allowdirect : true;
239
 
            needar : true;
240
 
            labelprefix_only_inside_procedure : false;
 
244
            flags : [af_allowdirect,af_needar,af_smartlink_sections,af_supports_dwarf];
241
245
            labelprefix : '.L';
242
246
            comment : '# ';
243
 
            secnames : ('',
244
 
              '.text','.data','.section .bss',
245
 
              '.section .idata$2','.section .idata$4','.section .idata$5',
246
 
                '.section .idata$6','.section .idata$7','.section .edata',
247
 
              '.stab','.stabstr','COMMON')
248
247
          );
249
248
{$else x86_64}
250
249
       as_i386_as_info : tasminfo =
254
253
            asmbin : 'as';
255
254
            asmcmd : '-o $OBJ $ASM';
256
255
            supported_target : system_any;
257
 
            outputbinary: false;
258
 
            allowdirect : true;
259
 
            needar : true;
260
 
            labelprefix_only_inside_procedure : false;
 
256
            flags : [af_allowdirect,af_needar,af_smartlink_sections];
261
257
            labelprefix : '.L';
262
258
            comment : '# ';
263
 
            secnames : ('',
264
 
              '.text','.data','.section .bss',
265
 
              '.section .idata$2','.section .idata$4','.section .idata$5',
266
 
                '.section .idata$6','.section .idata$7','.section .edata',
267
 
              '.stab','.stabstr','COMMON')
268
259
          );
269
260
 
270
261
       as_i386_as_aout_info : tasminfo =
274
265
            asmbin : 'as';
275
266
            asmcmd : '-o $OBJ $ASM';
276
267
            supported_target : system_any;
277
 
{            supported_target : system_i386_emx;}
278
 
            outputbinary: false;
279
 
            allowdirect : true;
280
 
            needar : true;
281
 
            labelprefix_only_inside_procedure : false;
 
268
            flags : [af_allowdirect,af_needar];
282
269
            labelprefix : 'L';
283
270
            comment : '# ';
284
 
            secnames : ('',
285
 
              '.text','.data','.bss',
286
 
              '','','','','','',
287
 
              '.stab','.stabstr','COMMON')
288
271
          );
289
272
{$endif x86_64}
290
273
 
298
281
end.
299
282
{
300
283
  $Log: agx86att.pas,v $
301
 
  Revision 1.13  2004/02/27 10:21:06  florian
302
 
    * top_symbol killed
303
 
    + refaddr to treference added
304
 
    + refsymbol to treference added
305
 
    * top_local stuff moved to an extra record to save memory
306
 
    + aint introduced
307
 
    * tppufile.get/putint64/aint implemented
308
 
 
309
 
  Revision 1.12  2003/12/24 00:33:10  florian
310
 
    * x86-64 compilation fixed
311
 
 
312
 
  Revision 1.11  2003/11/12 16:05:40  florian
313
 
    * assembler readers OOPed
314
 
    + typed currency constants
315
 
    + typed 128 bit float constants if the CPU supports it
316
 
 
317
 
  Revision 1.10  2003/10/28 18:46:49  peter
318
 
    * fix crash with ops=0
319
 
 
320
 
  Revision 1.9  2003/10/21 15:15:36  peter
321
 
    * taicpu_abstract.oper[] changed to pointers
322
 
 
323
 
  Revision 1.8  2003/10/02 21:18:06  peter
324
 
    * remove asw
325
 
 
326
 
  Revision 1.7  2003/10/01 20:34:50  peter
327
 
    * procinfo unit contains tprocinfo
328
 
    * cginfo renamed to cgbase
329
 
    * moved cgmessage to verbose
330
 
    * fixed ppc and sparc compiles
331
 
 
332
 
  Revision 1.6  2003/09/23 17:56:06  peter
333
 
    * locals and paras are allocated in the code generation
334
 
    * tvarsym.localloc contains the location of para/local when
335
 
      generating code for the current procedure
336
 
 
337
 
  Revision 1.5  2003/09/03 15:55:02  peter
338
 
    * NEWRA branch merged
339
 
 
340
 
  Revision 1.4.2.1  2003/08/31 15:46:26  peter
341
 
    * more updates for tregister
342
 
 
343
 
  Revision 1.4  2003/08/18 11:49:47  daniel
344
 
    * Made ATT asm writer work with -sr
345
 
 
346
 
  Revision 1.3  2003/05/28 23:18:31  florian
347
 
    * started to fix and clean up the sparc port
348
 
 
349
 
  Revision 1.2  2003/05/22 21:33:31  peter
350
 
    * removed some unit dependencies
351
 
 
352
 
  Revision 1.1  2003/04/25 12:04:31  florian
353
 
    * merged agx64att and ag386att to x86/agx86att
354
 
 
355
 
  Revision 1.31  2003/03/23 23:33:10  hajny
356
 
    + emx target added
357
 
 
358
 
  Revision 1.30  2003/02/19 22:00:15  daniel
359
 
    * Code generator converted to new register notation
360
 
    - Horribily outdated todo.txt removed
361
 
 
362
 
  Revision 1.29  2003/01/08 18:43:57  daniel
363
 
   * Tregister changed into a record
364
 
 
365
 
  Revision 1.28  2003/01/05 13:36:53  florian
366
 
    * x86-64 compiles
367
 
    + very basic support for float128 type (x86-64 only)
368
 
 
369
 
  Revision 1.27  2002/12/24 18:10:34  peter
370
 
    * Long symbol names support
371
 
 
372
 
  Revision 1.26  2002/08/12 15:08:40  carl
373
 
    + stab register indexes for powerpc (moved from gdb to cpubase)
374
 
    + tprocessor enumeration moved to cpuinfo
375
 
    + linker in target_info is now a class
376
 
    * many many updates for m68k (will soon start to compile)
377
 
    - removed some ifdef or correct them for correct cpu
378
 
 
379
 
  Revision 1.25  2002/07/26 21:15:42  florian
380
 
    * rewrote the system handling
381
 
 
382
 
  Revision 1.24  2002/07/07 09:52:33  florian
383
 
    * powerpc target fixed, very simple units can be compiled
384
 
    * some basic stuff for better callparanode handling, far from being finished
385
 
 
386
 
  Revision 1.23  2002/07/01 18:46:29  peter
387
 
    * internal linker
388
 
    * reorganized aasm layer
389
 
 
390
 
  Revision 1.22  2002/05/18 13:34:21  peter
391
 
    * readded missing revisions
392
 
 
393
 
  Revision 1.21  2002/05/16 19:46:49  carl
394
 
  + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
395
 
  + try to fix temp allocation (still in ifdef)
396
 
  + generic constructor calls
397
 
  + start of tassembler / tmodulebase class cleanup
398
 
 
399
 
  Revision 1.19  2002/05/12 16:53:16  peter
400
 
    * moved entry and exitcode to ncgutil and cgobj
401
 
    * foreach gets extra argument for passing local data to the
402
 
      iterator function
403
 
    * -CR checks also class typecasts at runtime by changing them
404
 
      into as
405
 
    * fixed compiler to cycle with the -CR option
406
 
    * fixed stabs with elf writer, finally the global variables can
407
 
      be watched
408
 
    * removed a lot of routines from cga unit and replaced them by
409
 
      calls to cgobj
410
 
    * u32bit-s32bit updates for and,or,xor nodes. When one element is
411
 
      u32bit then the other is typecasted also to u32bit without giving
412
 
      a rangecheck warning/error.
413
 
    * fixed pascal calling method with reversing also the high tree in
414
 
      the parast, detected by tcalcst3 test
415
 
 
416
 
  Revision 1.18  2002/04/15 19:12:10  carl
417
 
  + target_info.size_of_pointer -> pointer_size
418
 
  + some cleanup of unused types/variables
419
 
  * move several constants from cpubase to their specific units
420
 
    (where they are used)
421
 
  + att_Reg2str -> gas_reg2str
422
 
  + int_reg2str -> std_reg2str
423
 
 
424
 
  Revision 1.17  2002/04/14 16:58:04  carl
425
 
  + move into aggas most of the stuff non-processor specific
426
 
 
427
 
  Revision 1.16  2002/04/10 08:07:55  jonas
428
 
    * fix for the ie9999 under Linux (patch from Peter)
429
 
 
430
 
  Revision 1.15  2002/04/04 19:06:06  peter
431
 
    * removed unused units
432
 
    * use tlocation.size in cg.a_*loc*() routines
433
 
 
434
 
  Revision 1.14  2002/04/04 18:26:55  carl
435
 
  + added wdosx patch from Pavel
436
 
 
437
 
  Revision 1.13  2002/04/02 17:11:33  peter
438
 
    * tlocation,treference update
439
 
    * LOC_CONSTANT added for better constant handling
440
 
    * secondadd splitted in multiple routines
441
 
    * location_force_reg added for loading a location to a register
442
 
      of a specified size
443
 
    * secondassignment parses now first the right and then the left node
444
 
      (this is compatible with Kylix). This saves a lot of push/pop especially
445
 
      with string operations
446
 
    * adapted some routines to use the new cg methods
 
284
  Revision 1.19  2005/02/14 17:13:10  peter
 
285
    * truncate log
 
286
 
 
287
  Revision 1.18  2005/02/06 00:05:56  florian
 
288
    + x86_64 pic draft
447
289
 
448
290
}