agaxpgas.pas 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 by Florian Klaempfl
  4. This unit implements an asm for the DEC Alpha
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. unit agaxpgas;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. globals,systems,aasmbase,aasmtai,
  23. aggas,cpubase;
  24. type
  25. TAXPGNUAssembler=class(TGNUAssembler)
  26. procedure WriteInstruction(hp : tai);override;
  27. end;
  28. const
  29. gas_reg2str : array[tregister] of string[4] = (
  30. '',
  31. '','','','','','','','','','',
  32. '','','','','','','','','','',
  33. '','','','','','','','','','',
  34. '','',
  35. '','','','','','','','','','',
  36. '','','','','','','','','','',
  37. '','','','','','','','','','',
  38. '',''
  39. );
  40. implementation
  41. const
  42. op2str : array[tasmop] of string[14] = (
  43. 'addf','addg','addl','addq',
  44. 'adds','addt','amask','and','beq','bge',
  45. 'bgt','bic','bis','blbc','blbs','ble',
  46. 'blt','bne','br','bsr','call_pal','cmoveq',
  47. 'cmovge','cmovgt','cmovlbc','cmovlbs','cmovle','cmovlt',
  48. 'cmovne','cmpbge','cmpeq','cmpgeq','cmpgle','cmpglt',
  49. 'cmple','cmplt','cmpteq','cmptle','cmptlt','cmptun',
  50. 'cmpule','cmpult','cpys','cpyse','cpysn','ctlz',
  51. 'ctpop','cttz','cvtdg','cvtgd','cvtgf','cvtgq',
  52. 'cvtlq','cvtqf','cvtqg','cvtql','cvtqs','cvtqt',
  53. 'cvtst','cvttq','cvtts','divf','divg','divs',
  54. 'divt','ecb','eqv','excb','extbl','extlh',
  55. 'extll','extqh','extql','extwh','extwl','fbeq',
  56. 'fbge','fbgt','fble','fblt','fbne','fcmoveq',
  57. 'fcmovge','fcmovgt','fcmovle','fcmovlt','fcmovne','fetch',
  58. 'fetch_m','ftois','ftoit','implver','insbl','inslh',
  59. 'insll','insqh','insql','inswh','inswl','itoff',
  60. 'itofs','itoft','jmp','jsr','jsr_coroutine','lda',
  61. 'ldah','ldbu','ldwu','ldf','ldg','ldl',
  62. 'ldl_l','ldq','ldq_l','ldq_u','lds','ldt',
  63. 'maxsb8','maxsw4','maxub8','maxuw4','mb','mf_fpcr',
  64. 'minsb8','minsw4','minub8','minuw4','mskbl','msklh',
  65. 'mskll','mskqh','mskql','mskwh','mskwl','mt_fpcr',
  66. 'mulf','mulg','mull','mulq',
  67. 'muls','mult','ornot','perr','pklb','pkwb',
  68. 'rc','ret','rpcc','rs','s4addl','s4addq',
  69. 's4subl','s4subq','s8addl','s8addq','s8subl','s8subq',
  70. 'sextb','sextw','sll','sqrtf','sqrtg','sqrts',
  71. 'sqrtt','sra','srl','stb','stf','stg',
  72. 'sts','stl','stl_c','stq','stq_c','stq_u',
  73. 'stt','stw','subf','subg','subl',
  74. 'subq','subs','subt','trapb','umulh','unpkbl',
  75. 'unpkbw','wh64','wmb','xor','zap','zapnot',
  76. 'ldgp');
  77. procedure TAXPGNUAssembler.WriteInstruction (hp : tai);
  78. begin
  79. (*
  80. op:=paicpu(hp)^.opcode;
  81. calljmp:=is_calljmp(op);
  82. { call maybe not translated to calll }
  83. s:=#9+att_op2str[op]+cond2str[paicpu(hp)^.condition];
  84. if (not calljmp) and
  85. (not att_nosuffix[op]) and
  86. not(
  87. (paicpu(hp)^.oper[0].typ=top_reg) and
  88. (paicpu(hp)^.oper[0].reg in [R_ST..R_ST7])
  89. ) then
  90. s:=s+att_opsize2str[paicpu(hp)^.opsize];
  91. { process operands }
  92. if paicpu(hp)^.ops<>0 then
  93. begin
  94. { call and jmp need an extra handling }
  95. { this code is only called if jmp isn't a labeled instruction }
  96. if calljmp then
  97. s:=s+#9+getopstr_jmp(paicpu(hp)^.oper[0])
  98. else
  99. begin
  100. for i:=0to paicpu(hp)^.ops-1 do
  101. begin
  102. if i=0 then
  103. sep:=#9
  104. else
  105. sep:=',';
  106. s:=s+sep+getopstr(paicpu(hp)^.oper[i])
  107. end;
  108. end;
  109. end;
  110. AsmWriteLn(s);
  111. *)
  112. end;
  113. end.
  114. {
  115. $Log$
  116. Revision 1.1 2002-09-29 23:42:45 florian
  117. * several fixes to get forward with alpha compilation
  118. Revision 1.2 2002/09/07 15:25:10 peter
  119. * old logs removed and tabs fixed
  120. Revision 1.1 2002/08/18 09:06:54 florian
  121. * alpha files moved compiler/alpha
  122. }