raarm.pas 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. {
  2. Copyright (c) 1998-2003 by Carl Eric Codere and Peter Vreman
  3. Handles the common arm assembler reader routines
  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 raarm;
  18. {$i fpcdefs.inc}
  19. interface
  20. uses
  21. cpubase,
  22. aasmtai,aasmdata,
  23. rautils;
  24. type
  25. TARMOperand=class(TOperand)
  26. end;
  27. TARMInstruction=class(TInstruction)
  28. oppostfix : toppostfix;
  29. wideformat : boolean; // For wide(32bit) instructions of the thumb-2 instruction set
  30. function ConcatInstruction(p:TAsmList) : tai;override;
  31. end;
  32. implementation
  33. uses
  34. globals,
  35. cpuinfo,
  36. aasmcpu;
  37. function TARMInstruction.ConcatInstruction(p:TAsmList) : tai;
  38. begin
  39. result:=inherited ConcatInstruction(p);
  40. (result as taicpu).oppostfix:=oppostfix;
  41. if wideformat then
  42. include((result as taicpu).flags,cf_wideformat)
  43. else
  44. exclude((result as taicpu).flags,cf_wideformat);
  45. { GNU As assumes implicit S postfix for some instructions in thumb mode }
  46. if (current_settings.instructionset=is_thumb) and (((result as taicpu).oppostfix=PF_None) and ((opcode=A_MOV) and ((result as taicpu).oper[1]^.typ=top_const)) or (opcode=A_MVN)) then
  47. (result as taicpu).oppostfix:=PF_S
  48. end;
  49. end.