psystem.pas 23 KB

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