itarmgas.pas 3.6 KB

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