psystem.pas 24 KB

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