psystem.pas 24 KB

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