agaxpgas.pas 4.7 KB

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