psystem.pas 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  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. {$ifdef SUPPORT_UNALIGNED}
  87. systemunit.insert(tsyssym.create('Unaligned',in_unaligned_x));
  88. {$endif SUPPORT_UNALIGNED}
  89. end;
  90. procedure create_intern_types;
  91. {
  92. all the types inserted into the system unit
  93. }
  94. function addtype(const s:string;def:tdef):ttypesym;
  95. begin
  96. result:=ttypesym.create(s,def);
  97. systemunit.insert(result);
  98. end;
  99. procedure create_fpu_types;
  100. begin
  101. if init_settings.fputype<>fpu_none then
  102. begin
  103. s32floattype:=tfloatdef.create(s32real);
  104. s64floattype:=tfloatdef.create(s64real);
  105. s80floattype:=tfloatdef.create(s80real);
  106. end else begin
  107. s32floattype:=nil;
  108. s64floattype:=nil;
  109. s80floattype:=nil;
  110. end;
  111. end;
  112. var
  113. hrecst : trecordsymtable;
  114. begin
  115. symtablestack.push(systemunit);
  116. cundefinedtype:=tundefineddef.create;
  117. cformaltype:=tformaldef.create(false);
  118. ctypedformaltype:=tformaldef.create(true);
  119. voidtype:=torddef.create(uvoid,0,0);
  120. u8inttype:=torddef.create(u8bit,0,255);
  121. s8inttype:=torddef.create(s8bit,int64(-128),127);
  122. u16inttype:=torddef.create(u16bit,0,65535);
  123. s16inttype:=torddef.create(s16bit,int64(-32768),32767);
  124. u32inttype:=torddef.create(u32bit,0,high(longword));
  125. s32inttype:=torddef.create(s32bit,int64(low(longint)),int64(high(longint)));
  126. u64inttype:=torddef.create(u64bit,low(qword),high(qword));
  127. s64inttype:=torddef.create(s64bit,low(int64),high(int64));
  128. booltype:=torddef.create(pasbool,0,1);
  129. bool8type:=torddef.create(bool8bit,low(int64),high(int64));
  130. bool16type:=torddef.create(bool16bit,low(int64),high(int64));
  131. bool32type:=torddef.create(bool32bit,low(int64),high(int64));
  132. bool64type:=torddef.create(bool64bit,low(int64),high(int64));
  133. cchartype:=torddef.create(uchar,0,255);
  134. cwidechartype:=torddef.create(uwidechar,0,65535);
  135. cshortstringtype:=tstringdef.createshort(255);
  136. { should we give a length to the default long and ansi string definition ?? }
  137. clongstringtype:=tstringdef.createlong(-1);
  138. cansistringtype:=tstringdef.createansi;
  139. if target_info.system in system_windows then
  140. cwidestringtype:=tstringdef.createwide
  141. else
  142. cwidestringtype:=tstringdef.createunicode;
  143. cunicodestringtype:=tstringdef.createunicode;
  144. { length=0 for shortstring is open string (needed for readln(string) }
  145. openshortstringtype:=tstringdef.createshort(0);
  146. openchararraytype:=tarraydef.create(0,-1,s32inttype);
  147. tarraydef(openchararraytype).elementdef:=cchartype;
  148. {$ifdef x86}
  149. create_fpu_types;
  150. if target_info.system<>system_x86_64_win64 then
  151. s64currencytype:=tfloatdef.create(s64currency)
  152. else
  153. begin
  154. s64currencytype:=torddef.create(scurrency,low(int64),high(int64));
  155. pbestrealtype:=@s64floattype;
  156. end;
  157. {$endif x86}
  158. {$ifdef powerpc}
  159. create_fpu_types;
  160. s64currencytype:=torddef.create(scurrency,low(int64),high(int64));
  161. {$endif powerpc}
  162. {$ifdef POWERPC64}
  163. create_fpu_types;
  164. s64currencytype:=torddef.create(scurrency,low(int64),high(int64));
  165. {$endif POWERPC64}
  166. {$ifdef sparc}
  167. create_fpu_types;
  168. s64currencytype:=torddef.create(scurrency,low(int64),high(int64));
  169. {$endif sparc}
  170. {$ifdef m68k}
  171. create_fpu_types;
  172. s64currencytype:=torddef.create(scurrency,low(int64),high(int64));
  173. {$endif}
  174. {$ifdef arm}
  175. create_fpu_types;
  176. s64currencytype:=torddef.create(scurrency,low(int64),high(int64));
  177. {$endif arm}
  178. {$ifdef avr}
  179. s32floattype:=tfloatdef.create(s32real);
  180. s64floattype:=tfloatdef.create(s64real);
  181. s80floattype:=tfloatdef.create(s80real);
  182. s64currencytype:=torddef.create(scurrency,low(int64),high(int64));
  183. {$endif avr}
  184. {$ifdef cpu64bitaddr}
  185. uinttype:=u64inttype;
  186. sinttype:=s64inttype;
  187. ptruinttype:=u64inttype;
  188. ptrsinttype:=s64inttype;
  189. {$endif cpu64bitaddr}
  190. {$ifdef cpu32bit}
  191. uinttype:=u32inttype;
  192. sinttype:=s32inttype;
  193. ptruinttype:=u32inttype;
  194. ptrsinttype:=s32inttype;
  195. {$endif cpu32bit}
  196. {$ifdef cpu16bit}
  197. uinttype:=u16inttype;
  198. sinttype:=s16inttype;
  199. ptruinttype:=u16inttype;
  200. ptrsinttype:=s16inttype;
  201. {$endif cpu16bit}
  202. { some other definitions }
  203. voidpointertype:=tpointerdef.create(voidtype);
  204. charpointertype:=tpointerdef.create(cchartype);
  205. widecharpointertype:=tpointerdef.create(cwidechartype);
  206. voidfarpointertype:=tpointerdef.createfar(voidtype);
  207. cfiletype:=tfiledef.createuntyped;
  208. cvarianttype:=tvariantdef.create(vt_normalvariant);
  209. colevarianttype:=tvariantdef.create(vt_olevariant);
  210. {$ifdef cpufpemu}
  211. { Normal types }
  212. (* we use the same types as without emulator, the only
  213. difference is that direct calls to the emulator are generated
  214. if (cs_fp_emulation in current_settings.moduleswitches) then
  215. begin
  216. addtype('Single',s32floattype);
  217. { extended size is the best real type for the target }
  218. addtype('Real',s32floattype);
  219. pbestrealtype:=@s32floattype;
  220. { extended size is the best real type for the target }
  221. addtype('Extended',pbestrealtype^);
  222. end
  223. else
  224. *)
  225. {$endif cpufpemu}
  226. if init_settings.fputype <> fpu_none then
  227. begin
  228. addtype('Single',s32floattype);
  229. addtype('Double',s64floattype);
  230. { extended size is the best real type for the target }
  231. addtype('Extended',pbestrealtype^);
  232. end;
  233. {$ifdef x86}
  234. if target_info.system<>system_x86_64_win64 then
  235. addtype('Comp',tfloatdef.create(s64comp));
  236. {$endif x86}
  237. addtype('Currency',s64currencytype);
  238. addtype('Pointer',voidpointertype);
  239. {$ifdef x86}
  240. addtype('FarPointer',voidfarpointertype);
  241. {$endif x86}
  242. addtype('ShortString',cshortstringtype);
  243. {$ifdef support_longstring}
  244. addtype('LongString',clongstringtype);
  245. {$endif support_longstring}
  246. addtype('AnsiString',cansistringtype);
  247. addtype('WideString',cwidestringtype);
  248. addtype('UnicodeString',cunicodestringtype);
  249. addtype('OpenString',openshortstringtype);
  250. addtype('Boolean',booltype);
  251. addtype('ByteBool',bool8type);
  252. addtype('WordBool',bool16type);
  253. addtype('LongBool',bool32type);
  254. addtype('QWordBool',bool64type);
  255. addtype('Byte',u8inttype);
  256. addtype('ShortInt',s8inttype);
  257. addtype('Word',u16inttype);
  258. addtype('SmallInt',s16inttype);
  259. addtype('LongWord',u32inttype);
  260. addtype('LongInt',s32inttype);
  261. addtype('QWord',u64inttype);
  262. addtype('Int64',s64inttype);
  263. addtype('Char',cchartype);
  264. addtype('WideChar',cwidechartype);
  265. addtype('Text',tfiledef.createtext);
  266. addtype('TypedFile',tfiledef.createtyped(voidtype));
  267. addtype('Variant',cvarianttype);
  268. addtype('OleVariant',colevarianttype);
  269. { Internal types }
  270. addtype('$undefined',cundefinedtype);
  271. addtype('$formal',cformaltype);
  272. addtype('$typedformal',ctypedformaltype);
  273. addtype('$void',voidtype);
  274. addtype('$byte',u8inttype);
  275. addtype('$shortint',s8inttype);
  276. addtype('$word',u16inttype);
  277. addtype('$smallint',s16inttype);
  278. addtype('$ulong',u32inttype);
  279. addtype('$longint',s32inttype);
  280. addtype('$qword',u64inttype);
  281. addtype('$int64',s64inttype);
  282. addtype('$char',cchartype);
  283. addtype('$widechar',cwidechartype);
  284. addtype('$shortstring',cshortstringtype);
  285. addtype('$longstring',clongstringtype);
  286. addtype('$ansistring',cansistringtype);
  287. addtype('$widestring',cwidestringtype);
  288. addtype('$unicodestring',cwidestringtype);
  289. addtype('$openshortstring',openshortstringtype);
  290. addtype('$boolean',booltype);
  291. addtype('$boolean8',bool8type);
  292. addtype('$boolean16',bool16type);
  293. addtype('$boolean32',bool32type);
  294. addtype('$boolean64',bool64type);
  295. addtype('$void_pointer',voidpointertype);
  296. addtype('$char_pointer',charpointertype);
  297. addtype('$widechar_pointer',widecharpointertype);
  298. addtype('$void_farpointer',voidfarpointertype);
  299. addtype('$openchararray',openchararraytype);
  300. addtype('$file',cfiletype);
  301. addtype('$variant',cvarianttype);
  302. addtype('$olevariant',cvarianttype);
  303. if init_settings.fputype<>fpu_none then
  304. begin
  305. addtype('$s32real',s32floattype);
  306. addtype('$s64real',s64floattype);
  307. addtype('$s80real',s80floattype);
  308. end;
  309. addtype('$s64currency',s64currencytype);
  310. { Add a type for virtual method tables }
  311. hrecst:=trecordsymtable.create(current_settings.packrecords);
  312. vmttype:=trecorddef.create(hrecst);
  313. pvmttype:=tpointerdef.create(vmttype);
  314. { can't use addtype for pvmt because the rtti of the pointed
  315. type is not available. The rtti for pvmt will be written implicitly
  316. by thev tblarray below }
  317. systemunit.insert(ttypesym.create('$pvmt',pvmttype));
  318. hrecst.insertfield(tfieldvarsym.create('$length',vs_value,ptrsinttype,[]));
  319. hrecst.insertfield(tfieldvarsym.create('$mlength',vs_value,ptrsinttype,[]));
  320. hrecst.insertfield(tfieldvarsym.create('$parent',vs_value,pvmttype,[]));
  321. { it seems vmttype is used both for TP objects and Delphi classes,
  322. so the next entry could either be the first virtual method (vm1)
  323. (object) or the class name (class). We can't easily create separate
  324. vtable formats for both, as gdb is hard coded to search for
  325. __vtbl_ptr_type in all cases (JM) }
  326. hrecst.insertfield(tfieldvarsym.create('$vm1_or_classname',vs_value,tpointerdef.create(cshortstringtype),[]));
  327. vmtarraytype:=tarraydef.create(0,0,s32inttype);
  328. tarraydef(vmtarraytype).elementdef:=voidpointertype;
  329. hrecst.insertfield(tfieldvarsym.create('$__pfn',vs_value,vmtarraytype,[]));
  330. addtype('$__vtbl_ptr_type',vmttype);
  331. vmtarraytype:=tarraydef.create(0,1,s32inttype);
  332. tarraydef(vmtarraytype).elementdef:=pvmttype;
  333. addtype('$vtblarray',vmtarraytype);
  334. { Add a type for methodpointers }
  335. hrecst:=trecordsymtable.create(1);
  336. hrecst.insertfield(tfieldvarsym.create('$proc',vs_value,voidpointertype,[]));
  337. hrecst.insertfield(tfieldvarsym.create('$self',vs_value,voidpointertype,[]));
  338. methodpointertype:=trecorddef.create(hrecst);
  339. addtype('$methodpointer',methodpointertype);
  340. symtablestack.pop(systemunit);
  341. end;
  342. procedure load_intern_types;
  343. {
  344. Load all default definitions for consts from the system unit
  345. }
  346. procedure loadtype(const s:string;var def:tdef);
  347. var
  348. srsym : ttypesym;
  349. begin
  350. srsym:=search_system_type(s);
  351. def:=srsym.typedef;
  352. end;
  353. var
  354. oldcurrentmodule : tmodule;
  355. begin
  356. if target_info.system=system_x86_64_win64 then
  357. pbestrealtype:=@s64floattype;
  358. oldcurrentmodule:=current_module;
  359. set_current_module(nil);
  360. loadtype('byte',u8inttype);
  361. loadtype('shortint',s8inttype);
  362. loadtype('word',u16inttype);
  363. loadtype('smallint',s16inttype);
  364. loadtype('ulong',u32inttype);
  365. loadtype('longint',s32inttype);
  366. loadtype('qword',u64inttype);
  367. loadtype('int64',s64inttype);
  368. loadtype('undefined',cundefinedtype);
  369. loadtype('formal',cformaltype);
  370. loadtype('typedformal',ctypedformaltype);
  371. loadtype('void',voidtype);
  372. loadtype('char',cchartype);
  373. loadtype('widechar',cwidechartype);
  374. loadtype('shortstring',cshortstringtype);
  375. loadtype('longstring',clongstringtype);
  376. loadtype('ansistring',cansistringtype);
  377. loadtype('widestring',cwidestringtype);
  378. loadtype('unicodestring',cunicodestringtype);
  379. loadtype('openshortstring',openshortstringtype);
  380. loadtype('openchararray',openchararraytype);
  381. if init_settings.fputype <> fpu_none then
  382. begin
  383. loadtype('s32real',s32floattype);
  384. loadtype('s64real',s64floattype);
  385. loadtype('s80real',s80floattype);
  386. end;
  387. loadtype('s64currency',s64currencytype);
  388. loadtype('boolean',booltype);
  389. loadtype('boolean8',bool8type);
  390. loadtype('boolean16',bool16type);
  391. loadtype('boolean32',bool32type);
  392. loadtype('boolean64',bool64type);
  393. loadtype('void_pointer',voidpointertype);
  394. loadtype('char_pointer',charpointertype);
  395. loadtype('widechar_pointer',widecharpointertype);
  396. loadtype('void_farpointer',voidfarpointertype);
  397. loadtype('file',cfiletype);
  398. loadtype('pvmt',pvmttype);
  399. loadtype('vtblarray',vmtarraytype);
  400. loadtype('__vtbl_ptr_type',vmttype);
  401. loadtype('variant',cvarianttype);
  402. loadtype('olevariant',colevarianttype);
  403. loadtype('methodpointer',methodpointertype);
  404. loadtype('HRESULT',hresultdef);
  405. {$ifdef cpu64bitaddr}
  406. uinttype:=u64inttype;
  407. sinttype:=s64inttype;
  408. ptruinttype:=u64inttype;
  409. ptrsinttype:=s64inttype;
  410. {$endif cpu64bitaddr}
  411. {$ifdef cpu32bit}
  412. uinttype:=u32inttype;
  413. sinttype:=s32inttype;
  414. ptruinttype:=u32inttype;
  415. ptrsinttype:=s32inttype;
  416. {$endif cpu32bit}
  417. {$ifdef cpu16bit}
  418. uinttype:=u16inttype;
  419. sinttype:=s16inttype;
  420. ptruinttype:=u16inttype;
  421. ptrsinttype:=s16inttype;
  422. {$endif cpu16bit}
  423. set_current_module(oldcurrentmodule);
  424. end;
  425. procedure registernodes;
  426. {
  427. Register all possible nodes in the nodeclass array that
  428. will be used for loading the nodes from a ppu
  429. }
  430. begin
  431. nodeclass[addn]:=caddnode;
  432. nodeclass[muln]:=caddnode;
  433. nodeclass[subn]:=caddnode;
  434. nodeclass[divn]:=cmoddivnode;
  435. nodeclass[symdifn]:=caddnode;
  436. nodeclass[modn]:=cmoddivnode;
  437. nodeclass[assignn]:=cassignmentnode;
  438. nodeclass[loadn]:=cloadnode;
  439. nodeclass[rangen]:=crangenode;
  440. nodeclass[ltn]:=caddnode;
  441. nodeclass[lten]:=caddnode;
  442. nodeclass[gtn]:=caddnode;
  443. nodeclass[gten]:=caddnode;
  444. nodeclass[equaln]:=caddnode;
  445. nodeclass[unequaln]:=caddnode;
  446. nodeclass[inn]:=cinnode;
  447. nodeclass[orn]:=caddnode;
  448. nodeclass[xorn]:=caddnode;
  449. nodeclass[shrn]:=cshlshrnode;
  450. nodeclass[shln]:=cshlshrnode;
  451. nodeclass[slashn]:=caddnode;
  452. nodeclass[andn]:=caddnode;
  453. nodeclass[subscriptn]:=csubscriptnode;
  454. nodeclass[derefn]:=cderefnode;
  455. nodeclass[addrn]:=caddrnode;
  456. nodeclass[ordconstn]:=cordconstnode;
  457. nodeclass[typeconvn]:=ctypeconvnode;
  458. nodeclass[calln]:=ccallnode;
  459. nodeclass[callparan]:=ccallparanode;
  460. nodeclass[realconstn]:=crealconstnode;
  461. nodeclass[unaryminusn]:=cunaryminusnode;
  462. nodeclass[asmn]:=casmnode;
  463. nodeclass[vecn]:=cvecnode;
  464. nodeclass[pointerconstn]:=cpointerconstnode;
  465. nodeclass[stringconstn]:=cstringconstnode;
  466. nodeclass[notn]:=cnotnode;
  467. nodeclass[inlinen]:=cinlinenode;
  468. nodeclass[niln]:=cnilnode;
  469. nodeclass[errorn]:=cerrornode;
  470. nodeclass[typen]:=ctypenode;
  471. nodeclass[setelementn]:=csetelementnode;
  472. nodeclass[setconstn]:=csetconstnode;
  473. nodeclass[blockn]:=cblocknode;
  474. nodeclass[statementn]:=cstatementnode;
  475. nodeclass[ifn]:=cifnode;
  476. nodeclass[breakn]:=cbreaknode;
  477. nodeclass[continuen]:=ccontinuenode;
  478. nodeclass[whilerepeatn]:=cwhilerepeatnode;
  479. nodeclass[forn]:=cfornode;
  480. nodeclass[exitn]:=cexitnode;
  481. nodeclass[withn]:=cwithnode;
  482. nodeclass[casen]:=ccasenode;
  483. nodeclass[labeln]:=clabelnode;
  484. nodeclass[goton]:=cgotonode;
  485. nodeclass[tryexceptn]:=ctryexceptnode;
  486. nodeclass[raisen]:=craisenode;
  487. nodeclass[tryfinallyn]:=ctryfinallynode;
  488. nodeclass[onn]:=connode;
  489. nodeclass[isn]:=cisnode;
  490. nodeclass[asn]:=casnode;
  491. nodeclass[starstarn]:=caddnode;
  492. nodeclass[arrayconstructorn]:=carrayconstructornode;
  493. nodeclass[arrayconstructorrangen]:=carrayconstructorrangenode;
  494. nodeclass[tempcreaten]:=ctempcreatenode;
  495. nodeclass[temprefn]:=ctemprefnode;
  496. nodeclass[tempdeleten]:=ctempdeletenode;
  497. nodeclass[addoptn]:=caddnode;
  498. nodeclass[nothingn]:=cnothingnode;
  499. nodeclass[loadvmtaddrn]:=cloadvmtaddrnode;
  500. nodeclass[guidconstn]:=cguidconstnode;
  501. nodeclass[rttin]:=crttinode;
  502. nodeclass[loadparentfpn]:=cloadparentfpnode;
  503. end;
  504. procedure registertais;
  505. {
  506. Register all possible tais in the taiclass array that
  507. will be used for loading the tais from a ppu
  508. }
  509. begin
  510. aiclass[ait_none]:=nil;
  511. aiclass[ait_align]:=tai_align;
  512. aiclass[ait_section]:=tai_section;
  513. aiclass[ait_comment]:=tai_comment;
  514. aiclass[ait_string]:=tai_string;
  515. aiclass[ait_instruction]:=taicpu;
  516. aiclass[ait_datablock]:=tai_datablock;
  517. aiclass[ait_symbol]:=tai_symbol;
  518. aiclass[ait_symbol_end]:=tai_symbol_end;
  519. aiclass[ait_directive]:=tai_directive;
  520. aiclass[ait_label]:=tai_label;
  521. aiclass[ait_const]:=tai_const;
  522. aiclass[ait_real_32bit]:=tai_real_32bit;
  523. aiclass[ait_real_64bit]:=tai_real_64bit;
  524. aiclass[ait_real_80bit]:=tai_real_80bit;
  525. aiclass[ait_comp_64bit]:=tai_comp_64bit;
  526. aiclass[ait_stab]:=tai_stab;
  527. aiclass[ait_force_line]:=tai_force_line;
  528. aiclass[ait_function_name]:=tai_function_name;
  529. {$ifdef alpha}
  530. { the follow is for the DEC Alpha }
  531. aiclass[ait_frame]:=tai_frame;
  532. aiclass[ait_ent]:=tai_ent;
  533. {$endif alpha}
  534. {$ifdef m68k}
  535. { TODO: FIXME: tai_labeled_instruction doesn't exists}
  536. // aiclass[ait_labeled_instruction]:=tai_labeled_instruction;
  537. {$endif m68k}
  538. {$ifdef ia64}
  539. aiclass[ait_bundle]:=tai_bundle;
  540. aiclass[ait_stop]:=tai_stop;
  541. {$endif ia64}
  542. {$ifdef SPARC}
  543. // aiclass[ait_labeled_instruction]:=tai_labeled_instruction;
  544. {$endif SPARC}
  545. aiclass[ait_cutobject]:=tai_cutobject;
  546. aiclass[ait_regalloc]:=tai_regalloc;
  547. aiclass[ait_tempalloc]:=tai_tempalloc;
  548. aiclass[ait_marker]:=tai_marker;
  549. end;
  550. end.