cgobj.pas 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708
  1. {
  2. $Id$
  3. Copyright (c) 1993-98 by Florian Klaempfl
  4. This unit implements the basic code generator object
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. unit cgobj;
  19. interface
  20. uses
  21. cobjects,aasm,symtable
  22. {$I cpuunit.inc}
  23. ;
  24. type
  25. qword = comp;
  26. pcg = ^tcg;
  27. tcg = object
  28. constructor init;
  29. destructor done;virtual;
  30. procedure a_call_name_ext(list : paasmoutput;const s : string;
  31. offset : longint);
  32. {************************************************}
  33. { code generation for subroutine entry/exit code }
  34. { helper routines }
  35. procedure g_initialize_data(p : psym);
  36. procedure g_incr_data(p : psym);
  37. procedure g_finalize_data(p : pnamedindexobject);
  38. {$ifndef VALUEPARA}
  39. procedure g_copyopenarrays(p : pnamedindexobject);
  40. {$else}
  41. procedure g_copyvalueparas(p : pnamedindexobject);
  42. {$endif}
  43. procedure g_entrycode(list : paasmoutput;
  44. const proc_names : tstringcontainer;make_global : boolean;
  45. stackframe : longint;var parasize : longint;
  46. var nostackframe : boolean;inlined : boolean);
  47. procedure g_exitcode(list : paasmoutput;parasize : longint;
  48. nostackframe,inlined : boolean);
  49. { string helper routines }
  50. procedure g_decransiref(const ref : treference);
  51. procedure g_removetemps(list : paasmoutput;p : plinkedlist);
  52. {**********************************}
  53. { these methods must be overriden: }
  54. procedure a_push_reg(list : paasmoutput;r : tregister);virtual;
  55. procedure a_call_name(list : paasmoutput;const s : string;
  56. offset : longint);virtual;
  57. procedure a_load_const8_ref(list : paasmoutput;b : byte;const ref : treference);virtual;
  58. procedure a_load_const16_ref(list : paasmoutput;w : word;const ref : treference);virtual;
  59. procedure a_load_const32_ref(list : paasmoutput;l : longint;const ref : treference);virtual;
  60. procedure a_load_const64_ref(list : paasmoutput;q : qword;const ref : treference);virtual;
  61. procedure g_stackframe_entry(list : paasmoutput;localsize : longint);virtual;
  62. procedure g_maybe_loadself(list : paasmoutput);virtual;
  63. {********************************************************}
  64. { these methods can be overriden for extra functionality }
  65. { the following methods do nothing: }
  66. procedure g_interrupt_stackframe_entry(list : paasmoutput);virtual;
  67. procedure g_interrupt_stackframe_exit(list : paasmoutput);virtual;
  68. procedure g_profilecode(list : paasmoutput);virtual;
  69. procedure g_stackcheck(list : paasmoutput;stackframesize : longint);virtual;
  70. { passing parameters, per default the parameter is pushed }
  71. { nr gives the number of the parameter (enumerated from }
  72. { left to right), this allows to move the parameter to }
  73. { register, if the cpu supports register calling }
  74. { conventions }
  75. procedure a_param_reg(list : paasmoutput;r : tregister;nr : longint);virtual;
  76. procedure a_param_const8(list : paasmoutput;b : byte;nr : longint);virtual;
  77. procedure a_param_const16(list : paasmoutput;w : word;nr : longint);virtual;
  78. procedure a_param_const32(list : paasmoutput;l : longint;nr : longint);virtual;
  79. procedure a_param_const64(list : paasmoutput;q : qword;nr : longint);virtual;
  80. end;
  81. var
  82. cg : pcg; { this is the main code generator class }
  83. implementation
  84. uses
  85. globals,globtype,options,files,gdb,systems,
  86. ppu,cgbase,verbose,types,tgobj,tgcpu
  87. ;
  88. constructor tcg.init;
  89. begin
  90. end;
  91. destructor tcg.done;
  92. begin
  93. end;
  94. {*****************************************************************************
  95. per default, this methods nothing, can overriden
  96. *****************************************************************************}
  97. procedure tcg.g_interrupt_stackframe_entry(list : paasmoutput);
  98. begin
  99. end;
  100. procedure tcg.g_interrupt_stackframe_exit(list : paasmoutput);
  101. begin
  102. end;
  103. procedure tcg.g_profilecode(list : paasmoutput);
  104. begin
  105. end;
  106. procedure tcg.a_param_reg(list : paasmoutput;r : tregister;nr : longint);
  107. begin
  108. a_push_reg(list,r);
  109. end;
  110. procedure tcg.a_param_const8(list : paasmoutput;b : byte;nr : longint);
  111. begin
  112. {!!!!!!!! a_push_const8(list,b); }
  113. end;
  114. procedure tcg.a_param_const16(list : paasmoutput;w : word;nr : longint);
  115. begin
  116. {!!!!!!!! a_push_const16(list,w); }
  117. end;
  118. procedure tcg.a_param_const32(list : paasmoutput;l : longint;nr : longint);
  119. begin
  120. {!!!!!!!! a_push_const32(list,l); }
  121. end;
  122. procedure tcg.a_param_const64(list : paasmoutput;q : qword;nr : longint);
  123. begin
  124. {!!!!!!!! a_push_const64(list,q); }
  125. end;
  126. procedure tcg.g_stackcheck(list : paasmoutput;stackframesize : longint);
  127. begin
  128. a_param_const32(list,stackframesize,1);
  129. a_call_name_ext(list,'FPC_STACKCHECK',0);
  130. end;
  131. procedure tcg.a_call_name_ext(list : paasmoutput;const s : string;
  132. offset : longint);
  133. begin
  134. a_call_name(list,s,offset);
  135. { concat_external(s,m); }
  136. end;
  137. {*****************************************************************************
  138. String helper routines
  139. *****************************************************************************}
  140. procedure tcg.g_removetemps(list : paasmoutput;p : plinkedlist);
  141. var
  142. hp : ptemptodestroy;
  143. pushedregs : tpushed;
  144. begin
  145. hp:=ptemptodestroy(p^.first);
  146. if not(assigned(hp)) then
  147. exit;
  148. tg.pushusedregisters(pushedregs,$ff);
  149. while assigned(hp) do
  150. begin
  151. if is_ansistring(hp^.typ) then
  152. begin
  153. g_decransiref(hp^.address);
  154. tg.ungetiftemp(hp^.address);
  155. end;
  156. hp:=ptemptodestroy(hp^.next);
  157. end;
  158. tg.popusedregisters(pushedregs);
  159. end;
  160. procedure tcg.g_decransiref(const ref : treference);
  161. begin
  162. {!!!!!!!!!}
  163. { emitpushreferenceaddr(exprasmlist,ref);
  164. emitcall('FPC_ANSISTR_DECR_REF',true); }
  165. end;
  166. {*****************************************************************************
  167. Code generation for subroutine entry- and exit code
  168. *****************************************************************************}
  169. { generates the code for initialisation of local data }
  170. procedure tcg.g_initialize_data(p : psym);
  171. begin
  172. runerror(255);
  173. end;
  174. { generates the code for incrementing the reference count of parameters }
  175. procedure tcg.g_incr_data(p : psym);
  176. begin
  177. runerror(255);
  178. end;
  179. { generates the code for finalisation of local data }
  180. procedure tcg.g_finalize_data(p : pnamedindexobject);
  181. begin
  182. runerror(255);
  183. end;
  184. { generates the code to make local copies of the value parameters }
  185. procedure tcg.g_copyopenarrays(p : pnamedindexobject);
  186. begin
  187. runerror(255);
  188. end;
  189. { wrappers for the methods, because TP doesn't know procedures }
  190. { of objects }
  191. procedure _copyopenarrays(s : pnamedindexobject);{$ifndef FPC}far;{$endif}
  192. begin
  193. cg^.g_copyopenarrays(s);
  194. end;
  195. procedure _finalize_data(s : pnamedindexobject);{$ifndef FPC}far;{$endif}
  196. begin
  197. cg^.g_finalize_data(s);
  198. end;
  199. procedure _incr_data(s : pnamedindexobject);{$ifndef FPC}far;{$endif}
  200. begin
  201. cg^.g_incr_data(psym(s));
  202. end;
  203. procedure _initialize_data(s : pnamedindexobject);{$ifndef FPC}far;{$endif}
  204. begin
  205. cg^.g_initialize_data(psym(s));
  206. end;
  207. { generates the entry code for a procedure }
  208. procedure tcg.g_entrycode(list : paasmoutput;const proc_names:Tstringcontainer;make_global:boolean;
  209. stackframe:longint;var parasize:longint;var nostackframe:boolean;
  210. inlined : boolean);
  211. var
  212. hs : string;
  213. hp : pused_unit;
  214. initcode : taasmoutput;
  215. {$ifdef GDB}
  216. stab_function_name : Pai_stab_function_name;
  217. {$endif GDB}
  218. hr : treference;
  219. r : tregister;
  220. begin
  221. { Align }
  222. if (not inlined) then
  223. begin
  224. { gprof uses 16 byte granularity !! }
  225. if (cs_profile in aktmoduleswitches) then
  226. list^.insert(new(pai_align,init(16)))
  227. else
  228. if not(cs_littlesize in aktglobalswitches) then
  229. list^.insert(new(pai_align,init(4)));
  230. end;
  231. { save registers on cdecl }
  232. if ((aktprocsym^.definition^.options and pocdecl)<>0) then
  233. begin
  234. for r:=firstreg to lastreg do
  235. begin
  236. if (r in registers_saved_on_cdecl) then
  237. if (r in (tg.availabletempregsint+
  238. tg.availabletempregsfpu+
  239. tg.availabletempregsmm)) then
  240. begin
  241. if not(r in tg.usedinproc) then
  242. a_push_reg(list,r)
  243. end
  244. else
  245. a_push_reg(list,r);
  246. end;
  247. end;
  248. { omit stack frame ? }
  249. if not inlined then
  250. if procinfo.framepointer=stack_pointer then
  251. begin
  252. CGMessage(cg_d_stackframe_omited);
  253. nostackframe:=true;
  254. if (aktprocsym^.definition^.options and (pounitinit or poproginit or pounitfinalize)<>0) then
  255. parasize:=0
  256. else
  257. parasize:=aktprocsym^.definition^.parast^.datasize+procinfo.call_offset-pointersize;
  258. end
  259. else
  260. begin
  261. if (aktprocsym^.definition^.options and (pounitinit or poproginit or pounitfinalize)<>0) then
  262. parasize:=0
  263. else
  264. parasize:=aktprocsym^.definition^.parast^.datasize+procinfo.call_offset-pointersize*2;
  265. nostackframe:=false;
  266. if (aktprocsym^.definition^.options and pointerrupt)<>0 then
  267. g_interrupt_stackframe_entry(list);
  268. g_stackframe_entry(list,stackframe);
  269. if (cs_check_stack in aktlocalswitches) and
  270. (tf_supports_stack_checking in target_info.flags) then
  271. g_stackcheck(@initcode,stackframe);
  272. end;
  273. if cs_profile in aktmoduleswitches then
  274. g_profilecode(@initcode);
  275. if (not inlined) and ((aktprocsym^.definition^.options and poproginit)<>0) then
  276. begin
  277. { needs the target a console flags ? }
  278. if tf_needs_isconsole in target_info.flags then
  279. begin
  280. hr.symbol:=newasmsymbol('U_'+target_info.system_unit+'_ISCONSOLE');
  281. if apptype=at_cui then
  282. a_load_const8_ref(list,1,hr)
  283. else
  284. a_load_const8_ref(list,0,hr);
  285. dispose(hr.symbol,done);
  286. end;
  287. hp:=pused_unit(usedunits.first);
  288. while assigned(hp) do
  289. begin
  290. { call the unit init code and make it external }
  291. if (hp^.u^.flags and uf_init)<>0 then
  292. a_call_name_ext(list,
  293. 'INIT$$'+hp^.u^.modulename^,0);
  294. hp:=Pused_unit(hp^.next);
  295. end;
  296. end;
  297. {$ifdef dummy}
  298. { a constructor needs a help procedure }
  299. if (aktprocsym^.definition^.options and poconstructor)<>0 then
  300. begin
  301. if procinfo._class^.isclass then
  302. begin
  303. list^.insert(new(pai386,op_cond_sym(A_Jcc,C_Z,S_NO,quickexitlabel)));
  304. list^.insert(new(pai386,op_sym(A_CALL,S_NO,newasmsymbol('FPC_NEW_CLASS'))));
  305. end
  306. else
  307. begin
  308. {
  309. list^.insert(new(pai_labeled,init(A_JZ,quickexitlabel)));
  310. list^.insert(new(pai386,op_csymbol(A_CALL,S_NO,
  311. newcsymbol('FPC_HELP_CONSTRUCTOR',0))));
  312. list^.insert(new(pai386,op_const_reg(A_MOV,S_L,procinfo._class^.vmt_offset,R_EDI)));
  313. concat_external('FPC_HELP_CONSTRUCTOR',EXT_NEAR);
  314. }
  315. end;
  316. end;
  317. {$endif dummy}
  318. {$ifdef GDB}
  319. if (cs_debuginfo in aktmoduleswitches) then
  320. list^.insert(new(pai_force_line,init));
  321. {$endif GDB}
  322. { initialize return value }
  323. if is_ansistring(procinfo.retdef) or
  324. is_widestring(procinfo.retdef) then
  325. begin
  326. reset_reference(hr);
  327. hr.offset:=procinfo.retoffset;
  328. hr.base:=procinfo.framepointer;
  329. a_load_const32_ref(list,0,hr);
  330. end;
  331. { generate copies of call by value parameters }
  332. if (aktprocsym^.definition^.options and poassembler=0) then
  333. begin
  334. {$ifndef VALUEPARA}
  335. aktprocsym^.definition^.parast^.foreach({$ifdef FPC}@{$endif FPC}_copyopenarrays);
  336. {$else}
  337. aktprocsym^.definition^.parast^.foreach({$ifdef FPC}@{$endif FPC}_copyvalueparas);
  338. {$endif}
  339. end;
  340. { initialisizes local data }
  341. aktprocsym^.definition^.localst^.foreach({$ifdef FPC}@{$endif FPC}_initialize_data);
  342. { add a reference to all call by value/const parameters }
  343. aktprocsym^.definition^.parast^.foreach({$ifdef FPC}@{$endif FPC}_incr_data);
  344. if (cs_profile in aktmoduleswitches) or
  345. (aktprocsym^.definition^.owner^.symtabletype=globalsymtable) or
  346. (assigned(procinfo._class) and (procinfo._class^.owner^.symtabletype=globalsymtable)) then
  347. make_global:=true;
  348. if not inlined then
  349. begin
  350. hs:=proc_names.get;
  351. {$ifdef GDB}
  352. if (cs_debuginfo in aktmoduleswitches) and target_os.use_function_relative_addresses then
  353. stab_function_name := new(pai_stab_function_name,init(strpnew(hs)));
  354. {$endif GDB}
  355. { insert the names for the procedure }
  356. while hs<>'' do
  357. begin
  358. if make_global then
  359. exprasmlist^.insert(new(pai_symbol,initname_global(hs,0)))
  360. else
  361. exprasmlist^.insert(new(pai_symbol,initname(hs,0)));
  362. {$ifdef GDB}
  363. if (cs_debuginfo in aktmoduleswitches) then
  364. begin
  365. if target_os.use_function_relative_addresses then
  366. list^.insert(new(pai_stab_function_name,init(strpnew(hs))));
  367. end;
  368. {$endif GDB}
  369. hs:=proc_names.get;
  370. end;
  371. end;
  372. {$ifdef GDB}
  373. if (not inlined) and (cs_debuginfo in aktmoduleswitches) then
  374. begin
  375. if target_os.use_function_relative_addresses then
  376. list^.insert(stab_function_name);
  377. if make_global or ((procinfo.flags and pi_is_global) <> 0) then
  378. aktprocsym^.is_global := True;
  379. list^.insert(new(pai_stabs,init(aktprocsym^.stabstring)));
  380. aktprocsym^.isstabwritten:=true;
  381. end;
  382. {$endif GDB}
  383. end;
  384. procedure tcg.g_exitcode(list : paasmoutput;parasize:longint;nostackframe,inlined:boolean);
  385. {$ifdef GDB}
  386. var
  387. mangled_length : longint;
  388. p : pchar;
  389. {$endif GDB}
  390. begin
  391. {$ifdef dummy}
  392. { !!!! insert there automatic destructors }
  393. curlist:=list;
  394. if aktexitlabel^.is_used then
  395. list^.insert(new(pai_label,init(aktexitlabel)));
  396. { call the destructor help procedure }
  397. if (aktprocsym^.definition^.options and podestructor)<>0 then
  398. begin
  399. if procinfo._class^.isclass then
  400. begin
  401. list^.insert(new(pai386,op_csymbol(A_CALL,S_NO,
  402. newcsymbol('FPC_DISPOSE_CLASS',0))));
  403. concat_external('FPC_DISPOSE_CLASS',EXT_NEAR);
  404. end
  405. else
  406. begin
  407. list^.insert(new(pai386,op_csymbol(A_CALL,S_NO,
  408. newcsymbol('FPC_HELP_DESTRUCTOR',0))));
  409. list^.insert(new(pai386,op_const_reg(A_MOV,S_L,procinfo._class^.vmt_offset,R_EDI)));
  410. concat_external('FPC_HELP_DESTRUCTOR',EXT_NEAR);
  411. end;
  412. end;
  413. { finalize local data }
  414. aktprocsym^.definition^.localst^.foreach({$ifdef FPC}@{$endif FPC}finalize_data);
  415. { finalize paras data }
  416. if assigned(aktprocsym^.definition^.parast) then
  417. aktprocsym^.definition^.parast^.foreach({$ifdef FPC}@{$endif FPC}finalize_data);
  418. { call __EXIT for main program }
  419. if (not DLLsource) and (not inlined) and ((aktprocsym^.definition^.options and poproginit)<>0) then
  420. begin
  421. list^.concat(new(pai386,op_csymbol(A_CALL,S_NO,newcsymbol('FPC_DO_EXIT',0))));
  422. concat_external('FPC_DO_EXIT',EXT_NEAR);
  423. end;
  424. { handle return value }
  425. if (aktprocsym^.definition^.options and poassembler)=0 then
  426. if (aktprocsym^.definition^.options and poconstructor)=0 then
  427. handle_return_value(list,inlined)
  428. else
  429. begin
  430. { successful constructor deletes the zero flag }
  431. { and returns self in eax }
  432. list^.concat(new(pai_label,init(quickexitlabel)));
  433. { eax must be set to zero if the allocation failed !!! }
  434. list^.concat(new(pai386,op_reg_reg(A_MOV,S_L,R_ESI,R_EAX)));
  435. list^.concat(new(pai386,op_reg_reg(A_OR,S_L,R_EAX,R_EAX)));
  436. end;
  437. { stabs uses the label also ! }
  438. if aktexit2label^.is_used or
  439. ((cs_debuginfo in aktmoduleswitches) and not inlined) then
  440. list^.concat(new(pai_label,init(aktexit2label)));
  441. { gives problems for long mangled names }
  442. {list^.concat(new(pai_symbol,init(aktprocsym^.definition^.mangledname+'_end')));}
  443. { should we restore edi ? }
  444. { for all i386 gcc implementations }
  445. if ((aktprocsym^.definition^.options and pocdecl)<>0) then
  446. begin
  447. list^.insert(new(pai386,op_reg(A_POP,S_L,R_EDI)));
  448. list^.insert(new(pai386,op_reg(A_POP,S_L,R_ESI)));
  449. if (aktprocsym^.definition^.usedregisters and ($80 shr byte(R_EBX)))<>0 then
  450. list^.insert(new(pai386,op_reg(A_POP,S_L,R_EBX)));
  451. { here we could reset R_EBX
  452. but that is risky because it only works
  453. if genexitcode is called after genentrycode
  454. so lets skip this for the moment PM
  455. aktprocsym^.definition^.usedregisters:=
  456. aktprocsym^.definition^.usedregisters or not ($80 shr byte(R_EBX));
  457. }
  458. end;
  459. if not(nostackframe) and not inlined then
  460. list^.concat(new(pai386,op_none(A_LEAVE,S_NO)));
  461. { parameters are limited to 65535 bytes because }
  462. { ret allows only imm16 }
  463. if (parasize>65535) and not(aktprocsym^.definition^.options and poclearstack<>0) then
  464. CGMessage(cg_e_parasize_too_big);
  465. { at last, the return is generated }
  466. if not inlined then
  467. if (aktprocsym^.definition^.options and pointerrupt)<>0 then
  468. generate_interrupt_stackframe_exit
  469. else
  470. begin
  471. {Routines with the poclearstack flag set use only a ret.}
  472. { also routines with parasize=0 }
  473. if (parasize=0) or (aktprocsym^.definition^.options and poclearstack<>0) then
  474. list^.concat(new(pai386,op_none(A_RET,S_NO)))
  475. else
  476. list^.concat(new(pai386,op_const(A_RET,S_NO,parasize)));
  477. end;
  478. {$ifdef GDB}
  479. if (cs_debuginfo in aktmoduleswitches) and not inlined then
  480. begin
  481. aktprocsym^.concatstabto(list);
  482. if assigned(procinfo._class) then
  483. list^.concat(new(pai_stabs,init(strpnew(
  484. '"$t:v'+procinfo._class^.numberstring+'",'+
  485. tostr(N_PSYM)+',0,0,'+tostr(procinfo.esi_offset)))));
  486. if (porddef(aktprocsym^.definition^.retdef) <> voiddef) then
  487. if ret_in_param(aktprocsym^.definition^.retdef) then
  488. list^.concat(new(pai_stabs,init(strpnew(
  489. '"'+aktprocsym^.name+':X*'+aktprocsym^.definition^.retdef^.numberstring+'",'+
  490. tostr(N_PSYM)+',0,0,'+tostr(procinfo.retoffset)))))
  491. else
  492. list^.concat(new(pai_stabs,init(strpnew(
  493. '"'+aktprocsym^.name+':X'+aktprocsym^.definition^.retdef^.numberstring+'",'+
  494. tostr(N_PSYM)+',0,0,'+tostr(procinfo.retoffset)))));
  495. mangled_length:=length(aktprocsym^.definition^.mangledname);
  496. getmem(p,mangled_length+50);
  497. strpcopy(p,'192,0,0,');
  498. strpcopy(strend(p),aktprocsym^.definition^.mangledname);
  499. list^.concat(new(pai_stabn,init(strnew(p))));
  500. {list^.concat(new(pai_stabn,init(strpnew('192,0,0,'
  501. +aktprocsym^.definition^.mangledname))));
  502. p[0]:='2';p[1]:='2';p[2]:='4';
  503. strpcopy(strend(p),'_end');}
  504. freemem(p,mangled_length+50);
  505. list^.concat(new(pai_stabn,init(
  506. strpnew('224,0,0,'+lab2str(aktexit2label)))));
  507. { strpnew('224,0,0,'
  508. +aktprocsym^.definition^.mangledname+'_end'))));}
  509. end;
  510. {$endif GDB}
  511. curlist:=nil;
  512. {$endif dummy}
  513. end;
  514. {*****************************************************************************
  515. some abstract definitions
  516. ****************************************************************************}
  517. procedure tcg.a_push_reg(list : paasmoutput;r : tregister);
  518. begin
  519. abstract;
  520. end;
  521. procedure tcg.a_call_name(list : paasmoutput;const s : string;
  522. offset : longint);
  523. begin
  524. abstract;
  525. end;
  526. procedure tcg.a_load_const8_ref(list : paasmoutput;b : byte;const ref : treference);
  527. begin
  528. abstract;
  529. end;
  530. procedure tcg.a_load_const16_ref(list : paasmoutput;w : word;const ref : treference);
  531. begin
  532. abstract;
  533. end;
  534. procedure tcg.a_load_const32_ref(list : paasmoutput;l : longint;const ref : treference);
  535. begin
  536. abstract;
  537. end;
  538. procedure tcg.a_load_const64_ref(list : paasmoutput;q : qword;const ref : treference);
  539. begin
  540. abstract;
  541. end;
  542. procedure tcg.g_stackframe_entry(list : paasmoutput;localsize : longint);
  543. begin
  544. abstract;
  545. end;
  546. procedure tcg.g_maybe_loadself(list : paasmoutput);
  547. begin
  548. abstract;
  549. end;
  550. end.
  551. {
  552. $Log$
  553. Revision 1.9 1999-08-02 23:13:21 florian
  554. * more changes to compile for the Alpha
  555. Revision 1.8 1999/08/02 17:14:07 florian
  556. + changed the temp. generator to an object
  557. Revision 1.7 1999/08/01 23:05:55 florian
  558. * changes to compile with FPC
  559. Revision 1.6 1999/08/01 18:22:33 florian
  560. * made it again compilable
  561. Revision 1.5 1999/01/23 23:29:46 florian
  562. * first running version of the new code generator
  563. * when compiling exceptions under Linux fixed
  564. Revision 1.4 1999/01/13 22:52:36 florian
  565. + YES, finally the new code generator is compilable, but it doesn't run yet :(
  566. Revision 1.3 1998/12/26 15:20:30 florian
  567. + more changes for the new version
  568. Revision 1.2 1998/12/15 22:18:55 florian
  569. * some code added
  570. Revision 1.1 1998/12/15 16:32:58 florian
  571. + first version, derived from old routines
  572. }