cgx86.pas 58 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl
  4. This unit implements the common parts of the code generator for the i386 and the x86-64.
  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. { This unit implements the common parts of the code generator for the i386 and the x86-64.
  19. }
  20. unit cgx86;
  21. {$i fpcdefs.inc}
  22. interface
  23. uses
  24. globtype,
  25. cgbase,cgobj,
  26. aasmbase,aasmtai,aasmcpu,
  27. cpubase,cpuinfo,rgobj,rgx86,rgcpu,
  28. symconst,symtype;
  29. type
  30. tcgx86 = class(tcg)
  31. rgfpu : Trgx86fpu;
  32. procedure done_register_allocators;override;
  33. function getfpuregister(list:Taasmoutput;size:Tcgsize):Tregister;override;
  34. function getmmxregister(list:Taasmoutput):Tregister;
  35. procedure getcpuregister(list:Taasmoutput;r:Tregister);override;
  36. procedure ungetcpuregister(list:Taasmoutput;r:Tregister);override;
  37. procedure alloccpuregisters(list:Taasmoutput;rt:Tregistertype;r:Tcpuregisterset);override;
  38. procedure dealloccpuregisters(list:Taasmoutput;rt:Tregistertype;r:Tcpuregisterset);override;
  39. function uses_registers(rt:Tregistertype):boolean;override;
  40. procedure add_reg_instruction(instr:Tai;r:tregister);override;
  41. procedure dec_fpu_stack;
  42. procedure inc_fpu_stack;
  43. procedure a_call_name(list : taasmoutput;const s : string);override;
  44. procedure a_call_reg(list : taasmoutput;reg : tregister);override;
  45. procedure a_op_const_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; a: aint; reg: TRegister); override;
  46. procedure a_op_const_ref(list : taasmoutput; Op: TOpCG; size: TCGSize; a: aint; const ref: TReference); override;
  47. procedure a_op_reg_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; src, dst: TRegister); override;
  48. procedure a_op_ref_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; const ref: TReference; reg: TRegister); override;
  49. procedure a_op_reg_ref(list : taasmoutput; Op: TOpCG; size: TCGSize;reg: TRegister; const ref: TReference); override;
  50. procedure a_op_const_reg_reg(list: taasmoutput; op: TOpCg;
  51. size: tcgsize; a: aint; src, dst: tregister); override;
  52. procedure a_op_reg_reg_reg(list: taasmoutput; op: TOpCg;
  53. size: tcgsize; src1, src2, dst: tregister); override;
  54. { move instructions }
  55. procedure a_load_const_reg(list : taasmoutput; tosize: tcgsize; a : aint;reg : tregister);override;
  56. procedure a_load_const_ref(list : taasmoutput; tosize: tcgsize; a : aint;const ref : treference);override;
  57. procedure a_load_reg_ref(list : taasmoutput;fromsize,tosize: tcgsize; reg : tregister;const ref : treference);override;
  58. procedure a_load_ref_reg(list : taasmoutput;fromsize,tosize: tcgsize;const ref : treference;reg : tregister);override;
  59. procedure a_load_reg_reg(list : taasmoutput;fromsize,tosize: tcgsize;reg1,reg2 : tregister);override;
  60. procedure a_loadaddr_ref_reg(list : taasmoutput;const ref : treference;r : tregister);override;
  61. { fpu move instructions }
  62. procedure a_loadfpu_reg_reg(list: taasmoutput; size: tcgsize; reg1, reg2: tregister); override;
  63. procedure a_loadfpu_ref_reg(list: taasmoutput; size: tcgsize; const ref: treference; reg: tregister); override;
  64. procedure a_loadfpu_reg_ref(list: taasmoutput; size: tcgsize; reg: tregister; const ref: treference); override;
  65. { vector register move instructions }
  66. procedure a_loadmm_reg_reg(list: taasmoutput; fromsize, tosize : tcgsize;reg1, reg2: tregister;shuffle : pmmshuffle); override;
  67. procedure a_loadmm_ref_reg(list: taasmoutput; fromsize, tosize : tcgsize;const ref: treference; reg: tregister;shuffle : pmmshuffle); override;
  68. procedure a_loadmm_reg_ref(list: taasmoutput; fromsize, tosize : tcgsize;reg: tregister; const ref: treference;shuffle : pmmshuffle); override;
  69. procedure a_opmm_ref_reg(list: taasmoutput; Op: TOpCG; size : tcgsize;const ref: treference; reg: tregister;shuffle : pmmshuffle); override;
  70. procedure a_opmm_reg_reg(list: taasmoutput; Op: TOpCG; size : tcgsize;src,dst: tregister;shuffle : pmmshuffle);override;
  71. { comparison operations }
  72. procedure a_cmp_const_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;a : aint;reg : tregister;
  73. l : tasmlabel);override;
  74. procedure a_cmp_const_ref_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;a : aint;const ref : treference;
  75. l : tasmlabel);override;
  76. procedure a_cmp_reg_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;reg1,reg2 : tregister;l : tasmlabel); override;
  77. procedure a_cmp_ref_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;const ref: treference; reg : tregister; l : tasmlabel); override;
  78. procedure a_cmp_reg_ref_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;reg : tregister; const ref: treference; l : tasmlabel); override;
  79. procedure a_jmp_name(list : taasmoutput;const s : string);override;
  80. procedure a_jmp_always(list : taasmoutput;l: tasmlabel); override;
  81. procedure a_jmp_flags(list : taasmoutput;const f : TResFlags;l: tasmlabel); override;
  82. procedure g_flags2reg(list: taasmoutput; size: TCgSize; const f: tresflags; reg: TRegister); override;
  83. procedure g_flags2ref(list: taasmoutput; size: TCgSize; const f: tresflags; const ref: TReference); override;
  84. procedure g_concatcopy(list : taasmoutput;const source,dest : treference;len : aint);override;
  85. { entry/exit code helpers }
  86. procedure g_releasevaluepara_openarray(list : taasmoutput;const ref:treference);override;
  87. procedure g_profilecode(list : taasmoutput);override;
  88. procedure g_stackpointer_alloc(list : taasmoutput;localsize : longint);override;
  89. procedure g_proc_entry(list : taasmoutput;localsize : longint;nostackframe:boolean);override;
  90. procedure g_overflowcheck(list: taasmoutput; const l:tlocation;def:tdef);override;
  91. protected
  92. procedure a_jmp_cond(list : taasmoutput;cond : TOpCmp;l: tasmlabel);
  93. procedure check_register_size(size:tcgsize;reg:tregister);
  94. procedure opmm_loc_reg(list: taasmoutput; Op: TOpCG; size : tcgsize;loc : tlocation;dst: tregister; shuffle : pmmshuffle);
  95. private
  96. procedure sizes2load(s1,s2 : tcgsize;var op: tasmop; var s3: topsize);
  97. procedure floatload(list: taasmoutput; t : tcgsize;const ref : treference);
  98. procedure floatstore(list: taasmoutput; t : tcgsize;const ref : treference);
  99. procedure floatloadops(t : tcgsize;var op : tasmop;var s : topsize);
  100. procedure floatstoreops(t : tcgsize;var op : tasmop;var s : topsize);
  101. end;
  102. function use_sse(def : tdef) : boolean;
  103. const
  104. {$ifdef x86_64}
  105. TCGSize2OpSize: Array[tcgsize] of topsize =
  106. (S_NO,S_B,S_W,S_L,S_Q,S_Q,S_B,S_W,S_L,S_Q,S_Q,
  107. S_FS,S_FL,S_FX,S_IQ,S_FXX,
  108. S_NO,S_NO,S_NO,S_MD,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO);
  109. {$else x86_64}
  110. TCGSize2OpSize: Array[tcgsize] of topsize =
  111. (S_NO,S_B,S_W,S_L,S_L,S_L,S_B,S_W,S_L,S_L,S_L,
  112. S_FS,S_FL,S_FX,S_IQ,S_FXX,
  113. S_NO,S_NO,S_NO,S_MD,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO);
  114. {$endif x86_64}
  115. {$ifndef NOTARGETWIN32}
  116. winstackpagesize = 4096;
  117. {$endif NOTARGETWIN32}
  118. implementation
  119. uses
  120. globals,verbose,systems,cutils,
  121. cgutils,
  122. dwarf,
  123. symdef,defutil,paramgr,tgobj,procinfo;
  124. const
  125. TOpCG2AsmOp: Array[topcg] of TAsmOp = (A_NONE,A_ADD,A_AND,A_DIV,
  126. A_IDIV,A_MUL, A_IMUL, A_NEG,A_NOT,A_OR,
  127. A_SAR,A_SHL,A_SHR,A_SUB,A_XOR);
  128. TOpCmp2AsmCond: Array[topcmp] of TAsmCond = (C_NONE,
  129. C_E,C_G,C_L,C_GE,C_LE,C_NE,C_BE,C_B,C_AE,C_A);
  130. function use_sse(def : tdef) : boolean;
  131. begin
  132. use_sse:=(is_single(def) and (aktfputype in sse_singlescalar)) or
  133. (is_double(def) and (aktfputype in sse_doublescalar));
  134. end;
  135. procedure Tcgx86.done_register_allocators;
  136. begin
  137. rg[R_INTREGISTER].free;
  138. rg[R_MMREGISTER].free;
  139. rg[R_MMXREGISTER].free;
  140. rgfpu.free;
  141. inherited done_register_allocators;
  142. end;
  143. function Tcgx86.getfpuregister(list:Taasmoutput;size:Tcgsize):Tregister;
  144. begin
  145. result:=rgfpu.getregisterfpu(list);
  146. end;
  147. function Tcgx86.getmmxregister(list:Taasmoutput):Tregister;
  148. begin
  149. if not assigned(rg[R_MMXREGISTER]) then
  150. internalerror(200312124);
  151. result:=rg[R_MMXREGISTER].getregister(list,R_SUBNONE);
  152. end;
  153. procedure Tcgx86.getcpuregister(list:Taasmoutput;r:Tregister);
  154. begin
  155. if getregtype(r)=R_FPUREGISTER then
  156. internalerror(2003121210)
  157. else
  158. inherited getcpuregister(list,r);
  159. end;
  160. procedure tcgx86.ungetcpuregister(list:Taasmoutput;r:Tregister);
  161. begin
  162. if getregtype(r)=R_FPUREGISTER then
  163. rgfpu.ungetregisterfpu(list,r)
  164. else
  165. inherited ungetcpuregister(list,r);
  166. end;
  167. procedure Tcgx86.alloccpuregisters(list:Taasmoutput;rt:Tregistertype;r:Tcpuregisterset);
  168. begin
  169. if rt<>R_FPUREGISTER then
  170. inherited alloccpuregisters(list,rt,r);
  171. end;
  172. procedure Tcgx86.dealloccpuregisters(list:Taasmoutput;rt:Tregistertype;r:Tcpuregisterset);
  173. begin
  174. if rt<>R_FPUREGISTER then
  175. inherited dealloccpuregisters(list,rt,r);
  176. end;
  177. function Tcgx86.uses_registers(rt:Tregistertype):boolean;
  178. begin
  179. if rt=R_FPUREGISTER then
  180. result:=false
  181. else
  182. result:=inherited uses_registers(rt);
  183. end;
  184. procedure tcgx86.add_reg_instruction(instr:Tai;r:tregister);
  185. begin
  186. if getregtype(r)<>R_FPUREGISTER then
  187. inherited add_reg_instruction(instr,r);
  188. end;
  189. procedure tcgx86.dec_fpu_stack;
  190. begin
  191. dec(rgfpu.fpuvaroffset);
  192. end;
  193. procedure tcgx86.inc_fpu_stack;
  194. begin
  195. inc(rgfpu.fpuvaroffset);
  196. end;
  197. {****************************************************************************
  198. This is private property, keep out! :)
  199. ****************************************************************************}
  200. procedure tcgx86.sizes2load(s1,s2 : tcgsize; var op: tasmop; var s3: topsize);
  201. begin
  202. case s2 of
  203. OS_8,OS_S8 :
  204. if S1 in [OS_8,OS_S8] then
  205. s3 := S_B
  206. else
  207. internalerror(200109221);
  208. OS_16,OS_S16:
  209. case s1 of
  210. OS_8,OS_S8:
  211. s3 := S_BW;
  212. OS_16,OS_S16:
  213. s3 := S_W;
  214. else
  215. internalerror(200109222);
  216. end;
  217. OS_32,OS_S32:
  218. case s1 of
  219. OS_8,OS_S8:
  220. s3 := S_BL;
  221. OS_16,OS_S16:
  222. s3 := S_WL;
  223. OS_32,OS_S32:
  224. s3 := S_L;
  225. else
  226. internalerror(200109223);
  227. end;
  228. {$ifdef x86_64}
  229. OS_64,OS_S64:
  230. case s1 of
  231. OS_8:
  232. s3 := S_BL;
  233. OS_S8:
  234. s3 := S_BQ;
  235. OS_16:
  236. s3 := S_WL;
  237. OS_S16:
  238. s3 := S_WQ;
  239. OS_32:
  240. s3 := S_L;
  241. OS_S32:
  242. s3 := S_LQ;
  243. OS_64,OS_S64:
  244. s3 := S_Q;
  245. else
  246. internalerror(200304302);
  247. end;
  248. {$endif x86_64}
  249. else
  250. internalerror(200109227);
  251. end;
  252. if s3 in [S_B,S_W,S_L,S_Q] then
  253. op := A_MOV
  254. else if s1 in [OS_8,OS_16,OS_32,OS_64] then
  255. op := A_MOVZX
  256. else
  257. {$ifdef x86_64}
  258. if s3 in [S_LQ] then
  259. op := A_MOVSXD
  260. else
  261. {$endif x86_64}
  262. op := A_MOVSX;
  263. end;
  264. procedure tcgx86.floatloadops(t : tcgsize;var op : tasmop;var s : topsize);
  265. begin
  266. case t of
  267. OS_F32 :
  268. begin
  269. op:=A_FLD;
  270. s:=S_FS;
  271. end;
  272. OS_F64 :
  273. begin
  274. op:=A_FLD;
  275. s:=S_FL;
  276. end;
  277. OS_F80 :
  278. begin
  279. op:=A_FLD;
  280. s:=S_FX;
  281. end;
  282. OS_C64 :
  283. begin
  284. op:=A_FILD;
  285. s:=S_IQ;
  286. end;
  287. else
  288. internalerror(200204041);
  289. end;
  290. end;
  291. procedure tcgx86.floatload(list: taasmoutput; t : tcgsize;const ref : treference);
  292. var
  293. op : tasmop;
  294. s : topsize;
  295. begin
  296. floatloadops(t,op,s);
  297. list.concat(Taicpu.Op_ref(op,s,ref));
  298. inc_fpu_stack;
  299. end;
  300. procedure tcgx86.floatstoreops(t : tcgsize;var op : tasmop;var s : topsize);
  301. begin
  302. case t of
  303. OS_F32 :
  304. begin
  305. op:=A_FSTP;
  306. s:=S_FS;
  307. end;
  308. OS_F64 :
  309. begin
  310. op:=A_FSTP;
  311. s:=S_FL;
  312. end;
  313. OS_F80 :
  314. begin
  315. op:=A_FSTP;
  316. s:=S_FX;
  317. end;
  318. OS_C64 :
  319. begin
  320. op:=A_FISTP;
  321. s:=S_IQ;
  322. end;
  323. else
  324. internalerror(200204042);
  325. end;
  326. end;
  327. procedure tcgx86.floatstore(list: taasmoutput; t : tcgsize;const ref : treference);
  328. var
  329. op : tasmop;
  330. s : topsize;
  331. begin
  332. floatstoreops(t,op,s);
  333. list.concat(Taicpu.Op_ref(op,s,ref));
  334. dec_fpu_stack;
  335. end;
  336. procedure tcgx86.check_register_size(size:tcgsize;reg:tregister);
  337. begin
  338. if TCGSize2OpSize[size]<>TCGSize2OpSize[reg_cgsize(reg)] then
  339. internalerror(200306031);
  340. end;
  341. {****************************************************************************
  342. Assembler code
  343. ****************************************************************************}
  344. procedure tcgx86.a_jmp_name(list : taasmoutput;const s : string);
  345. begin
  346. list.concat(taicpu.op_sym(A_JMP,S_NO,objectlibrary.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION)));
  347. end;
  348. procedure tcgx86.a_jmp_always(list : taasmoutput;l: tasmlabel);
  349. begin
  350. a_jmp_cond(list, OC_NONE, l);
  351. end;
  352. procedure tcgx86.a_call_name(list : taasmoutput;const s : string);
  353. begin
  354. list.concat(taicpu.op_sym(A_CALL,S_NO,objectlibrary.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION)));
  355. end;
  356. procedure tcgx86.a_call_reg(list : taasmoutput;reg : tregister);
  357. begin
  358. list.concat(taicpu.op_reg(A_CALL,S_NO,reg));
  359. end;
  360. {********************** load instructions ********************}
  361. procedure tcgx86.a_load_const_reg(list : taasmoutput; tosize: TCGSize; a : aint; reg : TRegister);
  362. begin
  363. check_register_size(tosize,reg);
  364. { the optimizer will change it to "xor reg,reg" when loading zero, }
  365. { no need to do it here too (JM) }
  366. list.concat(taicpu.op_const_reg(A_MOV,TCGSize2OpSize[tosize],a,reg))
  367. end;
  368. procedure tcgx86.a_load_const_ref(list : taasmoutput; tosize: tcgsize; a : aint;const ref : treference);
  369. {$ifdef x86_64}
  370. var
  371. href : treference;
  372. {$endif x86_64}
  373. begin
  374. {$ifdef x86_64}
  375. { x86_64 only supports signed 32 bits constants directly }
  376. if (tosize in [OS_S64,OS_64]) and
  377. ((a<low(longint)) or (a>high(longint))) then
  378. begin
  379. href:=ref;
  380. a_load_const_ref(list,OS_32,longint(a and $ffffffff),href);
  381. inc(href.offset,4);
  382. a_load_const_ref(list,OS_32,longint(a shr 32),href);
  383. end
  384. else
  385. {$endif x86_64}
  386. list.concat(taicpu.op_const_ref(A_MOV,TCGSize2OpSize[tosize],a,ref));
  387. end;
  388. procedure tcgx86.a_load_reg_ref(list : taasmoutput; fromsize,tosize: TCGSize; reg : tregister;const ref : treference);
  389. var
  390. op: tasmop;
  391. s: topsize;
  392. tmpsize : tcgsize;
  393. tmpreg : tregister;
  394. begin
  395. check_register_size(fromsize,reg);
  396. sizes2load(fromsize,tosize,op,s);
  397. case s of
  398. {$ifdef x86_64}
  399. S_BQ,S_WQ,S_LQ,
  400. {$endif x86_64}
  401. S_BW,S_BL,S_WL :
  402. begin
  403. tmpreg:=getintregister(list,tosize);
  404. {$ifdef x86_64}
  405. { zero extensions to 64 bit on the x86_64 are simply done by writting to the lower 32 bit
  406. which clears the upper 64 bit too, so it could be that s is S_L while the reg is
  407. 64 bit (FK) }
  408. if s in [S_BL,S_WL,S_L] then
  409. begin
  410. tmpreg:=makeregsize(list,tmpreg,OS_32);
  411. tmpsize:=OS_32;
  412. end
  413. else
  414. tmpsize:=tosize;
  415. {$endif x86_64}
  416. list.concat(taicpu.op_reg_reg(op,s,reg,tmpreg));
  417. a_load_reg_ref(list,tmpsize,tosize,tmpreg,ref);
  418. end;
  419. else
  420. list.concat(taicpu.op_reg_ref(op,s,reg,ref));
  421. end;
  422. end;
  423. procedure tcgx86.a_load_ref_reg(list : taasmoutput;fromsize,tosize : tcgsize;const ref: treference;reg : tregister);
  424. var
  425. op: tasmop;
  426. s: topsize;
  427. begin
  428. check_register_size(tosize,reg);
  429. sizes2load(fromsize,tosize,op,s);
  430. {$ifdef x86_64}
  431. { zero extensions to 64 bit on the x86_64 are simply done by writting to the lower 32 bit
  432. which clears the upper 64 bit too, so it could be that s is S_L while the reg is
  433. 64 bit (FK) }
  434. if s in [S_BL,S_WL,S_L] then
  435. reg:=makeregsize(list,reg,OS_32);
  436. {$endif x86_64}
  437. list.concat(taicpu.op_ref_reg(op,s,ref,reg));
  438. end;
  439. procedure tcgx86.a_load_reg_reg(list : taasmoutput;fromsize,tosize : tcgsize;reg1,reg2 : tregister);
  440. var
  441. op: tasmop;
  442. s: topsize;
  443. instr:Taicpu;
  444. begin
  445. check_register_size(fromsize,reg1);
  446. check_register_size(tosize,reg2);
  447. if tcgsize2size[fromsize]>tcgsize2size[tosize] then
  448. begin
  449. reg1:=makeregsize(list,reg1,tosize);
  450. s:=tcgsize2opsize[tosize];
  451. op:=A_MOV;
  452. end
  453. else
  454. sizes2load(fromsize,tosize,op,s);
  455. {$ifdef x86_64}
  456. { zero extensions to 64 bit on the x86_64 are simply done by writting to the lower 32 bit
  457. which clears the upper 64 bit too, so it could be that s is S_L while the reg is
  458. 64 bit (FK) }
  459. if s in [S_BL,S_WL,S_L] then
  460. reg2:=makeregsize(list,reg2,OS_32);
  461. {$endif x86_64}
  462. if (reg1<>reg2) then
  463. begin
  464. instr:=taicpu.op_reg_reg(op,s,reg1,reg2);
  465. { Notify the register allocator that we have written a move instruction so
  466. it can try to eliminate it. }
  467. add_move_instruction(instr);
  468. list.concat(instr);
  469. end;
  470. end;
  471. procedure tcgx86.a_loadaddr_ref_reg(list : taasmoutput;const ref : treference;r : tregister);
  472. begin
  473. with ref do
  474. if (base=NR_NO) and (index=NR_NO) then
  475. begin
  476. if assigned(ref.symbol) then
  477. list.concat(Taicpu.op_sym_ofs_reg(A_MOV,tcgsize2opsize[OS_ADDR],symbol,offset,r))
  478. else
  479. a_load_const_reg(list,OS_ADDR,offset,r);
  480. end
  481. else if (base=NR_NO) and (index<>NR_NO) and
  482. (offset=0) and (scalefactor=0) and (symbol=nil) then
  483. a_load_reg_reg(list,OS_ADDR,OS_ADDR,index,r)
  484. else if (base<>NR_NO) and (index=NR_NO) and
  485. (offset=0) and (symbol=nil) then
  486. a_load_reg_reg(list,OS_ADDR,OS_ADDR,base,r)
  487. else
  488. list.concat(taicpu.op_ref_reg(A_LEA,tcgsize2opsize[OS_ADDR],ref,r));
  489. end;
  490. { all fpu load routines expect that R_ST[0-7] means an fpu regvar and }
  491. { R_ST means "the current value at the top of the fpu stack" (JM) }
  492. procedure tcgx86.a_loadfpu_reg_reg(list: taasmoutput; size: tcgsize; reg1, reg2: tregister);
  493. begin
  494. if (reg1<>NR_ST) then
  495. begin
  496. list.concat(taicpu.op_reg(A_FLD,S_NO,rgfpu.correct_fpuregister(reg1,rgfpu.fpuvaroffset)));
  497. inc_fpu_stack;
  498. end;
  499. if (reg2<>NR_ST) then
  500. begin
  501. list.concat(taicpu.op_reg(A_FSTP,S_NO,rgfpu.correct_fpuregister(reg2,rgfpu.fpuvaroffset)));
  502. dec_fpu_stack;
  503. end;
  504. end;
  505. procedure tcgx86.a_loadfpu_ref_reg(list: taasmoutput; size: tcgsize; const ref: treference; reg: tregister);
  506. begin
  507. floatload(list,size,ref);
  508. if (reg<>NR_ST) then
  509. a_loadfpu_reg_reg(list,size,NR_ST,reg);
  510. end;
  511. procedure tcgx86.a_loadfpu_reg_ref(list: taasmoutput; size: tcgsize; reg: tregister; const ref: treference);
  512. begin
  513. if reg<>NR_ST then
  514. a_loadfpu_reg_reg(list,size,reg,NR_ST);
  515. floatstore(list,size,ref);
  516. end;
  517. function get_scalar_mm_op(fromsize,tosize : tcgsize) : tasmop;
  518. const
  519. convertop : array[OS_F32..OS_F128,OS_F32..OS_F128] of tasmop = (
  520. (A_MOVSS,A_CVTSS2SD,A_NONE,A_NONE,A_NONE),
  521. (A_CVTSD2SS,A_MOVSD,A_NONE,A_NONE,A_NONE),
  522. (A_NONE,A_NONE,A_NONE,A_NONE,A_NONE),
  523. (A_NONE,A_NONE,A_NONE,A_MOVQ,A_NONE),
  524. (A_NONE,A_NONE,A_NONE,A_NONE,A_NONE));
  525. begin
  526. result:=convertop[fromsize,tosize];
  527. if result=A_NONE then
  528. internalerror(200312205);
  529. end;
  530. procedure tcgx86.a_loadmm_reg_reg(list: taasmoutput; fromsize, tosize : tcgsize;reg1, reg2: tregister;shuffle : pmmshuffle);
  531. begin
  532. if shuffle=nil then
  533. begin
  534. if fromsize=tosize then
  535. list.concat(taicpu.op_reg_reg(A_MOVAPS,S_NO,reg1,reg2))
  536. else
  537. internalerror(200312202);
  538. end
  539. else if shufflescalar(shuffle) then
  540. list.concat(taicpu.op_reg_reg(get_scalar_mm_op(fromsize,tosize),S_NO,reg1,reg2))
  541. else
  542. internalerror(200312201);
  543. end;
  544. procedure tcgx86.a_loadmm_ref_reg(list: taasmoutput; fromsize, tosize : tcgsize;const ref: treference; reg: tregister;shuffle : pmmshuffle);
  545. begin
  546. if shuffle=nil then
  547. begin
  548. list.concat(taicpu.op_ref_reg(A_MOVQ,S_NO,ref,reg));
  549. end
  550. else if shufflescalar(shuffle) then
  551. list.concat(taicpu.op_ref_reg(get_scalar_mm_op(fromsize,tosize),S_NO,ref,reg))
  552. else
  553. internalerror(200312252);
  554. end;
  555. procedure tcgx86.a_loadmm_reg_ref(list: taasmoutput; fromsize, tosize : tcgsize;reg: tregister; const ref: treference;shuffle : pmmshuffle);
  556. begin
  557. if shuffle=nil then
  558. begin
  559. list.concat(taicpu.op_reg_ref(A_MOVQ,S_NO,reg,ref));
  560. end
  561. else if shufflescalar(shuffle) then
  562. list.concat(taicpu.op_reg_ref(get_scalar_mm_op(fromsize,tosize),S_NO,reg,ref))
  563. else
  564. internalerror(200312252);
  565. end;
  566. procedure tcgx86.a_opmm_ref_reg(list: taasmoutput; Op: TOpCG; size : tcgsize;const ref: treference; reg: tregister;shuffle : pmmshuffle);
  567. var
  568. l : tlocation;
  569. begin
  570. l.loc:=LOC_REFERENCE;
  571. l.reference:=ref;
  572. l.size:=size;
  573. opmm_loc_reg(list,op,size,l,reg,shuffle);
  574. end;
  575. procedure tcgx86.a_opmm_reg_reg(list: taasmoutput; Op: TOpCG; size : tcgsize;src,dst: tregister;shuffle : pmmshuffle);
  576. var
  577. l : tlocation;
  578. begin
  579. l.loc:=LOC_MMREGISTER;
  580. l.register:=src;
  581. l.size:=size;
  582. opmm_loc_reg(list,op,size,l,dst,shuffle);
  583. end;
  584. procedure tcgx86.opmm_loc_reg(list: taasmoutput; Op: TOpCG; size : tcgsize;loc : tlocation;dst: tregister; shuffle : pmmshuffle);
  585. const
  586. opmm2asmop : array[0..1,OS_F32..OS_F64,topcg] of tasmop = (
  587. ( { scalar }
  588. ( { OS_F32 }
  589. A_NOP,A_ADDSS,A_NOP,A_DIVSS,A_NOP,A_NOP,A_MULSS,A_NOP,A_NOP,A_NOP,A_NOP,A_NOP,A_NOP,A_SUBSS,A_NOP
  590. ),
  591. ( { OS_F64 }
  592. A_NOP,A_ADDSD,A_NOP,A_DIVSD,A_NOP,A_NOP,A_MULSD,A_NOP,A_NOP,A_NOP,A_NOP,A_NOP,A_NOP,A_SUBSD,A_NOP
  593. )
  594. ),
  595. ( { vectorized/packed }
  596. { because the logical packed single instructions have shorter op codes, we use always
  597. these
  598. }
  599. ( { OS_F32 }
  600. A_NOP,A_ADDPS,A_NOP,A_NOP,A_NOP,A_NOP,A_NOP,A_NOP,A_NOP,A_NOP,A_NOP,A_NOP,A_NOP,A_NOP,A_XORPS
  601. ),
  602. ( { OS_F64 }
  603. A_NOP,A_ADDPD,A_NOP,A_NOP,A_NOP,A_NOP,A_NOP,A_NOP,A_NOP,A_NOP,A_NOP,A_NOP,A_NOP,A_NOP,A_XORPS
  604. )
  605. )
  606. );
  607. var
  608. resultreg : tregister;
  609. asmop : tasmop;
  610. begin
  611. { this is an internally used procedure so the parameters have
  612. some constrains
  613. }
  614. if loc.size<>size then
  615. internalerror(200312213);
  616. resultreg:=dst;
  617. { deshuffle }
  618. //!!!
  619. if (shuffle<>nil) and not(shufflescalar(shuffle)) then
  620. begin
  621. end
  622. else if (shuffle=nil) then
  623. asmop:=opmm2asmop[1,size,op]
  624. else if shufflescalar(shuffle) then
  625. begin
  626. asmop:=opmm2asmop[0,size,op];
  627. { no scalar operation available? }
  628. if asmop=A_NOP then
  629. begin
  630. { do vectorized and shuffle finally }
  631. //!!!
  632. end;
  633. end
  634. else
  635. internalerror(200312211);
  636. if asmop=A_NOP then
  637. internalerror(200312215);
  638. case loc.loc of
  639. LOC_CREFERENCE,LOC_REFERENCE:
  640. list.concat(taicpu.op_ref_reg(asmop,S_NO,loc.reference,resultreg));
  641. LOC_CMMREGISTER,LOC_MMREGISTER:
  642. list.concat(taicpu.op_reg_reg(asmop,S_NO,loc.register,resultreg));
  643. else
  644. internalerror(200312214);
  645. end;
  646. { shuffle }
  647. if resultreg<>dst then
  648. begin
  649. internalerror(200312212);
  650. end;
  651. end;
  652. procedure tcgx86.a_op_const_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; a: aint; reg: TRegister);
  653. var
  654. opcode : tasmop;
  655. power : longint;
  656. {$ifdef x86_64}
  657. tmpreg : tregister;
  658. {$endif x86_64}
  659. begin
  660. {$ifdef x86_64}
  661. { x86_64 only supports signed 32 bits constants directly }
  662. if (size in [OS_S64,OS_64]) and
  663. ((a<low(longint)) or (a>high(longint))) then
  664. begin
  665. tmpreg:=getintregister(list,size);
  666. a_load_const_reg(list,size,a,tmpreg);
  667. a_op_reg_reg(list,op,size,tmpreg,reg);
  668. exit;
  669. end;
  670. {$endif x86_64}
  671. check_register_size(size,reg);
  672. case op of
  673. OP_DIV, OP_IDIV:
  674. begin
  675. if ispowerof2(int64(a),power) then
  676. begin
  677. case op of
  678. OP_DIV:
  679. opcode := A_SHR;
  680. OP_IDIV:
  681. opcode := A_SAR;
  682. end;
  683. list.concat(taicpu.op_const_reg(opcode,TCgSize2OpSize[size],power,reg));
  684. exit;
  685. end;
  686. { the rest should be handled specifically in the code }
  687. { generator because of the silly register usage restraints }
  688. internalerror(200109224);
  689. end;
  690. OP_MUL,OP_IMUL:
  691. begin
  692. if not(cs_check_overflow in aktlocalswitches) and
  693. ispowerof2(int64(a),power) then
  694. begin
  695. list.concat(taicpu.op_const_reg(A_SHL,TCgSize2OpSize[size],power,reg));
  696. exit;
  697. end;
  698. if op = OP_IMUL then
  699. list.concat(taicpu.op_const_reg(A_IMUL,TCgSize2OpSize[size],a,reg))
  700. else
  701. { OP_MUL should be handled specifically in the code }
  702. { generator because of the silly register usage restraints }
  703. internalerror(200109225);
  704. end;
  705. OP_ADD, OP_AND, OP_OR, OP_SUB, OP_XOR:
  706. if not(cs_check_overflow in aktlocalswitches) and
  707. (a = 1) and
  708. (op in [OP_ADD,OP_SUB]) then
  709. if op = OP_ADD then
  710. list.concat(taicpu.op_reg(A_INC,TCgSize2OpSize[size],reg))
  711. else
  712. list.concat(taicpu.op_reg(A_DEC,TCgSize2OpSize[size],reg))
  713. else if (a = 0) then
  714. if (op <> OP_AND) then
  715. exit
  716. else
  717. list.concat(taicpu.op_const_reg(A_MOV,TCgSize2OpSize[size],0,reg))
  718. else if (aword(a) = high(aword)) and
  719. (op in [OP_AND,OP_OR,OP_XOR]) then
  720. begin
  721. case op of
  722. OP_AND:
  723. exit;
  724. OP_OR:
  725. list.concat(taicpu.op_const_reg(A_MOV,TCgSize2OpSize[size],aint(high(aword)),reg));
  726. OP_XOR:
  727. list.concat(taicpu.op_reg(A_NOT,TCgSize2OpSize[size],reg));
  728. end
  729. end
  730. else
  731. list.concat(taicpu.op_const_reg(TOpCG2AsmOp[op],TCgSize2OpSize[size],a,reg));
  732. OP_SHL,OP_SHR,OP_SAR:
  733. begin
  734. if (a and 31) <> 0 Then
  735. list.concat(taicpu.op_const_reg(TOpCG2AsmOp[op],TCgSize2OpSize[size],a and 31,reg));
  736. if (a shr 5) <> 0 Then
  737. internalerror(68991);
  738. end
  739. else internalerror(68992);
  740. end;
  741. end;
  742. procedure tcgx86.a_op_const_ref(list : taasmoutput; Op: TOpCG; size: TCGSize; a: aint; const ref: TReference);
  743. var
  744. opcode: tasmop;
  745. power: longint;
  746. {$ifdef x86_64}
  747. tmpreg : tregister;
  748. {$endif x86_64}
  749. begin
  750. {$ifdef x86_64}
  751. { x86_64 only supports signed 32 bits constants directly }
  752. if (size in [OS_S64,OS_64]) and
  753. ((a<low(longint)) or (a>high(longint))) then
  754. begin
  755. tmpreg:=getintregister(list,size);
  756. a_load_const_reg(list,size,a,tmpreg);
  757. a_op_reg_ref(list,op,size,tmpreg,ref);
  758. exit;
  759. end;
  760. {$endif x86_64}
  761. Case Op of
  762. OP_DIV, OP_IDIV:
  763. Begin
  764. if ispowerof2(int64(a),power) then
  765. begin
  766. case op of
  767. OP_DIV:
  768. opcode := A_SHR;
  769. OP_IDIV:
  770. opcode := A_SAR;
  771. end;
  772. list.concat(taicpu.op_const_ref(opcode,
  773. TCgSize2OpSize[size],power,ref));
  774. exit;
  775. end;
  776. { the rest should be handled specifically in the code }
  777. { generator because of the silly register usage restraints }
  778. internalerror(200109231);
  779. End;
  780. OP_MUL,OP_IMUL:
  781. begin
  782. if not(cs_check_overflow in aktlocalswitches) and
  783. ispowerof2(int64(a),power) then
  784. begin
  785. list.concat(taicpu.op_const_ref(A_SHL,TCgSize2OpSize[size],
  786. power,ref));
  787. exit;
  788. end;
  789. { can't multiply a memory location directly with a constant }
  790. if op = OP_IMUL then
  791. inherited a_op_const_ref(list,op,size,a,ref)
  792. else
  793. { OP_MUL should be handled specifically in the code }
  794. { generator because of the silly register usage restraints }
  795. internalerror(200109232);
  796. end;
  797. OP_ADD, OP_AND, OP_OR, OP_SUB, OP_XOR:
  798. if not(cs_check_overflow in aktlocalswitches) and
  799. (a = 1) and
  800. (op in [OP_ADD,OP_SUB]) then
  801. if op = OP_ADD then
  802. list.concat(taicpu.op_ref(A_INC,TCgSize2OpSize[size],ref))
  803. else
  804. list.concat(taicpu.op_ref(A_DEC,TCgSize2OpSize[size],ref))
  805. else if (a = 0) then
  806. if (op <> OP_AND) then
  807. exit
  808. else
  809. a_load_const_ref(list,size,0,ref)
  810. else if (aword(a) = high(aword)) and
  811. (op in [OP_AND,OP_OR,OP_XOR]) then
  812. begin
  813. case op of
  814. OP_AND:
  815. exit;
  816. OP_OR:
  817. list.concat(taicpu.op_const_ref(A_MOV,TCgSize2OpSize[size],aint(high(aword)),ref));
  818. OP_XOR:
  819. list.concat(taicpu.op_ref(A_NOT,TCgSize2OpSize[size],ref));
  820. end
  821. end
  822. else
  823. list.concat(taicpu.op_const_ref(TOpCG2AsmOp[op],
  824. TCgSize2OpSize[size],a,ref));
  825. OP_SHL,OP_SHR,OP_SAR:
  826. begin
  827. if (a and 31) <> 0 then
  828. list.concat(taicpu.op_const_ref(
  829. TOpCG2AsmOp[op],TCgSize2OpSize[size],a and 31,ref));
  830. if (a shr 5) <> 0 Then
  831. internalerror(68991);
  832. end
  833. else internalerror(68992);
  834. end;
  835. end;
  836. procedure tcgx86.a_op_reg_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; src, dst: TRegister);
  837. var
  838. dstsize: topsize;
  839. instr:Taicpu;
  840. begin
  841. check_register_size(size,src);
  842. check_register_size(size,dst);
  843. dstsize := tcgsize2opsize[size];
  844. case op of
  845. OP_NEG,OP_NOT:
  846. begin
  847. if src<>dst then
  848. a_load_reg_reg(list,size,size,src,dst);
  849. list.concat(taicpu.op_reg(TOpCG2AsmOp[op],dstsize,dst));
  850. end;
  851. OP_MUL,OP_DIV,OP_IDIV:
  852. { special stuff, needs separate handling inside code }
  853. { generator }
  854. internalerror(200109233);
  855. OP_SHR,OP_SHL,OP_SAR:
  856. begin
  857. getcpuregister(list,NR_CL);
  858. a_load_reg_reg(list,OS_8,OS_8,makeregsize(list,src,OS_8),NR_CL);
  859. list.concat(taicpu.op_reg_reg(Topcg2asmop[op],tcgsize2opsize[size],NR_CL,src));
  860. ungetcpuregister(list,NR_CL);
  861. end;
  862. else
  863. begin
  864. if reg2opsize(src) <> dstsize then
  865. internalerror(200109226);
  866. instr:=taicpu.op_reg_reg(TOpCG2AsmOp[op],dstsize,src,dst);
  867. list.concat(instr);
  868. end;
  869. end;
  870. end;
  871. procedure tcgx86.a_op_ref_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; const ref: TReference; reg: TRegister);
  872. begin
  873. check_register_size(size,reg);
  874. case op of
  875. OP_NEG,OP_NOT,OP_IMUL:
  876. begin
  877. inherited a_op_ref_reg(list,op,size,ref,reg);
  878. end;
  879. OP_MUL,OP_DIV,OP_IDIV:
  880. { special stuff, needs separate handling inside code }
  881. { generator }
  882. internalerror(200109239);
  883. else
  884. begin
  885. reg := makeregsize(list,reg,size);
  886. list.concat(taicpu.op_ref_reg(TOpCG2AsmOp[op],tcgsize2opsize[size],ref,reg));
  887. end;
  888. end;
  889. end;
  890. procedure tcgx86.a_op_reg_ref(list : taasmoutput; Op: TOpCG; size: TCGSize;reg: TRegister; const ref: TReference);
  891. begin
  892. check_register_size(size,reg);
  893. case op of
  894. OP_NEG,OP_NOT:
  895. begin
  896. if reg<>NR_NO then
  897. internalerror(200109237);
  898. list.concat(taicpu.op_ref(TOpCG2AsmOp[op],tcgsize2opsize[size],ref));
  899. end;
  900. OP_IMUL:
  901. begin
  902. { this one needs a load/imul/store, which is the default }
  903. inherited a_op_ref_reg(list,op,size,ref,reg);
  904. end;
  905. OP_MUL,OP_DIV,OP_IDIV:
  906. { special stuff, needs separate handling inside code }
  907. { generator }
  908. internalerror(200109238);
  909. else
  910. begin
  911. list.concat(taicpu.op_reg_ref(TOpCG2AsmOp[op],tcgsize2opsize[size],reg,ref));
  912. end;
  913. end;
  914. end;
  915. procedure tcgx86.a_op_const_reg_reg(list: taasmoutput; op: TOpCg; size: tcgsize; a: aint; src, dst: tregister);
  916. var
  917. tmpref: treference;
  918. power: longint;
  919. {$ifdef x86_64}
  920. tmpreg : tregister;
  921. {$endif x86_64}
  922. begin
  923. {$ifdef x86_64}
  924. { x86_64 only supports signed 32 bits constants directly }
  925. if (size in [OS_S64,OS_64]) and
  926. ((a<low(longint)) or (a>high(longint))) then
  927. begin
  928. tmpreg:=getintregister(list,size);
  929. a_load_const_reg(list,size,a,tmpreg);
  930. a_op_reg_reg_reg(list,op,size,tmpreg,src,dst);
  931. exit;
  932. end;
  933. {$endif x86_64}
  934. check_register_size(size,src);
  935. check_register_size(size,dst);
  936. if tcgsize2size[size]<>tcgsize2size[OS_INT] then
  937. begin
  938. inherited a_op_const_reg_reg(list,op,size,a,src,dst);
  939. exit;
  940. end;
  941. { if we get here, we have to do a 32 bit calculation, guaranteed }
  942. case op of
  943. OP_DIV, OP_IDIV, OP_MUL, OP_AND, OP_OR, OP_XOR, OP_SHL, OP_SHR,
  944. OP_SAR:
  945. { can't do anything special for these }
  946. inherited a_op_const_reg_reg(list,op,size,a,src,dst);
  947. OP_IMUL:
  948. begin
  949. if not(cs_check_overflow in aktlocalswitches) and
  950. ispowerof2(int64(a),power) then
  951. { can be done with a shift }
  952. begin
  953. inherited a_op_const_reg_reg(list,op,size,a,src,dst);
  954. exit;
  955. end;
  956. list.concat(taicpu.op_const_reg_reg(A_IMUL,tcgsize2opsize[size],a,src,dst));
  957. end;
  958. OP_ADD, OP_SUB:
  959. if (a = 0) then
  960. a_load_reg_reg(list,size,size,src,dst)
  961. else
  962. begin
  963. reference_reset(tmpref);
  964. tmpref.base := src;
  965. tmpref.offset := longint(a);
  966. if op = OP_SUB then
  967. tmpref.offset := -tmpref.offset;
  968. list.concat(taicpu.op_ref_reg(A_LEA,tcgsize2opsize[size],tmpref,dst));
  969. end
  970. else internalerror(200112302);
  971. end;
  972. end;
  973. procedure tcgx86.a_op_reg_reg_reg(list: taasmoutput; op: TOpCg;size: tcgsize; src1, src2, dst: tregister);
  974. var
  975. tmpref: treference;
  976. begin
  977. check_register_size(size,src1);
  978. check_register_size(size,src2);
  979. check_register_size(size,dst);
  980. if tcgsize2size[size]<>tcgsize2size[OS_INT] then
  981. begin
  982. inherited a_op_reg_reg_reg(list,op,size,src1,src2,dst);
  983. exit;
  984. end;
  985. { if we get here, we have to do a 32 bit calculation, guaranteed }
  986. Case Op of
  987. OP_DIV, OP_IDIV, OP_MUL, OP_AND, OP_OR, OP_XOR, OP_SHL, OP_SHR,
  988. OP_SAR,OP_SUB,OP_NOT,OP_NEG:
  989. { can't do anything special for these }
  990. inherited a_op_reg_reg_reg(list,op,size,src1,src2,dst);
  991. OP_IMUL:
  992. list.concat(taicpu.op_reg_reg_reg(A_IMUL,tcgsize2opsize[size],src1,src2,dst));
  993. OP_ADD:
  994. begin
  995. reference_reset(tmpref);
  996. tmpref.base := src1;
  997. tmpref.index := src2;
  998. tmpref.scalefactor := 1;
  999. list.concat(taicpu.op_ref_reg(A_LEA,tcgsize2opsize[size],tmpref,dst));
  1000. end
  1001. else internalerror(200112303);
  1002. end;
  1003. end;
  1004. {*************** compare instructructions ****************}
  1005. procedure tcgx86.a_cmp_const_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;a : aint;reg : tregister;
  1006. l : tasmlabel);
  1007. {$ifdef x86_64}
  1008. var
  1009. tmpreg : tregister;
  1010. {$endif x86_64}
  1011. begin
  1012. {$ifdef x86_64}
  1013. { x86_64 only supports signed 32 bits constants directly }
  1014. if (size in [OS_S64,OS_64]) and
  1015. ((a<low(longint)) or (a>high(longint))) then
  1016. begin
  1017. tmpreg:=getintregister(list,size);
  1018. a_load_const_reg(list,size,a,tmpreg);
  1019. a_cmp_reg_reg_label(list,size,cmp_op,tmpreg,reg,l);
  1020. exit;
  1021. end;
  1022. {$endif x86_64}
  1023. if (a = 0) then
  1024. list.concat(taicpu.op_reg_reg(A_TEST,tcgsize2opsize[size],reg,reg))
  1025. else
  1026. list.concat(taicpu.op_const_reg(A_CMP,tcgsize2opsize[size],a,reg));
  1027. a_jmp_cond(list,cmp_op,l);
  1028. end;
  1029. procedure tcgx86.a_cmp_const_ref_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;a : aint;const ref : treference;
  1030. l : tasmlabel);
  1031. {$ifdef x86_64}
  1032. var
  1033. tmpreg : tregister;
  1034. {$endif x86_64}
  1035. begin
  1036. {$ifdef x86_64}
  1037. { x86_64 only supports signed 32 bits constants directly }
  1038. if (size in [OS_S64,OS_64]) and
  1039. ((a<low(longint)) or (a>high(longint))) then
  1040. begin
  1041. tmpreg:=getintregister(list,size);
  1042. a_load_const_reg(list,size,a,tmpreg);
  1043. a_cmp_reg_ref_label(list,size,cmp_op,tmpreg,ref,l);
  1044. exit;
  1045. end;
  1046. {$endif x86_64}
  1047. list.concat(taicpu.op_const_ref(A_CMP,TCgSize2OpSize[size],a,ref));
  1048. a_jmp_cond(list,cmp_op,l);
  1049. end;
  1050. procedure tcgx86.a_cmp_reg_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;
  1051. reg1,reg2 : tregister;l : tasmlabel);
  1052. begin
  1053. check_register_size(size,reg1);
  1054. check_register_size(size,reg2);
  1055. list.concat(taicpu.op_reg_reg(A_CMP,TCgSize2OpSize[size],reg1,reg2));
  1056. a_jmp_cond(list,cmp_op,l);
  1057. end;
  1058. procedure tcgx86.a_cmp_ref_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;const ref: treference; reg : tregister;l : tasmlabel);
  1059. begin
  1060. check_register_size(size,reg);
  1061. list.concat(taicpu.op_ref_reg(A_CMP,TCgSize2OpSize[size],ref,reg));
  1062. a_jmp_cond(list,cmp_op,l);
  1063. end;
  1064. procedure tcgx86.a_cmp_reg_ref_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;reg : tregister;const ref: treference; l : tasmlabel);
  1065. begin
  1066. check_register_size(size,reg);
  1067. list.concat(taicpu.op_reg_ref(A_CMP,TCgSize2OpSize[size],reg,ref));
  1068. a_jmp_cond(list,cmp_op,l);
  1069. end;
  1070. procedure tcgx86.a_jmp_cond(list : taasmoutput;cond : TOpCmp;l: tasmlabel);
  1071. var
  1072. ai : taicpu;
  1073. begin
  1074. if cond=OC_None then
  1075. ai := Taicpu.Op_sym(A_JMP,S_NO,l)
  1076. else
  1077. begin
  1078. ai:=Taicpu.Op_sym(A_Jcc,S_NO,l);
  1079. ai.SetCondition(TOpCmp2AsmCond[cond]);
  1080. end;
  1081. ai.is_jmp:=true;
  1082. list.concat(ai);
  1083. end;
  1084. procedure tcgx86.a_jmp_flags(list : taasmoutput;const f : TResFlags;l: tasmlabel);
  1085. var
  1086. ai : taicpu;
  1087. begin
  1088. ai := Taicpu.op_sym(A_Jcc,S_NO,l);
  1089. ai.SetCondition(flags_to_cond(f));
  1090. ai.is_jmp := true;
  1091. list.concat(ai);
  1092. end;
  1093. procedure tcgx86.g_flags2reg(list: taasmoutput; size: TCgSize; const f: tresflags; reg: TRegister);
  1094. var
  1095. ai : taicpu;
  1096. hreg : tregister;
  1097. begin
  1098. hreg:=makeregsize(list,reg,OS_8);
  1099. ai:=Taicpu.op_reg(A_SETcc,S_B,hreg);
  1100. ai.setcondition(flags_to_cond(f));
  1101. list.concat(ai);
  1102. if (reg<>hreg) then
  1103. a_load_reg_reg(list,OS_8,size,hreg,reg);
  1104. end;
  1105. procedure tcgx86.g_flags2ref(list: taasmoutput; size: TCgSize; const f: tresflags; const ref: TReference);
  1106. var
  1107. ai : taicpu;
  1108. begin
  1109. if not(size in [OS_8,OS_S8]) then
  1110. a_load_const_ref(list,size,0,ref);
  1111. ai:=Taicpu.op_ref(A_SETcc,S_B,ref);
  1112. ai.setcondition(flags_to_cond(f));
  1113. list.concat(ai);
  1114. end;
  1115. { ************* concatcopy ************ }
  1116. procedure Tcgx86.g_concatcopy(list:Taasmoutput;const source,dest:Treference;len:aint);
  1117. const
  1118. {$ifdef cpu64bit}
  1119. REGCX=NR_RCX;
  1120. REGSI=NR_RSI;
  1121. REGDI=NR_RDI;
  1122. {$else cpu64bit}
  1123. REGCX=NR_ECX;
  1124. REGSI=NR_ESI;
  1125. REGDI=NR_EDI;
  1126. {$endif cpu64bit}
  1127. type copymode=(copy_move,copy_mmx,copy_string);
  1128. var srcref,dstref:Treference;
  1129. r,r0,r1,r2,r3:Tregister;
  1130. helpsize:aint;
  1131. copysize:byte;
  1132. cgsize:Tcgsize;
  1133. cm:copymode;
  1134. begin
  1135. cm:=copy_move;
  1136. helpsize:=12;
  1137. if cs_littlesize in aktglobalswitches then
  1138. helpsize:=8;
  1139. if (cs_mmx in aktlocalswitches) and
  1140. not(pi_uses_fpu in current_procinfo.flags) and
  1141. ((len=8) or (len=16) or (len=24) or (len=32)) then
  1142. cm:=copy_mmx;
  1143. if (len>helpsize) then
  1144. cm:=copy_string;
  1145. if (cs_littlesize in aktglobalswitches) and
  1146. not((len<=16) and (cm=copy_mmx)) then
  1147. cm:=copy_string;
  1148. case cm of
  1149. copy_move:
  1150. begin
  1151. dstref:=dest;
  1152. srcref:=source;
  1153. copysize:=sizeof(aint);
  1154. cgsize:=int_cgsize(copysize);
  1155. while len<>0 do
  1156. begin
  1157. if len<2 then
  1158. begin
  1159. copysize:=1;
  1160. cgsize:=OS_8;
  1161. end
  1162. else if len<4 then
  1163. begin
  1164. copysize:=2;
  1165. cgsize:=OS_16;
  1166. end
  1167. else if len<8 then
  1168. begin
  1169. copysize:=4;
  1170. cgsize:=OS_32;
  1171. end;
  1172. dec(len,copysize);
  1173. r:=getintregister(list,cgsize);
  1174. a_load_ref_reg(list,cgsize,cgsize,srcref,r);
  1175. a_load_reg_ref(list,cgsize,cgsize,r,dstref);
  1176. inc(srcref.offset,copysize);
  1177. inc(dstref.offset,copysize);
  1178. end;
  1179. end;
  1180. copy_mmx:
  1181. begin
  1182. dstref:=dest;
  1183. srcref:=source;
  1184. r0:=getmmxregister(list);
  1185. a_loadmm_ref_reg(list,OS_M64,OS_M64,srcref,r0,nil);
  1186. if len>=16 then
  1187. begin
  1188. inc(srcref.offset,8);
  1189. r1:=getmmxregister(list);
  1190. a_loadmm_ref_reg(list,OS_M64,OS_M64,srcref,r1,nil);
  1191. end;
  1192. if len>=24 then
  1193. begin
  1194. inc(srcref.offset,8);
  1195. r2:=getmmxregister(list);
  1196. a_loadmm_ref_reg(list,OS_M64,OS_M64,srcref,r2,nil);
  1197. end;
  1198. if len>=32 then
  1199. begin
  1200. inc(srcref.offset,8);
  1201. r3:=getmmxregister(list);
  1202. a_loadmm_ref_reg(list,OS_M64,OS_M64,srcref,r3,nil);
  1203. end;
  1204. a_loadmm_reg_ref(list,OS_M64,OS_M64,r0,dstref,nil);
  1205. if len>=16 then
  1206. begin
  1207. inc(dstref.offset,8);
  1208. a_loadmm_reg_ref(list,OS_M64,OS_M64,r1,dstref,nil);
  1209. end;
  1210. if len>=24 then
  1211. begin
  1212. inc(dstref.offset,8);
  1213. a_loadmm_reg_ref(list,OS_M64,OS_M64,r2,dstref,nil);
  1214. end;
  1215. if len>=32 then
  1216. begin
  1217. inc(dstref.offset,8);
  1218. a_loadmm_reg_ref(list,OS_M64,OS_M64,r3,dstref,nil);
  1219. end;
  1220. end
  1221. else {copy_string, should be a good fallback in case of unhandled}
  1222. begin
  1223. getcpuregister(list,REGDI);
  1224. a_loadaddr_ref_reg(list,dest,REGDI);
  1225. getcpuregister(list,REGSI);
  1226. a_loadaddr_ref_reg(list,source,REGSI);
  1227. getcpuregister(list,REGCX);
  1228. list.concat(Taicpu.op_none(A_CLD,S_NO));
  1229. if cs_littlesize in aktglobalswitches then
  1230. begin
  1231. a_load_const_reg(list,OS_INT,len,REGCX);
  1232. list.concat(Taicpu.op_none(A_REP,S_NO));
  1233. list.concat(Taicpu.op_none(A_MOVSB,S_NO));
  1234. end
  1235. else
  1236. begin
  1237. helpsize:=len div sizeof(aint);
  1238. len:=len mod sizeof(aint);
  1239. if helpsize>1 then
  1240. begin
  1241. a_load_const_reg(list,OS_INT,helpsize,REGCX);
  1242. list.concat(Taicpu.op_none(A_REP,S_NO));
  1243. end;
  1244. if helpsize>0 then
  1245. begin
  1246. {$ifdef cpu64bit}
  1247. if sizeof(aint)=8 then
  1248. list.concat(Taicpu.op_none(A_MOVSQ,S_NO))
  1249. else
  1250. {$endif cpu64bit}
  1251. list.concat(Taicpu.op_none(A_MOVSD,S_NO));
  1252. end;
  1253. if len>=4 then
  1254. begin
  1255. dec(len,4);
  1256. list.concat(Taicpu.op_none(A_MOVSD,S_NO));
  1257. end;
  1258. if len>=2 then
  1259. begin
  1260. dec(len,2);
  1261. list.concat(Taicpu.op_none(A_MOVSW,S_NO));
  1262. end;
  1263. if len=1 then
  1264. list.concat(Taicpu.op_none(A_MOVSB,S_NO));
  1265. end;
  1266. ungetcpuregister(list,REGCX);
  1267. ungetcpuregister(list,REGSI);
  1268. ungetcpuregister(list,REGDI);
  1269. end;
  1270. end;
  1271. end;
  1272. {****************************************************************************
  1273. Entry/Exit Code Helpers
  1274. ****************************************************************************}
  1275. procedure tcgx86.g_releasevaluepara_openarray(list : taasmoutput;const ref:treference);
  1276. begin
  1277. { Nothing to release }
  1278. end;
  1279. procedure tcgx86.g_profilecode(list : taasmoutput);
  1280. var
  1281. pl : tasmlabel;
  1282. mcountprefix : String[4];
  1283. begin
  1284. case target_info.system of
  1285. {$ifndef NOTARGETWIN32}
  1286. system_i386_win32,
  1287. {$endif}
  1288. system_i386_freebsd,
  1289. system_i386_netbsd,
  1290. // system_i386_openbsd,
  1291. system_i386_wdosx :
  1292. begin
  1293. Case target_info.system Of
  1294. system_i386_freebsd : mcountprefix:='.';
  1295. system_i386_netbsd : mcountprefix:='__';
  1296. // system_i386_openbsd : mcountprefix:='.';
  1297. else
  1298. mcountPrefix:='';
  1299. end;
  1300. objectlibrary.getaddrlabel(pl);
  1301. new_section(list,sec_data,lower(current_procinfo.procdef.mangledname),sizeof(aint));
  1302. list.concat(Tai_label.Create(pl));
  1303. list.concat(Tai_const.Create_32bit(0));
  1304. new_section(list,sec_code,lower(current_procinfo.procdef.mangledname),0);
  1305. list.concat(Taicpu.Op_reg(A_PUSH,S_L,NR_EDX));
  1306. list.concat(Taicpu.Op_sym_ofs_reg(A_MOV,S_L,pl,0,NR_EDX));
  1307. a_call_name(list,target_info.Cprefix+mcountprefix+'mcount');
  1308. list.concat(Taicpu.Op_reg(A_POP,S_L,NR_EDX));
  1309. end;
  1310. system_i386_linux:
  1311. a_call_name(list,target_info.Cprefix+'mcount');
  1312. system_i386_go32v2,system_i386_watcom:
  1313. begin
  1314. a_call_name(list,'MCOUNT');
  1315. end;
  1316. end;
  1317. end;
  1318. procedure tcgx86.g_stackpointer_alloc(list : taasmoutput;localsize : longint);
  1319. {$ifdef i386}
  1320. {$ifndef NOTARGETWIN32}
  1321. var
  1322. href : treference;
  1323. i : integer;
  1324. again : tasmlabel;
  1325. {$endif NOTARGETWIN32}
  1326. {$endif i386}
  1327. begin
  1328. if localsize>0 then
  1329. begin
  1330. {$ifdef i386}
  1331. {$ifndef NOTARGETWIN32}
  1332. { windows guards only a few pages for stack growing, }
  1333. { so we have to access every page first }
  1334. if (target_info.system=system_i386_win32) and
  1335. (localsize>=winstackpagesize) then
  1336. begin
  1337. if localsize div winstackpagesize<=5 then
  1338. begin
  1339. list.concat(Taicpu.Op_const_reg(A_SUB,S_L,localsize-4,NR_ESP));
  1340. for i:=1 to localsize div winstackpagesize do
  1341. begin
  1342. reference_reset_base(href,NR_ESP,localsize-i*winstackpagesize);
  1343. list.concat(Taicpu.op_const_ref(A_MOV,S_L,0,href));
  1344. end;
  1345. list.concat(Taicpu.op_reg(A_PUSH,S_L,NR_EAX));
  1346. end
  1347. else
  1348. begin
  1349. objectlibrary.getlabel(again);
  1350. getcpuregister(list,NR_EDI);
  1351. list.concat(Taicpu.op_const_reg(A_MOV,S_L,localsize div winstackpagesize,NR_EDI));
  1352. a_label(list,again);
  1353. list.concat(Taicpu.op_const_reg(A_SUB,S_L,winstackpagesize-4,NR_ESP));
  1354. list.concat(Taicpu.op_reg(A_PUSH,S_L,NR_EAX));
  1355. list.concat(Taicpu.op_reg(A_DEC,S_L,NR_EDI));
  1356. a_jmp_cond(list,OC_NE,again);
  1357. ungetcpuregister(list,NR_EDI);
  1358. list.concat(Taicpu.op_const_reg(A_SUB,S_L,localsize mod winstackpagesize,NR_ESP));
  1359. end
  1360. end
  1361. else
  1362. {$endif NOTARGETWIN32}
  1363. {$endif i386}
  1364. list.concat(Taicpu.Op_const_reg(A_SUB,tcgsize2opsize[OS_ADDR],localsize,NR_STACK_POINTER_REG));
  1365. end;
  1366. end;
  1367. procedure tcgx86.g_proc_entry(list : taasmoutput;localsize : longint;nostackframe:boolean);
  1368. begin
  1369. {$ifdef i386}
  1370. { interrupt support for i386 }
  1371. if (po_interrupt in current_procinfo.procdef.procoptions) then
  1372. begin
  1373. { .... also the segment registers }
  1374. list.concat(Taicpu.Op_reg(A_PUSH,S_W,NR_GS));
  1375. list.concat(Taicpu.Op_reg(A_PUSH,S_W,NR_FS));
  1376. list.concat(Taicpu.Op_reg(A_PUSH,S_W,NR_ES));
  1377. list.concat(Taicpu.Op_reg(A_PUSH,S_W,NR_DS));
  1378. { save the registers of an interrupt procedure }
  1379. list.concat(Taicpu.Op_reg(A_PUSH,S_L,NR_EDI));
  1380. list.concat(Taicpu.Op_reg(A_PUSH,S_L,NR_ESI));
  1381. list.concat(Taicpu.Op_reg(A_PUSH,S_L,NR_EDX));
  1382. list.concat(Taicpu.Op_reg(A_PUSH,S_L,NR_ECX));
  1383. list.concat(Taicpu.Op_reg(A_PUSH,S_L,NR_EBX));
  1384. list.concat(Taicpu.Op_reg(A_PUSH,S_L,NR_EAX));
  1385. end;
  1386. {$endif i386}
  1387. { save old framepointer }
  1388. if not nostackframe then
  1389. begin
  1390. if (current_procinfo.framepointer=NR_STACK_POINTER_REG) then
  1391. CGmessage(cg_d_stackframe_omited)
  1392. else
  1393. begin
  1394. list.concat(tai_regalloc.alloc(NR_FRAME_POINTER_REG,nil));
  1395. include(rg[R_INTREGISTER].preserved_by_proc,RS_FRAME_POINTER_REG);
  1396. list.concat(Taicpu.op_reg(A_PUSH,tcgsize2opsize[OS_ADDR],NR_FRAME_POINTER_REG));
  1397. { Return address and FP are both on stack }
  1398. dwarfcfi.cfa_def_cfa_offset(list,2*sizeof(aint));
  1399. dwarfcfi.cfa_offset(list,NR_FRAME_POINTER_REG,-(2*sizeof(aint)));
  1400. list.concat(Taicpu.op_reg_reg(A_MOV,tcgsize2opsize[OS_ADDR],NR_STACK_POINTER_REG,NR_FRAME_POINTER_REG));
  1401. dwarfcfi.cfa_def_cfa_register(list,NR_FRAME_POINTER_REG);
  1402. end;
  1403. { allocate stackframe space }
  1404. if localsize<>0 then
  1405. begin
  1406. cg.g_stackpointer_alloc(list,localsize);
  1407. end;
  1408. end;
  1409. { allocate PIC register }
  1410. if cs_create_pic in aktmoduleswitches then
  1411. begin
  1412. a_call_name(list,'FPC_GETEIPINEBX');
  1413. list.concat(taicpu.op_sym_ofs_reg(A_ADD,tcgsize2opsize[OS_ADDR],objectlibrary.newasmsymbol('_GLOBAL_OFFSET_TABLE_',AB_EXTERNAL,AT_DATA),0,NR_PIC_OFFSET_REG));
  1414. list.concat(tai_regalloc.alloc(NR_PIC_OFFSET_REG,nil));
  1415. end;
  1416. end;
  1417. { produces if necessary overflowcode }
  1418. procedure tcgx86.g_overflowcheck(list: taasmoutput; const l:tlocation;def:tdef);
  1419. var
  1420. hl : tasmlabel;
  1421. ai : taicpu;
  1422. cond : TAsmCond;
  1423. begin
  1424. if not(cs_check_overflow in aktlocalswitches) then
  1425. exit;
  1426. objectlibrary.getlabel(hl);
  1427. if not ((def.deftype=pointerdef) or
  1428. ((def.deftype=orddef) and
  1429. (torddef(def).typ in [u64bit,u16bit,u32bit,u8bit,uchar,
  1430. bool8bit,bool16bit,bool32bit]))) then
  1431. cond:=C_NO
  1432. else
  1433. cond:=C_NB;
  1434. ai:=Taicpu.Op_Sym(A_Jcc,S_NO,hl);
  1435. ai.SetCondition(cond);
  1436. ai.is_jmp:=true;
  1437. list.concat(ai);
  1438. a_call_name(list,'FPC_OVERFLOW');
  1439. a_label(list,hl);
  1440. end;
  1441. end.
  1442. {
  1443. $Log$
  1444. Revision 1.132 2004-10-25 15:36:47 peter
  1445. * save standard registers moved to tcgobj
  1446. Revision 1.131 2004/10/24 20:10:08 peter
  1447. * -Or fixes
  1448. Revision 1.130 2004/10/24 11:44:28 peter
  1449. * small regvar fixes
  1450. * loadref parameter removed from concatcopy,incrrefcount,etc
  1451. Revision 1.129 2004/10/06 19:27:35 jonas
  1452. * regvar fixes from Peter
  1453. Revision 1.128 2004/10/05 20:41:02 peter
  1454. * more spilling rewrites
  1455. Revision 1.127 2004/10/04 20:46:22 peter
  1456. * spilling code rewritten for x86. It now used the generic
  1457. spilling routines. Special x86 optimization still needs
  1458. to be added.
  1459. * Spilling fixed when both operands needed to be spilled
  1460. * Cleanup of spilling routine, do_spill_readwritten removed
  1461. Revision 1.126 2004/10/03 12:42:22 florian
  1462. * made sqrt, sqr and abs internal for the sparc
  1463. Revision 1.125 2004/09/25 14:23:55 peter
  1464. * ungetregister is now only used for cpuregisters, renamed to
  1465. ungetcpuregister
  1466. * renamed (get|unget)explicitregister(s) to ..cpuregister
  1467. * removed location-release/reference_release
  1468. Revision 1.124 2004/06/20 08:55:32 florian
  1469. * logs truncated
  1470. Revision 1.123 2004/06/16 20:07:11 florian
  1471. * dwarf branch merged
  1472. Revision 1.122 2004/05/22 23:34:28 peter
  1473. tai_regalloc.allocation changed to ratype to notify rgobj of register size changes
  1474. Revision 1.121 2004/04/28 15:19:03 florian
  1475. + syscall directive support for MorphOS added
  1476. Revision 1.120 2004/04/09 14:36:05 peter
  1477. * A_MOVSL renamed to A_MOVSD
  1478. Revision 1.119.2.22 2004/05/28 20:29:50 florian
  1479. * fixed currency trouble on x86-64
  1480. }