cgcpu.pas 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522
  1. {
  2. Copyright (c) 2002 by Florian Klaempfl
  3. This unit implements the code generator for the x86-64.
  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 cgcpu;
  18. {$i fpcdefs.inc}
  19. interface
  20. uses
  21. cgbase,cgutils,cgobj,cgx86,
  22. aasmbase,aasmtai,aasmdata,aasmcpu,
  23. cpubase,parabase,
  24. symdef,
  25. symconst,rgx86,procinfo;
  26. type
  27. tcgx86_64 = class(tcgx86)
  28. procedure init_register_allocators;override;
  29. procedure a_loadfpu_ref_cgpara(list: TAsmList; size: tcgsize; const ref: treference; const cgpara: TCGPara); override;
  30. procedure a_loadfpu_reg_ref(list: TAsmList; fromsize, tosize: tcgsize; reg: tregister; const ref: treference); override;
  31. procedure g_proc_entry(list : TAsmList;localsize:longint; nostackframe:boolean);override;
  32. procedure g_proc_exit(list : TAsmList;parasize:longint;nostackframe:boolean);override;
  33. procedure g_local_unwind(list: TAsmList; l: TAsmLabel);override;
  34. procedure g_save_registers(list: TAsmList);override;
  35. procedure g_restore_registers(list: TAsmList);override;
  36. procedure a_loadmm_intreg_reg(list: TAsmList; fromsize, tosize : tcgsize;intreg, mmreg: tregister; shuffle: pmmshuffle); override;
  37. procedure a_loadmm_reg_intreg(list: TAsmList; fromsize, tosize : tcgsize;mmreg, intreg: tregister;shuffle : pmmshuffle); override;
  38. function use_ms_abi: boolean;
  39. private
  40. function use_push: boolean;
  41. function saved_xmm_reg_size: longint;
  42. end;
  43. procedure create_codegen;
  44. implementation
  45. uses
  46. globtype,globals,verbose,systems,cutils,cclasses,
  47. symtable,paramgr,cpupi,
  48. rgcpu,ncgutil;
  49. procedure Tcgx86_64.init_register_allocators;
  50. var
  51. ms_abi: boolean;
  52. begin
  53. inherited init_register_allocators;
  54. ms_abi:=use_ms_abi;
  55. if ms_abi then
  56. begin
  57. if (cs_userbp in current_settings.optimizerswitches) and assigned(current_procinfo) and (current_procinfo.framepointer=NR_STACK_POINTER_REG) then
  58. begin
  59. rg[R_INTREGISTER]:=trgcpu.create(R_INTREGISTER,R_SUBWHOLE,[RS_RAX,RS_RDX,RS_RCX,RS_R8,RS_R9,RS_R10,
  60. RS_R11,RS_RBX,RS_RSI,RS_RDI,RS_R12,RS_R13,RS_R14,RS_R15,RS_RBP],first_int_imreg,[]);
  61. end
  62. else
  63. rg[R_INTREGISTER]:=trgcpu.create(R_INTREGISTER,R_SUBWHOLE,[RS_RAX,RS_RDX,RS_RCX,RS_R8,RS_R9,RS_R10,
  64. RS_R11,RS_RBX,RS_RSI,RS_RDI,RS_R12,RS_R13,RS_R14,RS_R15],first_int_imreg,[])
  65. end
  66. else
  67. rg[R_INTREGISTER]:=trgcpu.create(R_INTREGISTER,R_SUBWHOLE,[RS_RAX,RS_RDX,RS_RCX,RS_RSI,RS_RDI,RS_R8,
  68. RS_R9,RS_R10,RS_R11,RS_RBX,RS_R12,RS_R13,RS_R14,RS_R15],first_int_imreg,[]);
  69. rg[R_MMREGISTER]:=trgcpu.create(R_MMREGISTER,R_SUBWHOLE,[RS_XMM0,RS_XMM1,RS_XMM2,RS_XMM3,RS_XMM4,RS_XMM5,RS_XMM6,RS_XMM7,
  70. RS_XMM8,RS_XMM9,RS_XMM10,RS_XMM11,RS_XMM12,RS_XMM13,RS_XMM14,RS_XMM15],first_mm_imreg,[]);
  71. rgfpu:=Trgx86fpu.create;
  72. end;
  73. procedure tcgx86_64.a_loadfpu_ref_cgpara(list: TAsmList; size: tcgsize; const ref: treference; const cgpara: TCGPara);
  74. begin
  75. { a record containing an extended value is returned on the x87 stack
  76. -> size will be OS_F128 (if not packed), while cgpara.paraloc^.size
  77. contains the proper size
  78. In the future we should probably always use cgpara.location^.size, but
  79. that should only be tested/done after 2.8 is branched }
  80. if size in [OS_128,OS_F128] then
  81. size:=cgpara.location^.size;
  82. inherited;
  83. end;
  84. procedure tcgx86_64.a_loadfpu_reg_ref(list: TAsmList; fromsize, tosize: tcgsize; reg: tregister; const ref: treference);
  85. begin
  86. { same as with a_loadfpu_ref_cgpara() above, but on the callee side
  87. when the value is moved from the fpu register into a memory location }
  88. if tosize in [OS_128,OS_F128] then
  89. tosize:=OS_F80;
  90. inherited;
  91. end;
  92. function tcgx86_64.use_push: boolean;
  93. begin
  94. result:=(current_procinfo.framepointer=NR_STACK_POINTER_REG) or
  95. (current_procinfo.procdef.proctypeoption=potype_exceptfilter);
  96. end;
  97. function tcgx86_64.saved_xmm_reg_size: longint;
  98. var
  99. i: longint;
  100. regs_to_save_mm: tcpuregisterarray;
  101. begin
  102. result:=0;
  103. if (target_info.system<>system_x86_64_win64) or
  104. (not uses_registers(R_MMREGISTER)) then
  105. exit;
  106. regs_to_save_mm:=paramanager.get_saved_registers_mm(current_procinfo.procdef.proccalloption);
  107. for i:=low(regs_to_save_mm) to high(regs_to_save_mm) do
  108. begin
  109. if (regs_to_save_mm[i] in rg[R_MMREGISTER].used_in_proc) then
  110. inc(result,tcgsize2size[OS_VECTOR]);
  111. end;
  112. end;
  113. procedure tcgx86_64.g_proc_entry(list : TAsmList;localsize:longint;nostackframe:boolean);
  114. var
  115. hitem: tlinkedlistitem;
  116. seh_proc: tai_seh_directive;
  117. regsize: longint;
  118. r: integer;
  119. href: treference;
  120. templist: TAsmList;
  121. frame_offset: longint;
  122. suppress_endprologue: boolean;
  123. stackmisalignment: longint;
  124. xmmsize: longint;
  125. regs_to_save_int,
  126. regs_to_save_mm: tcpuregisterarray;
  127. procedure push_one_reg(reg: tregister);
  128. begin
  129. list.concat(taicpu.op_reg(A_PUSH,tcgsize2opsize[OS_ADDR],reg));
  130. if (target_info.system=system_x86_64_win64) then
  131. begin
  132. list.concat(cai_seh_directive.create_reg(ash_pushreg,reg));
  133. include(current_procinfo.flags,pi_has_unwind_info);
  134. end;
  135. end;
  136. procedure push_regs;
  137. var
  138. r: longint;
  139. usedregs: tcpuregisterset;
  140. hreg: TRegister;
  141. begin
  142. usedregs:=rg[R_INTREGISTER].used_in_proc-paramanager.get_volatile_registers_int(current_procinfo.procdef.proccalloption);
  143. for r := low(regs_to_save_int) to high(regs_to_save_int) do
  144. if regs_to_save_int[r] in usedregs then
  145. begin
  146. inc(regsize,sizeof(aint));
  147. inc(stackmisalignment,sizeof(aint));
  148. push_one_reg(newreg(R_INTREGISTER,regs_to_save_int[r],R_SUBWHOLE));
  149. hreg:=newreg(R_INTREGISTER,regs_to_save_int[r],R_SUBWHOLE);
  150. if current_procinfo.framepointer<>NR_STACK_POINTER_REG then
  151. current_asmdata.asmcfi.cfa_offset(list,hreg,-(regsize+sizeof(pint)*2+localsize))
  152. else
  153. begin
  154. current_asmdata.asmcfi.cfa_offset(list,hreg,-(regsize+sizeof(pint)+localsize));
  155. current_asmdata.asmcfi.cfa_def_cfa_offset(list,regsize+localsize+sizeof(pint));
  156. end;
  157. end;
  158. end;
  159. begin
  160. regsize:=0;
  161. regs_to_save_int:=paramanager.get_saved_registers_int(current_procinfo.procdef.proccalloption);
  162. regs_to_save_mm:=paramanager.get_saved_registers_mm(current_procinfo.procdef.proccalloption);
  163. hitem:=list.last;
  164. { pi_has_unwind_info may already be set at this point if there are
  165. SEH directives in assembler body. In this case, .seh_endprologue
  166. is expected to be one of those directives, and not generated here. }
  167. suppress_endprologue:=(pi_has_unwind_info in current_procinfo.flags);
  168. { save old framepointer }
  169. if not nostackframe then
  170. begin
  171. { return address }
  172. stackmisalignment := sizeof(pint);
  173. list.concat(tai_regalloc.alloc(current_procinfo.framepointer,nil));
  174. if current_procinfo.framepointer=NR_STACK_POINTER_REG then
  175. begin
  176. push_regs;
  177. CGmessage(cg_d_stackframe_omited);
  178. end
  179. else
  180. begin
  181. { push <frame_pointer> }
  182. inc(stackmisalignment,sizeof(pint));
  183. push_one_reg(NR_FRAME_POINTER_REG);
  184. { Return address and FP are both on stack }
  185. current_asmdata.asmcfi.cfa_def_cfa_offset(list,2*sizeof(pint));
  186. current_asmdata.asmcfi.cfa_offset(list,NR_FRAME_POINTER_REG,-(2*sizeof(pint)));
  187. if current_procinfo.procdef.proctypeoption<>potype_exceptfilter then
  188. list.concat(Taicpu.op_reg_reg(A_MOV,tcgsize2opsize[OS_ADDR],NR_STACK_POINTER_REG,NR_FRAME_POINTER_REG))
  189. else
  190. begin
  191. push_regs;
  192. gen_load_frame_for_exceptfilter(list);
  193. { Need only as much stack space as necessary to do the calls.
  194. Exception filters don't have own local vars, and temps are 'mapped'
  195. to the parent procedure.
  196. maxpushedparasize is already aligned at least on x86_64. }
  197. localsize:=current_procinfo.maxpushedparasize;
  198. end;
  199. current_asmdata.asmcfi.cfa_def_cfa_register(list,NR_FRAME_POINTER_REG);
  200. {
  201. TODO: current framepointer handling is not compatible with Win64 at all:
  202. Win64 expects FP to point to the top or into the middle of local area.
  203. In FPC it points to the bottom, making it impossible to generate
  204. UWOP_SET_FPREG unwind code if local area is > 240 bytes.
  205. So for now pretend we never have a framepointer.
  206. }
  207. end;
  208. xmmsize:=saved_xmm_reg_size;
  209. if use_push and (xmmsize<>0) then
  210. begin
  211. localsize:=align(localsize,target_info.stackalign)+xmmsize;
  212. reference_reset_base(current_procinfo.save_regs_ref,NR_STACK_POINTER_REG,
  213. localsize-xmmsize,ctempposinvalid,tcgsize2size[OS_VECTOR],[]);
  214. end;
  215. { allocate stackframe space }
  216. if (localsize<>0) or
  217. ((target_info.stackalign>sizeof(pint)) and
  218. (stackmisalignment <> 0) and
  219. ((pi_do_call in current_procinfo.flags) or
  220. (po_assembler in current_procinfo.procdef.procoptions))) then
  221. begin
  222. if target_info.stackalign>sizeof(pint) then
  223. localsize := align(localsize+stackmisalignment,target_info.stackalign)-stackmisalignment;
  224. g_stackpointer_alloc(list,localsize);
  225. if current_procinfo.framepointer=NR_STACK_POINTER_REG then
  226. current_asmdata.asmcfi.cfa_def_cfa_offset(list,regsize+localsize+sizeof(pint));
  227. current_procinfo.final_localsize:=localsize;
  228. if (target_info.system=system_x86_64_win64) then
  229. begin
  230. if localsize<>0 then
  231. list.concat(cai_seh_directive.create_offset(ash_stackalloc,localsize));
  232. include(current_procinfo.flags,pi_has_unwind_info);
  233. if use_push and (xmmsize<>0) then
  234. begin
  235. href:=current_procinfo.save_regs_ref;
  236. for r:=low(regs_to_save_mm) to high(regs_to_save_mm) do
  237. if regs_to_save_mm[r] in rg[R_MMREGISTER].used_in_proc then
  238. begin
  239. a_loadmm_reg_ref(list,OS_VECTOR,OS_VECTOR,newreg(R_MMREGISTER,regs_to_save_mm[r],R_SUBMMWHOLE),href,nil);
  240. inc(href.offset,tcgsize2size[OS_VECTOR]);
  241. end;
  242. end;
  243. end;
  244. end;
  245. end;
  246. if not (pi_has_unwind_info in current_procinfo.flags) then
  247. exit;
  248. { Generate unwind data for x86_64-win64 }
  249. seh_proc:=cai_seh_directive.create_name(ash_proc,current_procinfo.procdef.mangledname);
  250. if assigned(hitem) then
  251. list.insertafter(seh_proc,hitem)
  252. else
  253. list.insert(seh_proc);
  254. { the directive creates another section }
  255. inc(list.section_count);
  256. templist:=TAsmList.Create;
  257. { We need to record postive offsets from RSP; if registers are saved
  258. at negative offsets from RBP we need to account for it. }
  259. if (not use_push) then
  260. frame_offset:=current_procinfo.final_localsize
  261. else
  262. frame_offset:=0;
  263. { There's no need to describe position of register saves precisely;
  264. since registers are not modified before they are saved, and saves do not
  265. change RSP, 'logically' all saves can happen at the end of prologue. }
  266. href:=current_procinfo.save_regs_ref;
  267. if (not use_push) then
  268. begin
  269. for r:=low(regs_to_save_int) to high(regs_to_save_int) do
  270. if regs_to_save_int[r] in rg[R_INTREGISTER].used_in_proc then
  271. begin
  272. templist.concat(cai_seh_directive.create_reg_offset(ash_savereg,
  273. newreg(R_INTREGISTER,regs_to_save_int[r],R_SUBWHOLE),
  274. href.offset+frame_offset));
  275. inc(href.offset,sizeof(aint));
  276. end;
  277. end;
  278. if uses_registers(R_MMREGISTER) then
  279. begin
  280. if (href.offset mod tcgsize2size[OS_VECTOR])<>0 then
  281. inc(href.offset,tcgsize2size[OS_VECTOR]-(href.offset mod tcgsize2size[OS_VECTOR]));
  282. for r:=low(regs_to_save_mm) to high(regs_to_save_mm) do
  283. begin
  284. if regs_to_save_mm[r] in rg[R_MMREGISTER].used_in_proc then
  285. begin
  286. templist.concat(cai_seh_directive.create_reg_offset(ash_savexmm,
  287. newreg(R_MMREGISTER,regs_to_save_mm[r],R_SUBMMWHOLE),
  288. href.offset+frame_offset));
  289. inc(href.offset,tcgsize2size[OS_VECTOR]);
  290. end;
  291. end;
  292. end;
  293. if not suppress_endprologue then
  294. templist.concat(cai_seh_directive.create(ash_endprologue));
  295. if assigned(current_procinfo.endprologue_ai) then
  296. current_procinfo.aktproccode.insertlistafter(current_procinfo.endprologue_ai,templist)
  297. else
  298. list.concatlist(templist);
  299. templist.free;
  300. end;
  301. procedure tcgx86_64.g_proc_exit(list : TAsmList;parasize:longint;nostackframe:boolean);
  302. procedure increase_sp(a : tcgint);
  303. var
  304. href : treference;
  305. begin
  306. reference_reset_base(href,NR_STACK_POINTER_REG,a,ctempposinvalid,0,[]);
  307. { normally, lea is a better choice than an add }
  308. list.concat(Taicpu.op_ref_reg(A_LEA,TCGSize2OpSize[OS_ADDR],href,NR_STACK_POINTER_REG));
  309. end;
  310. var
  311. href : treference;
  312. hreg : tregister;
  313. r : longint;
  314. regs_to_save_mm: tcpuregisterarray;
  315. begin
  316. regs_to_save_mm:=paramanager.get_saved_registers_mm(current_procinfo.procdef.proccalloption);;
  317. { Prevent return address from a possible call from ending up in the epilogue }
  318. { (restoring registers happens before epilogue, providing necessary padding) }
  319. if (current_procinfo.flags*[pi_has_unwind_info,pi_do_call,pi_has_saved_regs])=[pi_has_unwind_info,pi_do_call] then
  320. list.concat(Taicpu.op_none(A_NOP));
  321. { remove stackframe }
  322. if not nostackframe then
  323. begin
  324. if use_push then
  325. begin
  326. if (saved_xmm_reg_size<>0) then
  327. begin
  328. href:=current_procinfo.save_regs_ref;
  329. for r:=low(regs_to_save_mm) to high(regs_to_save_mm) do
  330. if regs_to_save_mm[r] in rg[R_MMREGISTER].used_in_proc then
  331. begin
  332. { Allocate register so the optimizer does not remove the load }
  333. hreg:=newreg(R_MMREGISTER,regs_to_save_mm[r],R_SUBMMWHOLE);
  334. a_reg_alloc(list,hreg);
  335. a_loadmm_ref_reg(list,OS_VECTOR,OS_VECTOR,href,hreg,nil);
  336. inc(href.offset,tcgsize2size[OS_VECTOR]);
  337. end;
  338. end;
  339. if (current_procinfo.final_localsize<>0) then
  340. increase_sp(current_procinfo.final_localsize);
  341. internal_restore_regs(list,true);
  342. if (current_procinfo.procdef.proctypeoption=potype_exceptfilter) then
  343. list.concat(Taicpu.op_reg(A_POP,tcgsize2opsize[OS_ADDR],NR_FRAME_POINTER_REG));
  344. current_asmdata.asmcfi.cfa_def_cfa_offset(list,sizeof(pint));
  345. end
  346. else if (target_info.system=system_x86_64_win64) then
  347. begin
  348. { Comply with Win64 unwinding mechanism, which only recognizes
  349. 'add $constant,%rsp' and 'lea offset(FPREG),%rsp' as belonging to
  350. the function epilog.
  351. Neither 'leave' nor even 'mov %FPREG,%rsp' are allowed. }
  352. reference_reset_base(href,current_procinfo.framepointer,0,ctempposinvalid,sizeof(pint),[]);
  353. list.concat(Taicpu.op_ref_reg(A_LEA,tcgsize2opsize[OS_ADDR],href,NR_STACK_POINTER_REG));
  354. list.concat(Taicpu.op_reg(A_POP,tcgsize2opsize[OS_ADDR],current_procinfo.framepointer));
  355. end
  356. else
  357. generate_leave(list);
  358. list.concat(tai_regalloc.dealloc(current_procinfo.framepointer,nil));
  359. end;
  360. list.concat(Taicpu.Op_none(A_RET,S_NO));
  361. if (pi_has_unwind_info in current_procinfo.flags) then
  362. begin
  363. tcpuprocinfo(current_procinfo).dump_scopes(list);
  364. list.concat(cai_seh_directive.create(ash_endproc));
  365. end;
  366. end;
  367. procedure tcgx86_64.g_save_registers(list: TAsmList);
  368. begin
  369. if (not use_push) then
  370. inherited g_save_registers(list);
  371. end;
  372. procedure tcgx86_64.g_restore_registers(list: TAsmList);
  373. begin
  374. if (not use_push) then
  375. inherited g_restore_registers(list);
  376. end;
  377. procedure tcgx86_64.g_local_unwind(list: TAsmList; l: TAsmLabel);
  378. var
  379. para1,para2: tcgpara;
  380. href: treference;
  381. pd: tprocdef;
  382. begin
  383. if (target_info.system<>system_x86_64_win64) then
  384. begin
  385. inherited g_local_unwind(list,l);
  386. exit;
  387. end;
  388. pd:=search_system_proc('_fpc_local_unwind');
  389. para1.init;
  390. para2.init;
  391. paramanager.getintparaloc(list,pd,1,para1);
  392. paramanager.getintparaloc(list,pd,2,para2);
  393. reference_reset_symbol(href,l,0,1,[]);
  394. { TODO: using RSP is correct only while the stack is fixed!!
  395. (true now, but will change if/when allocating from stack is implemented) }
  396. a_load_reg_cgpara(list,OS_ADDR,NR_STACK_POINTER_REG,para1);
  397. a_loadaddr_ref_cgpara(list,href,para2);
  398. paramanager.freecgpara(list,para2);
  399. paramanager.freecgpara(list,para1);
  400. g_call(list,'_FPC_local_unwind');
  401. para2.done;
  402. para1.done;
  403. end;
  404. procedure tcgx86_64.a_loadmm_intreg_reg(list: TAsmList; fromsize, tosize : tcgsize; intreg, mmreg: tregister; shuffle: pmmshuffle);
  405. var
  406. opc: tasmop;
  407. begin
  408. { this code can only be used to transfer raw data, not to perform
  409. conversions }
  410. if (tcgsize2size[fromsize]<>tcgsize2size[tosize]) or
  411. not(tosize in [OS_F32,OS_F64,OS_M64]) then
  412. internalerror(2009112505);
  413. case fromsize of
  414. OS_32,OS_S32:
  415. opc:=A_MOVD;
  416. OS_64,OS_S64:
  417. opc:=A_MOVQ;
  418. else
  419. internalerror(2009112506);
  420. end;
  421. if assigned(shuffle) and
  422. not shufflescalar(shuffle) then
  423. internalerror(2009112517);
  424. list.concat(taicpu.op_reg_reg(opc,S_NO,intreg,mmreg));
  425. end;
  426. procedure tcgx86_64.a_loadmm_reg_intreg(list: TAsmList; fromsize, tosize : tcgsize; mmreg, intreg: tregister;shuffle : pmmshuffle);
  427. var
  428. opc: tasmop;
  429. begin
  430. { this code can only be used to transfer raw data, not to perform
  431. conversions }
  432. if (tcgsize2size[fromsize]<>tcgsize2size[tosize]) or
  433. not (fromsize in [OS_F32,OS_F64,OS_M64]) then
  434. internalerror(2009112507);
  435. case tosize of
  436. OS_32,OS_S32:
  437. opc:=A_MOVD;
  438. OS_64,OS_S64:
  439. opc:=A_MOVQ;
  440. else
  441. internalerror(2009112408);
  442. end;
  443. if assigned(shuffle) and
  444. not shufflescalar(shuffle) then
  445. internalerror(2009112515);
  446. list.concat(taicpu.op_reg_reg(opc,S_NO,mmreg,intreg));
  447. end;
  448. function tcgx86_64.use_ms_abi: boolean;
  449. begin
  450. if assigned(current_procinfo) then
  451. use_ms_abi:=x86_64_use_ms_abi(current_procinfo.procdef.proccalloption)
  452. else
  453. use_ms_abi:=target_info.system=system_x86_64_win64;
  454. end;
  455. procedure create_codegen;
  456. begin
  457. cg:=tcgx86_64.create;
  458. cg128:=tcg128.create;
  459. end;
  460. end.