psystem.pas 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633
  1. {
  2. Copyright (c) 1998-2002 by Florian Klaempfl
  3. Load the system unit, create required defs for systemunit
  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 psystem;
  18. {$i fpcdefs.inc}
  19. interface
  20. uses
  21. symbase;
  22. procedure create_intern_symbols;
  23. procedure create_intern_types;
  24. procedure load_intern_types;
  25. procedure registernodes;
  26. procedure registertais;
  27. implementation
  28. uses
  29. globals,globtype,verbose,constexp,cpuinfo,
  30. systems,
  31. symconst,symtype,symsym,symdef,symtable,
  32. aasmtai,aasmdata,aasmcpu,
  33. ncgutil,ncgrtti,fmodule,
  34. node,nbas,nflw,nset,ncon,ncnv,nld,nmem,ncal,nmat,nadd,ninl,nopt
  35. ;
  36. procedure create_intern_symbols;
  37. {
  38. all intern procedures for the system unit
  39. }
  40. begin
  41. systemunit.insert(tsyssym.create('Concat',in_concat_x));
  42. systemunit.insert(tsyssym.create('Write',in_write_x));
  43. systemunit.insert(tsyssym.create('WriteLn',in_writeln_x));
  44. systemunit.insert(tsyssym.create('WriteStr',in_writestr_x));
  45. systemunit.insert(tsyssym.create('Assigned',in_assigned_x));
  46. systemunit.insert(tsyssym.create('Read',in_read_x));
  47. systemunit.insert(tsyssym.create('ReadLn',in_readln_x));
  48. systemunit.insert(tsyssym.create('ReadStr',in_readstr_x));
  49. systemunit.insert(tsyssym.create('Ofs',in_ofs_x));
  50. systemunit.insert(tsyssym.create('SizeOf',in_sizeof_x));
  51. systemunit.insert(tsyssym.create('BitSizeOf',in_bitsizeof_x));
  52. systemunit.insert(tsyssym.create('TypeOf',in_typeof_x));
  53. systemunit.insert(tsyssym.create('Low',in_low_x));
  54. systemunit.insert(tsyssym.create('High',in_high_x));
  55. systemunit.insert(tsyssym.create('Slice',in_slice_x));
  56. systemunit.insert(tsyssym.create('Seg',in_seg_x));
  57. systemunit.insert(tsyssym.create('Ord',in_ord_x));
  58. systemunit.insert(tsyssym.create('Pred',in_pred_x));
  59. systemunit.insert(tsyssym.create('Succ',in_succ_x));
  60. systemunit.insert(tsyssym.create('Exclude',in_exclude_x_y));
  61. systemunit.insert(tsyssym.create('Include',in_include_x_y));
  62. systemunit.insert(tsyssym.create('Pack',in_pack_x_y_z));
  63. systemunit.insert(tsyssym.create('Unpack',in_unpack_x_y_z));
  64. systemunit.insert(tsyssym.create('Break',in_break));
  65. systemunit.insert(tsyssym.create('Exit',in_exit));
  66. systemunit.insert(tsyssym.create('Continue',in_continue));
  67. systemunit.insert(tsyssym.create('Leave',in_leave)); {macpas only}
  68. systemunit.insert(tsyssym.create('Cycle',in_cycle)); {macpas only}
  69. systemunit.insert(tsyssym.create('Dec',in_dec_x));
  70. systemunit.insert(tsyssym.create('Inc',in_inc_x));
  71. systemunit.insert(tsyssym.create('Str',in_str_x_string));
  72. systemunit.insert(tsyssym.create('Assert',in_assert_x_y));
  73. systemunit.insert(tsyssym.create('Val',in_val_x));
  74. systemunit.insert(tsyssym.create('Addr',in_addr_x));
  75. systemunit.insert(tsyssym.create('TypeInfo',in_typeinfo_x));
  76. systemunit.insert(tsyssym.create('SetLength',in_setlength_x));
  77. systemunit.insert(tsyssym.create('Copy',in_copy_x));
  78. systemunit.insert(tsyssym.create('Initialize',in_initialize_x));
  79. systemunit.insert(tsyssym.create('Finalize',in_finalize_x));
  80. systemunit.insert(tsyssym.create('Length',in_length_x));
  81. systemunit.insert(tsyssym.create('New',in_new_x));
  82. systemunit.insert(tsyssym.create('Dispose',in_dispose_x));
  83. {$if defined(x86) or defined(arm)}
  84. systemunit.insert(tsyssym.create('Get_Frame',in_get_frame));
  85. {$endif defined(x86) or defined(arm)}
  86. systemunit.insert(tsyssym.create('Unaligned',in_unaligned_x));
  87. systemunit.insert(tsyssym.create('ObjCSelector',in_objc_selector_x)); { objc only }
  88. systemunit.insert(tsyssym.create('ObjCEncode',in_objc_encode_x)); { objc only }
  89. systemunit.insert(tsyssym.create('Default',in_default_x));
  90. end;
  91. procedure set_default_int_types;
  92. begin
  93. {$ifdef cpu64bitaddr}
  94. uinttype:=u64inttype;
  95. sinttype:=s64inttype;
  96. ptruinttype:=u64inttype;
  97. ptrsinttype:=s64inttype;
  98. {$endif cpu64bitaddr}
  99. {$ifdef cpu32bitaddr}
  100. uinttype:=u32inttype;
  101. sinttype:=s32inttype;
  102. ptruinttype:=u32inttype;
  103. ptrsinttype:=s32inttype;
  104. {$endif cpu32bitaddr}
  105. {$ifdef cpu32bitalu}
  106. uinttype:=u32inttype;
  107. sinttype:=s32inttype;
  108. {$endif cpu32bitalu}
  109. {$ifdef cpu16bitaddr}
  110. ptruinttype:=u16inttype;
  111. ptrsinttype:=s16inttype;
  112. {$endif cpu16bitaddr}
  113. {$ifdef cpu16bitalu}
  114. uinttype:=u16inttype;
  115. sinttype:=s16inttype;
  116. {$endif cpu16bitalu}
  117. {$ifdef cpu8bitalu}
  118. uinttype:=u8inttype;
  119. sinttype:=s8inttype;
  120. {$endif cpu8bitalu}
  121. end;
  122. procedure create_intern_types;
  123. {
  124. all the types inserted into the system unit
  125. }
  126. function addtype(const s:string;def:tdef):ttypesym;
  127. begin
  128. result:=ttypesym.create(s,def);
  129. systemunit.insert(result);
  130. end;
  131. procedure addfield(recst:tabstractrecordsymtable;sym:tfieldvarsym);
  132. begin
  133. recst.insert(sym);
  134. recst.addfield(sym,vis_hidden);
  135. end;
  136. procedure create_fpu_types;
  137. begin
  138. if init_settings.fputype<>fpu_none then
  139. begin
  140. s32floattype:=tfloatdef.create(s32real);
  141. s64floattype:=tfloatdef.create(s64real);
  142. s80floattype:=tfloatdef.create(s80real);
  143. sc80floattype:=tfloatdef.create(sc80real);
  144. end else begin
  145. s32floattype:=nil;
  146. s64floattype:=nil;
  147. s80floattype:=nil;
  148. sc80floattype:=nil;
  149. end;
  150. end;
  151. var
  152. hrecst : trecordsymtable;
  153. begin
  154. symtablestack.push(systemunit);
  155. cundefinedtype:=tundefineddef.create;
  156. cformaltype:=tformaldef.create(false);
  157. ctypedformaltype:=tformaldef.create(true);
  158. voidtype:=torddef.create(uvoid,0,0);
  159. u8inttype:=torddef.create(u8bit,0,255);
  160. s8inttype:=torddef.create(s8bit,int64(-128),127);
  161. u16inttype:=torddef.create(u16bit,0,65535);
  162. s16inttype:=torddef.create(s16bit,int64(-32768),32767);
  163. u32inttype:=torddef.create(u32bit,0,high(longword));
  164. s32inttype:=torddef.create(s32bit,int64(low(longint)),int64(high(longint)));
  165. u64inttype:=torddef.create(u64bit,low(qword),high(qword));
  166. s64inttype:=torddef.create(s64bit,low(int64),high(int64));
  167. pasbool8type:=torddef.create(pasbool8,0,1);
  168. pasbool16type:=torddef.create(pasbool16,0,1);
  169. pasbool32type:=torddef.create(pasbool32,0,1);
  170. pasbool64type:=torddef.create(pasbool64,0,1);
  171. bool8type:=torddef.create(bool8bit,low(int64),high(int64));
  172. bool16type:=torddef.create(bool16bit,low(int64),high(int64));
  173. bool32type:=torddef.create(bool32bit,low(int64),high(int64));
  174. bool64type:=torddef.create(bool64bit,low(int64),high(int64));
  175. cansichartype:=torddef.create(uchar,0,255);
  176. cwidechartype:=torddef.create(uwidechar,0,65535);
  177. cshortstringtype:=tstringdef.createshort(255);
  178. { should we give a length to the default long and ansi string definition ?? }
  179. clongstringtype:=tstringdef.createlong(-1);
  180. cansistringtype:=tstringdef.createansi(0);
  181. if target_info.system in systems_windows then
  182. cwidestringtype:=tstringdef.createwide
  183. else
  184. cwidestringtype:=tstringdef.createunicode;
  185. cunicodestringtype:=tstringdef.createunicode;
  186. { length=0 for shortstring is open string (needed for readln(string) }
  187. openshortstringtype:=tstringdef.createshort(0);
  188. openchararraytype:=tarraydef.create(0,-1,s32inttype);
  189. tarraydef(openchararraytype).elementdef:=cansichartype;
  190. {$ifdef x86}
  191. create_fpu_types;
  192. if target_info.system<>system_x86_64_win64 then
  193. s64currencytype:=tfloatdef.create(s64currency)
  194. else
  195. begin
  196. s64currencytype:=torddef.create(scurrency,low(int64),high(int64));
  197. pbestrealtype:=@s64floattype;
  198. end;
  199. {$endif x86}
  200. {$ifdef powerpc}
  201. create_fpu_types;
  202. s64currencytype:=torddef.create(scurrency,low(int64),high(int64));
  203. {$endif powerpc}
  204. {$ifdef POWERPC64}
  205. create_fpu_types;
  206. s64currencytype:=torddef.create(scurrency,low(int64),high(int64));
  207. {$endif POWERPC64}
  208. {$ifdef sparc}
  209. create_fpu_types;
  210. s64currencytype:=torddef.create(scurrency,low(int64),high(int64));
  211. {$endif sparc}
  212. {$ifdef m68k}
  213. create_fpu_types;
  214. s64currencytype:=torddef.create(scurrency,low(int64),high(int64));
  215. {$endif}
  216. {$ifdef arm}
  217. create_fpu_types;
  218. s64currencytype:=torddef.create(scurrency,low(int64),high(int64));
  219. {$endif arm}
  220. {$ifdef avr}
  221. s32floattype:=tfloatdef.create(s32real);
  222. s64floattype:=tfloatdef.create(s64real);
  223. s80floattype:=tfloatdef.create(s80real);
  224. sc80floattype:=tfloatdef.create(sc80real);
  225. s64currencytype:=torddef.create(scurrency,low(int64),high(int64));
  226. {$endif avr}
  227. {$ifdef mips}
  228. create_fpu_types;
  229. s64currencytype:=torddef.create(scurrency,low(int64),high(int64));
  230. {$endif mips}
  231. {$ifdef jvm}
  232. create_fpu_types;
  233. s64currencytype:=torddef.create(scurrency,low(int64),high(int64));
  234. {$endif jvm}
  235. set_default_int_types;
  236. { some other definitions }
  237. voidpointertype:=tpointerdef.create(voidtype);
  238. charpointertype:=tpointerdef.create(cansichartype);
  239. widecharpointertype:=tpointerdef.create(cwidechartype);
  240. voidfarpointertype:=tpointerdef.createfar(voidtype);
  241. cfiletype:=tfiledef.createuntyped;
  242. cvarianttype:=tvariantdef.create(vt_normalvariant);
  243. colevarianttype:=tvariantdef.create(vt_olevariant);
  244. {$ifdef cpufpemu}
  245. { Normal types }
  246. (* we use the same types as without emulator, the only
  247. difference is that direct calls to the emulator are generated
  248. if (cs_fp_emulation in current_settings.moduleswitches) then
  249. begin
  250. addtype('Single',s32floattype);
  251. { extended size is the best real type for the target }
  252. addtype('Real',s32floattype);
  253. pbestrealtype:=@s32floattype;
  254. { extended size is the best real type for the target }
  255. addtype('Extended',pbestrealtype^);
  256. end
  257. else
  258. *)
  259. {$endif cpufpemu}
  260. if init_settings.fputype <> fpu_none then
  261. begin
  262. addtype('Single',s32floattype);
  263. addtype('Double',s64floattype);
  264. { extended size is the best real type for the target }
  265. addtype('Extended',pbestrealtype^);
  266. { CExtended corresponds to the C version of the Extended type
  267. (either "long double" or "double") }
  268. if tfloatdef(pbestrealtype^).floattype=s80real then
  269. addtype('CExtended',sc80floattype)
  270. else
  271. addtype('CExtended',pbestrealtype^);
  272. end;
  273. {$ifdef x86}
  274. if target_info.system<>system_x86_64_win64 then
  275. addtype('Comp',tfloatdef.create(s64comp));
  276. {$endif x86}
  277. addtype('Currency',s64currencytype);
  278. addtype('Pointer',voidpointertype);
  279. {$ifdef x86}
  280. addtype('FarPointer',voidfarpointertype);
  281. {$endif x86}
  282. addtype('ShortString',cshortstringtype);
  283. {$ifdef support_longstring}
  284. addtype('LongString',clongstringtype);
  285. {$endif support_longstring}
  286. addtype('AnsiString',cansistringtype);
  287. addtype('WideString',cwidestringtype);
  288. addtype('UnicodeString',cunicodestringtype);
  289. addtype('OpenString',openshortstringtype);
  290. addtype('Boolean',pasbool8type);
  291. addtype('Boolean16',pasbool16type);
  292. addtype('Boolean32',pasbool32type);
  293. addtype('Boolean64',pasbool64type);
  294. addtype('ByteBool',bool8type);
  295. addtype('WordBool',bool16type);
  296. addtype('LongBool',bool32type);
  297. addtype('QWordBool',bool64type);
  298. addtype('Byte',u8inttype);
  299. addtype('ShortInt',s8inttype);
  300. addtype('Word',u16inttype);
  301. addtype('SmallInt',s16inttype);
  302. addtype('LongWord',u32inttype);
  303. addtype('LongInt',s32inttype);
  304. addtype('QWord',u64inttype);
  305. addtype('Int64',s64inttype);
  306. addtype('Char',cansichartype);
  307. addtype('WideChar',cwidechartype);
  308. addtype('Text',tfiledef.createtext);
  309. addtype('TypedFile',tfiledef.createtyped(voidtype));
  310. addtype('Variant',cvarianttype);
  311. addtype('OleVariant',colevarianttype);
  312. { Internal types }
  313. addtype('$undefined',cundefinedtype);
  314. addtype('$formal',cformaltype);
  315. addtype('$typedformal',ctypedformaltype);
  316. addtype('$void',voidtype);
  317. addtype('$byte',u8inttype);
  318. addtype('$shortint',s8inttype);
  319. addtype('$word',u16inttype);
  320. addtype('$smallint',s16inttype);
  321. addtype('$ulong',u32inttype);
  322. addtype('$longint',s32inttype);
  323. addtype('$qword',u64inttype);
  324. addtype('$int64',s64inttype);
  325. addtype('$char',cansichartype);
  326. addtype('$widechar',cwidechartype);
  327. addtype('$shortstring',cshortstringtype);
  328. addtype('$longstring',clongstringtype);
  329. addtype('$ansistring',cansistringtype);
  330. addtype('$widestring',cwidestringtype);
  331. addtype('$unicodestring',cunicodestringtype);
  332. addtype('$openshortstring',openshortstringtype);
  333. addtype('$boolean',pasbool8type);
  334. addtype('$boolean16',pasbool16type);
  335. addtype('$boolean32',pasbool32type);
  336. addtype('$boolean64',pasbool64type);
  337. addtype('$bytebool',bool8type);
  338. addtype('$wordbool',bool16type);
  339. addtype('$longbool',bool32type);
  340. addtype('$qwordbool',bool64type);
  341. addtype('$void_pointer',voidpointertype);
  342. addtype('$char_pointer',charpointertype);
  343. addtype('$widechar_pointer',widecharpointertype);
  344. addtype('$void_farpointer',voidfarpointertype);
  345. addtype('$openchararray',openchararraytype);
  346. addtype('$file',cfiletype);
  347. addtype('$variant',cvarianttype);
  348. addtype('$olevariant',cvarianttype);
  349. if init_settings.fputype<>fpu_none then
  350. begin
  351. addtype('$s32real',s32floattype);
  352. addtype('$s64real',s64floattype);
  353. addtype('$s80real',s80floattype);
  354. addtype('$sc80real',sc80floattype);
  355. end;
  356. addtype('$s64currency',s64currencytype);
  357. if not(target_info.system in systems_managed_vm) then
  358. begin
  359. { Add a type for virtual method tables }
  360. hrecst:=trecordsymtable.create('',current_settings.packrecords);
  361. vmttype:=trecorddef.create('',hrecst);
  362. pvmttype:=tpointerdef.create(vmttype);
  363. { can't use addtype for pvmt because the rtti of the pointed
  364. type is not available. The rtti for pvmt will be written implicitly
  365. by thev tblarray below }
  366. systemunit.insert(ttypesym.create('$pvmt',pvmttype));
  367. addfield(hrecst,tfieldvarsym.create('$length',vs_value,ptrsinttype,[]));
  368. addfield(hrecst,tfieldvarsym.create('$mlength',vs_value,ptrsinttype,[]));
  369. addfield(hrecst,tfieldvarsym.create('$parent',vs_value,pvmttype,[]));
  370. { it seems vmttype is used both for TP objects and Delphi classes,
  371. so the next entry could either be the first virtual method (vm1)
  372. (object) or the class name (class). We can't easily create separate
  373. vtable formats for both, as gdb is hard coded to search for
  374. __vtbl_ptr_type in all cases (JM) }
  375. addfield(hrecst,tfieldvarsym.create('$vm1_or_classname',vs_value,tpointerdef.create(cshortstringtype),[]));
  376. vmtarraytype:=tarraydef.create(0,0,s32inttype);
  377. tarraydef(vmtarraytype).elementdef:=voidpointertype;
  378. addfield(hrecst,tfieldvarsym.create('$__pfn',vs_value,vmtarraytype,[]));
  379. addtype('$__vtbl_ptr_type',vmttype);
  380. vmtarraytype:=tarraydef.create(0,1,s32inttype);
  381. tarraydef(vmtarraytype).elementdef:=pvmttype;
  382. addtype('$vtblarray',vmtarraytype);
  383. { Add a type for methodpointers }
  384. hrecst:=trecordsymtable.create('',1);
  385. addfield(hrecst,tfieldvarsym.create('$proc',vs_value,voidpointertype,[]));
  386. addfield(hrecst,tfieldvarsym.create('$self',vs_value,voidpointertype,[]));
  387. methodpointertype:=trecorddef.create('',hrecst);
  388. addtype('$methodpointer',methodpointertype);
  389. end;
  390. symtablestack.pop(systemunit);
  391. end;
  392. procedure load_intern_types;
  393. {
  394. Load all default definitions for consts from the system unit
  395. }
  396. procedure loadtype(const s:string;var def:tdef);
  397. var
  398. srsym : ttypesym;
  399. begin
  400. srsym:=search_system_type(s);
  401. def:=srsym.typedef;
  402. end;
  403. var
  404. oldcurrentmodule : tmodule;
  405. begin
  406. if target_info.system=system_x86_64_win64 then
  407. pbestrealtype:=@s64floattype;
  408. oldcurrentmodule:=current_module;
  409. set_current_module(nil);
  410. loadtype('byte',u8inttype);
  411. loadtype('shortint',s8inttype);
  412. loadtype('word',u16inttype);
  413. loadtype('smallint',s16inttype);
  414. loadtype('ulong',u32inttype);
  415. loadtype('longint',s32inttype);
  416. loadtype('qword',u64inttype);
  417. loadtype('int64',s64inttype);
  418. loadtype('undefined',cundefinedtype);
  419. loadtype('formal',cformaltype);
  420. loadtype('typedformal',ctypedformaltype);
  421. loadtype('void',voidtype);
  422. loadtype('char',cansichartype);
  423. loadtype('widechar',cwidechartype);
  424. loadtype('shortstring',cshortstringtype);
  425. loadtype('longstring',clongstringtype);
  426. loadtype('ansistring',cansistringtype);
  427. loadtype('widestring',cwidestringtype);
  428. loadtype('unicodestring',cunicodestringtype);
  429. loadtype('openshortstring',openshortstringtype);
  430. loadtype('openchararray',openchararraytype);
  431. if init_settings.fputype <> fpu_none then
  432. begin
  433. loadtype('s32real',s32floattype);
  434. loadtype('s64real',s64floattype);
  435. loadtype('s80real',s80floattype);
  436. loadtype('sc80real',sc80floattype);
  437. end;
  438. loadtype('s64currency',s64currencytype);
  439. loadtype('boolean',pasbool8type);
  440. loadtype('boolean16',pasbool16type);
  441. loadtype('boolean32',pasbool32type);
  442. loadtype('boolean64',pasbool64type);
  443. loadtype('bytebool',bool8type);
  444. loadtype('wordbool',bool16type);
  445. loadtype('longbool',bool32type);
  446. loadtype('qwordbool',bool64type);
  447. loadtype('void_pointer',voidpointertype);
  448. loadtype('char_pointer',charpointertype);
  449. loadtype('widechar_pointer',widecharpointertype);
  450. loadtype('void_farpointer',voidfarpointertype);
  451. loadtype('file',cfiletype);
  452. if not(target_info.system in systems_managed_vm) then
  453. begin
  454. loadtype('pvmt',pvmttype);
  455. loadtype('vtblarray',vmtarraytype);
  456. loadtype('__vtbl_ptr_type',vmttype);
  457. end;
  458. loadtype('variant',cvarianttype);
  459. loadtype('olevariant',colevarianttype);
  460. if not(target_info.system in systems_managed_vm) then
  461. loadtype('methodpointer',methodpointertype);
  462. loadtype('HRESULT',hresultdef);
  463. set_default_int_types;
  464. set_current_module(oldcurrentmodule);
  465. end;
  466. procedure registernodes;
  467. {
  468. Register all possible nodes in the nodeclass array that
  469. will be used for loading the nodes from a ppu
  470. }
  471. begin
  472. nodeclass[addn]:=caddnode;
  473. nodeclass[muln]:=caddnode;
  474. nodeclass[subn]:=caddnode;
  475. nodeclass[divn]:=cmoddivnode;
  476. nodeclass[symdifn]:=caddnode;
  477. nodeclass[modn]:=cmoddivnode;
  478. nodeclass[assignn]:=cassignmentnode;
  479. nodeclass[loadn]:=cloadnode;
  480. nodeclass[rangen]:=crangenode;
  481. nodeclass[ltn]:=caddnode;
  482. nodeclass[lten]:=caddnode;
  483. nodeclass[gtn]:=caddnode;
  484. nodeclass[gten]:=caddnode;
  485. nodeclass[equaln]:=caddnode;
  486. nodeclass[unequaln]:=caddnode;
  487. nodeclass[inn]:=cinnode;
  488. nodeclass[orn]:=caddnode;
  489. nodeclass[xorn]:=caddnode;
  490. nodeclass[shrn]:=cshlshrnode;
  491. nodeclass[shln]:=cshlshrnode;
  492. nodeclass[slashn]:=caddnode;
  493. nodeclass[andn]:=caddnode;
  494. nodeclass[subscriptn]:=csubscriptnode;
  495. nodeclass[derefn]:=cderefnode;
  496. nodeclass[addrn]:=caddrnode;
  497. nodeclass[ordconstn]:=cordconstnode;
  498. nodeclass[typeconvn]:=ctypeconvnode;
  499. nodeclass[calln]:=ccallnode;
  500. nodeclass[callparan]:=ccallparanode;
  501. nodeclass[realconstn]:=crealconstnode;
  502. nodeclass[unaryminusn]:=cunaryminusnode;
  503. nodeclass[unaryplusn]:=cunaryplusnode;
  504. nodeclass[asmn]:=casmnode;
  505. nodeclass[vecn]:=cvecnode;
  506. nodeclass[pointerconstn]:=cpointerconstnode;
  507. nodeclass[stringconstn]:=cstringconstnode;
  508. nodeclass[notn]:=cnotnode;
  509. nodeclass[inlinen]:=cinlinenode;
  510. nodeclass[niln]:=cnilnode;
  511. nodeclass[errorn]:=cerrornode;
  512. nodeclass[typen]:=ctypenode;
  513. nodeclass[setelementn]:=csetelementnode;
  514. nodeclass[setconstn]:=csetconstnode;
  515. nodeclass[blockn]:=cblocknode;
  516. nodeclass[statementn]:=cstatementnode;
  517. nodeclass[ifn]:=cifnode;
  518. nodeclass[breakn]:=cbreaknode;
  519. nodeclass[continuen]:=ccontinuenode;
  520. nodeclass[whilerepeatn]:=cwhilerepeatnode;
  521. nodeclass[forn]:=cfornode;
  522. nodeclass[exitn]:=cexitnode;
  523. nodeclass[withn]:=cwithnode;
  524. nodeclass[casen]:=ccasenode;
  525. nodeclass[labeln]:=clabelnode;
  526. nodeclass[goton]:=cgotonode;
  527. nodeclass[tryexceptn]:=ctryexceptnode;
  528. nodeclass[raisen]:=craisenode;
  529. nodeclass[tryfinallyn]:=ctryfinallynode;
  530. nodeclass[onn]:=connode;
  531. nodeclass[isn]:=cisnode;
  532. nodeclass[asn]:=casnode;
  533. nodeclass[starstarn]:=caddnode;
  534. nodeclass[arrayconstructorn]:=carrayconstructornode;
  535. nodeclass[arrayconstructorrangen]:=carrayconstructorrangenode;
  536. nodeclass[tempcreaten]:=ctempcreatenode;
  537. nodeclass[temprefn]:=ctemprefnode;
  538. nodeclass[tempdeleten]:=ctempdeletenode;
  539. nodeclass[addoptn]:=caddnode;
  540. nodeclass[nothingn]:=cnothingnode;
  541. nodeclass[loadvmtaddrn]:=cloadvmtaddrnode;
  542. nodeclass[guidconstn]:=cguidconstnode;
  543. nodeclass[rttin]:=crttinode;
  544. nodeclass[loadparentfpn]:=cloadparentfpnode;
  545. end;
  546. procedure registertais;
  547. {
  548. Register all possible tais in the taiclass array that
  549. will be used for loading the tais from a ppu
  550. }
  551. begin
  552. aiclass[ait_none]:=nil;
  553. aiclass[ait_align]:=tai_align;
  554. aiclass[ait_section]:=tai_section;
  555. aiclass[ait_comment]:=tai_comment;
  556. aiclass[ait_string]:=tai_string;
  557. aiclass[ait_instruction]:=taicpu;
  558. aiclass[ait_datablock]:=tai_datablock;
  559. aiclass[ait_symbol]:=tai_symbol;
  560. aiclass[ait_symbol_end]:=tai_symbol_end;
  561. aiclass[ait_directive]:=tai_directive;
  562. aiclass[ait_label]:=tai_label;
  563. aiclass[ait_const]:=tai_const;
  564. aiclass[ait_real_32bit]:=tai_real_32bit;
  565. aiclass[ait_real_64bit]:=tai_real_64bit;
  566. aiclass[ait_real_80bit]:=tai_real_80bit;
  567. aiclass[ait_comp_64bit]:=tai_comp_64bit;
  568. aiclass[ait_stab]:=tai_stab;
  569. aiclass[ait_force_line]:=tai_force_line;
  570. aiclass[ait_function_name]:=tai_function_name;
  571. {$ifdef alpha}
  572. { the follow is for the DEC Alpha }
  573. aiclass[ait_frame]:=tai_frame;
  574. aiclass[ait_ent]:=tai_ent;
  575. {$endif alpha}
  576. {$ifdef m68k}
  577. { TODO: FIXME: tai_labeled_instruction doesn't exists}
  578. // aiclass[ait_labeled_instruction]:=tai_labeled_instruction;
  579. {$endif m68k}
  580. {$ifdef ia64}
  581. aiclass[ait_bundle]:=tai_bundle;
  582. aiclass[ait_stop]:=tai_stop;
  583. {$endif ia64}
  584. {$ifdef SPARC}
  585. // aiclass[ait_labeled_instruction]:=tai_labeled_instruction;
  586. {$endif SPARC}
  587. {$ifdef arm}
  588. aiclass[ait_thumb_func]:=tai_thumb_func;
  589. {$endif arm}
  590. aiclass[ait_cutobject]:=tai_cutobject;
  591. aiclass[ait_regalloc]:=tai_regalloc;
  592. aiclass[ait_tempalloc]:=tai_tempalloc;
  593. aiclass[ait_marker]:=tai_marker;
  594. aiclass[ait_seh_directive]:=tai_seh_directive;
  595. aiclass[ait_jvar]:=tai_jvar;
  596. aiclass[ait_jcatch]:=tai_jcatch;
  597. end;
  598. end.