itcpugas.pas 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. {
  2. Copyright (c) 1998-2002 by Florian Klaempfl
  3. This unit contains the ARM GAS instruction tables
  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 itcpugas;
  18. {$i fpcdefs.inc}
  19. interface
  20. uses
  21. cpubase,cgbase;
  22. const
  23. { Standard opcode string table (for each tasmop enumeration). The
  24. opcode strings should conform to the names as defined by the
  25. processor manufacturer.
  26. }
  27. gas_op2str : op2strtable = (
  28. '','adc','add','and','n','bic','bkpt','b','bl','blx','bx',
  29. 'cdp','cdp2','clz','cmn','cmp','eor','ldc','ldc2',
  30. 'ldm','ldr','ldrb','ldrd','ldrbt','ldrh','ldrsb',
  31. 'ldrsh','ldrt','mcr','mcr2','mcrr','mla','mov',
  32. 'mrc','mrc2','mrrc','rs','msr','mul','mvn',
  33. 'orr','pld','qadd','qdadd','qdsub','qsub','rsb','rsc',
  34. 'sbc','smlal','smull','smul',
  35. 'smulw','stc','stc2','stm','str','strb','strbt','strd',
  36. 'strh','strt','sub','swi','swp','swpb','teq','tst',
  37. 'umlal','umull',
  38. { FPA coprocessor codes }
  39. 'ldf','stf','lfm','sfm','flt','fix','wfs','rfs','rfc',
  40. 'adf','dvf','fdv','fml','frd','muf','pol','pw','rdf',
  41. 'rmf','rpw','rsf','suf','abs','acs','asn','atn','cos',
  42. 'exp','log','lgn','mvf','mnf','nrm','rnd','sin','sqt','tan','urd',
  43. 'cmf','cmfe','cnf'
  44. { VPA coprocessor codes }
  45. );
  46. function gas_regnum_search(const s:string):Tregister;
  47. function gas_regname(r:Tregister):string;
  48. implementation
  49. uses
  50. cutils,verbose;
  51. const
  52. gas_regname_table : array[tregisterindex] of string[7] = (
  53. {$i rarmstd.inc}
  54. );
  55. gas_regname_index : array[tregisterindex] of tregisterindex = (
  56. {$i rarmsri.inc}
  57. );
  58. function findreg_by_gasname(const s:string):tregisterindex;
  59. var
  60. i,p : tregisterindex;
  61. begin
  62. {Binary search.}
  63. p:=0;
  64. i:=regnumber_count_bsstart;
  65. repeat
  66. if (p+i<=high(tregisterindex)) and (gas_regname_table[gas_regname_index[p+i]]<=s) then
  67. p:=p+i;
  68. i:=i shr 1;
  69. until i=0;
  70. if gas_regname_table[gas_regname_index[p]]=s then
  71. findreg_by_gasname:=gas_regname_index[p]
  72. else
  73. findreg_by_gasname:=0;
  74. end;
  75. function gas_regnum_search(const s:string):Tregister;
  76. begin
  77. result:=regnumber_table[findreg_by_gasname(s)];
  78. end;
  79. function gas_regname(r:Tregister):string;
  80. var
  81. p : tregisterindex;
  82. begin
  83. p:=findreg_by_number(r);
  84. if p<>0 then
  85. result:=gas_regname_table[p]
  86. else
  87. result:=generic_regname(r);
  88. end;
  89. end.