psystem.pas 25 KB

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