2
0

aasmcfi.pas 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. {
  2. Copyright (c) 2019 by Jonas Maebe, member of the
  3. Free Pascal Compiler development team
  4. Dwarf Call Frame Information directives
  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 aasmcfi;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. globtype,
  23. cgbase,
  24. aasmtai;
  25. type
  26. tcfikind =
  27. (cfi_startproc,
  28. cfi_endproc,
  29. cfi_personality,
  30. cfi_personality_id,
  31. cfi_fde_data,
  32. cfi_lsda_encoding,
  33. cfi_inline_lsda,
  34. cfi_def_cfa,
  35. cfi_def_cfa_register,
  36. cfi_def_cfa_offset,
  37. cfi_adjust_cfa_offset,
  38. cfi_offset,
  39. cfi_val_offset,
  40. cfi_rel_offset,
  41. cfi_register,
  42. cfi_restore,
  43. cfi_undefined,
  44. cfi_same_value,
  45. cfi_remember_state,
  46. cfi_restore_state,
  47. cfi_return_column,
  48. cfi_signal_frame,
  49. cfi_window_save,
  50. cfi_escape,
  51. cfi_val_encoded_addr
  52. );
  53. {$push}
  54. {$j-}
  55. const
  56. cfi2str: array[tcfikind] of string[length('.cfi_adjust_cfa_offset')] =
  57. ('.cfi_startproc',
  58. '.cfi_endproc',
  59. '.cfi_personality',
  60. '.cfi_personality_id',
  61. '.cfi_fde_data',
  62. '.cfi_lsda_encoding',
  63. '.cfi_inline_lsda',
  64. '.cfi_def_cfa',
  65. '.cfi_def_cfa_register',
  66. '.cfi_def_cfa_offset',
  67. '.cfi_adjust_cfa_offset',
  68. '.cfi_offset',
  69. '.cfi_val_offset',
  70. '.cfi_rel_offset',
  71. '.cfi_register',
  72. '.cfi_restore',
  73. '.cfi_undefined',
  74. '.cfi_same_value',
  75. '.cfi_remember_state',
  76. '.cfi_restore_state',
  77. '.cfi_return_column',
  78. '.cfi_signal_frame',
  79. '.cfi_window_save',
  80. '.cfi_escape',
  81. '.cfi_val_encoded_addr'
  82. );
  83. {$pop}
  84. type
  85. tai_cfi_base = class abstract(tai)
  86. cfityp: tcfikind;
  87. constructor create(ctyp: tcfikind);
  88. end;
  89. tai_cfi_op_none = class(tai_cfi_base)
  90. end;
  91. tai_cfi_op_val = class(tai_cfi_base)
  92. val1: aint;
  93. constructor create(ctyp: tcfikind; const a: aint);
  94. end;
  95. tai_cfi_op_string = class(tai_cfi_base)
  96. s1: TSymStr;
  97. constructor create(ctyp: tcfikind; const str1: TSymStr);
  98. end;
  99. tai_cfi_op_val_string = class(tai_cfi_op_val)
  100. s: TSymStr;
  101. constructor create(ctyp: tcfikind; const a: aint; const str: TSymStr);
  102. end;
  103. tai_cfi_op_string_string = class(tai_cfi_op_string)
  104. s2: TSymStr;
  105. constructor create(ctyp: tcfikind; const str1, str2: TSymStr);
  106. end;
  107. tai_cfi_op_reg = class(tai_cfi_base)
  108. reg1: tregister;
  109. constructor create(ctyp: tcfikind; r: tregister);
  110. end;
  111. tai_cfi_op_reg_val = class(tai_cfi_op_reg)
  112. val: aint;
  113. constructor create(ctyp: tcfikind; r: tregister; a: aint);
  114. end;
  115. tai_cfi_op_reg_reg = class(tai_cfi_op_reg)
  116. reg2: tregister;
  117. constructor create(ctyp: tcfikind; r1, r2: tregister);
  118. end;
  119. implementation
  120. constructor tai_cfi_base.create(ctyp: tcfikind);
  121. begin
  122. typ:=ait_cfi;
  123. cfityp:=ctyp;
  124. end;
  125. constructor tai_cfi_op_val.create(ctyp: tcfikind; const a: aint);
  126. begin
  127. inherited create(ctyp);
  128. val1:=a;
  129. end;
  130. constructor tai_cfi_op_string.create(ctyp: tcfikind; const str1: TSymStr);
  131. begin
  132. inherited create(ctyp);
  133. s1:=str1;
  134. end;
  135. constructor tai_cfi_op_val_string.create(ctyp: tcfikind; const a: aint; const str: TSymStr);
  136. begin
  137. inherited create(ctyp,a);
  138. s:=str;
  139. end;
  140. constructor tai_cfi_op_string_string.create(ctyp: tcfikind; const str1, str2: TSymStr);
  141. begin
  142. inherited create(ctyp,str1);
  143. s2:=str2;
  144. end;
  145. constructor tai_cfi_op_reg.create(ctyp: tcfikind; r: tregister);
  146. begin
  147. inherited create(ctyp);
  148. reg1:=r;
  149. end;
  150. constructor tai_cfi_op_reg_val.create(ctyp: tcfikind; r: tregister; a: aint);
  151. begin
  152. inherited create(ctyp,r);
  153. val:=a;
  154. end;
  155. constructor tai_cfi_op_reg_reg.create(ctyp: tcfikind; r1, r2: tregister);
  156. begin
  157. inherited create(ctyp,r1);
  158. reg2:=r2;
  159. end;
  160. end.