psystem.pas 25 KB

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