agas.pas 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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 agas;
  19. interface
  20. uses
  21. globals,systems,cobjects,aasm,strings,files
  22. agatt,cpubase;
  23. type
  24. palphaattasmlist=^talphaattasmlist;
  25. talphaattasmlist=object(tattasmlist)
  26. procedure WriteInstruction(P : PAI);virtual;
  27. end;
  28. implementation
  29. const
  30. op2str : array[tasmop] of string[14] = (
  31. 'addf','addg','addl','addq',
  32. 'adds','addt','amask','and','beq','bge',
  33. 'bgt','bic','bis','blbc','blbs','ble',
  34. 'blt','bne','br','bsr','call_pal','cmoveq',
  35. 'cmovge','cmovgt','cmovlbc','cmovlbs','cmovle','cmovlt',
  36. 'cmovne','cmpbge','cmpeq','cmpgeq','cmpgle','cmpglt',
  37. 'cmple','cmplt','cmpteq','cmptle','cmptlt','cmptun',
  38. 'cmpule','cmpult','cpys','cpyse','cpysn','ctlz',
  39. 'ctpop','cttz','cvtdg','cvtgd','cvtgf','cvtgq',
  40. 'cvtlq','cvtqf','cvtqg','cvtql','cvtqs','cvtqt',
  41. 'cvtst','cvttq','cvtts','divf','divg','divs',
  42. 'divt','ecb','eqv','excb','extbl','extlh',
  43. 'extll','extqh','extql','extwh','extwl','fbeq',
  44. 'fbge','fbgt','fble','fblt','fbne','fcmoveq',
  45. 'fcmovge','fcmovgt','fcmovle','fcmovlt','fcmovne','fetch',
  46. 'fetch_m','ftois','ftoit','implver','insbl','inslh',
  47. 'insll','insqh','insql','inswh','inswl','itoff',
  48. 'itofs','itoft','jmp','jsr','jsr_coroutine','lda',
  49. 'ldah','ldbu','ldwu','ldf','ldg','ldl',
  50. 'ldl_l','ldq','ldq_l','ldq_u','lds','ldt',
  51. 'maxsb8','maxsw4','maxub8','maxuw4','mb','mf_fpcr',
  52. 'minsb8','minsw4','minub8','minuw4','mskbl','msklh',
  53. 'mskll','mskqh','mskql','mskwh','mskwl','mt_fpcr',
  54. 'mulf','mulg','mull','mulq',
  55. 'muls','mult','ornot','perr','pklb','pkwb',
  56. 'rc','ret','rpcc','rs','s4addl','s4addq',
  57. 's4subl','s4subq','s8addl','s8addq','s8subl','s8subq',
  58. 'sextb','sextw','sll','sqrtf','sqrtg','sqrts',
  59. 'sqrtt','sra','srl','stb','stf','stg',
  60. 'sts','stl','stl_c','stq','stq_c','stq_u',
  61. 'stt','stw','subf','subg','subl',
  62. 'subq','subs','subt','trapb','umulh','unpkbl',
  63. 'unpkbw','wh64','wmb','xor','zap','zapnot');
  64. procedure tAlphaattasmlist.WriteInstruction (P : PAi);
  65. begin
  66. (*
  67. op:=paicpu(hp)^.opcode;
  68. calljmp:=is_calljmp(op);
  69. { call maybe not translated to calll }
  70. s:=#9+att_op2str[op]+cond2str[paicpu(hp)^.condition];
  71. if (not calljmp) and
  72. (not att_nosuffix[op]) and
  73. not(
  74. (paicpu(hp)^.oper[0].typ=top_reg) and
  75. (paicpu(hp)^.oper[0].reg in [R_ST..R_ST7])
  76. ) then
  77. s:=s+att_opsize2str[paicpu(hp)^.opsize];
  78. { process operands }
  79. if paicpu(hp)^.ops<>0 then
  80. begin
  81. { call and jmp need an extra handling }
  82. { this code is only called if jmp isn't a labeled instruction }
  83. if calljmp then
  84. s:=s+#9+getopstr_jmp(paicpu(hp)^.oper[0])
  85. else
  86. begin
  87. for i:=0to paicpu(hp)^.ops-1 do
  88. begin
  89. if i=0 then
  90. sep:=#9
  91. else
  92. sep:=',';
  93. s:=s+sep+getopstr(paicpu(hp)^.oper[i])
  94. end;
  95. end;
  96. end;
  97. AsmWriteLn(s);
  98. *)
  99. end;
  100. end.
  101. {
  102. $Log$
  103. Revision 1.2 2002-09-07 15:25:10 peter
  104. * old logs removed and tabs fixed
  105. Revision 1.1 2002/08/18 09:06:54 florian
  106. * alpha files moved compiler/alpha
  107. }