rgcpu.pas 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. {
  2. Copyright (c) 1998-2003 by Florian Klaempfl
  3. This unit implements the arm specific class for the register
  4. allocator
  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 rgcpu;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. aasmbase,aasmtai,aasmdata,aasmcpu,
  23. cgbase,cgutils,
  24. cpubase,
  25. {$ifdef DEBUG_SPILLING}
  26. cutils,
  27. {$endif}
  28. rgobj;
  29. type
  30. trgcpu = class(trgobj)
  31. private
  32. procedure spilling_create_load_store(list: TAsmList; pos: tai; const spilltemp:treference;tempreg:tregister; is_store: boolean);
  33. public
  34. procedure do_spill_read(list:TAsmList;pos:tai;const spilltemp:treference;tempreg:tregister);override;
  35. procedure do_spill_written(list:TAsmList;pos:tai;const spilltemp:treference;tempreg:tregister);override;
  36. procedure add_constraints(reg:tregister);override;
  37. function get_spill_subreg(r:tregister) : tsubregister;override;
  38. end;
  39. trgcputhumb2 = class(trgobj)
  40. private
  41. procedure SplitITBlock(list:TAsmList;pos:tai);
  42. public
  43. procedure do_spill_read(list:TAsmList;pos:tai;const spilltemp:treference;tempreg:tregister);override;
  44. procedure do_spill_written(list:TAsmList;pos:tai;const spilltemp:treference;tempreg:tregister);override;
  45. end;
  46. trgintcputhumb2 = class(trgcputhumb2)
  47. procedure add_cpu_interferences(p : tai);override;
  48. end;
  49. trgintcpu = class(trgcpu)
  50. procedure add_cpu_interferences(p : tai);override;
  51. end;
  52. trgcputhumb = class(trgcpu)
  53. end;
  54. trgintcputhumb = class(trgcputhumb)
  55. procedure add_cpu_interferences(p: tai);override;
  56. end;
  57. implementation
  58. uses
  59. verbose,globtype,globals,cpuinfo,
  60. cgobj,
  61. procinfo;
  62. procedure trgintcputhumb2.add_cpu_interferences(p: tai);
  63. var
  64. r : tregister;
  65. hr : longint;
  66. begin
  67. if p.typ=ait_instruction then
  68. begin
  69. case taicpu(p).opcode of
  70. A_CBNZ,
  71. A_CBZ:
  72. begin
  73. for hr := RS_R8 to RS_R15 do
  74. add_edge(getsupreg(taicpu(p).oper[0]^.reg), hr);
  75. end;
  76. A_ADD:
  77. begin
  78. if taicpu(p).ops = 3 then
  79. begin
  80. if (taicpu(p).oper[0]^.typ = top_reg) and
  81. (taicpu(p).oper[1]^.typ = top_reg) and
  82. (taicpu(p).oper[2]^.typ in [top_reg, top_shifterop]) then
  83. begin
  84. { if d == 13 || (d == 15 && S == ‘0’) || n == 15 || m IN [13,15] then UNPREDICTABLE; }
  85. add_edge(getsupreg(taicpu(p).oper[0]^.reg), RS_R13);
  86. if taicpu(p).oppostfix <> PF_S then
  87. add_edge(getsupreg(taicpu(p).oper[0]^.reg), RS_R15);
  88. add_edge(getsupreg(taicpu(p).oper[1]^.reg), RS_R15);
  89. if (taicpu(p).oper[2]^.typ = top_shifterop) and
  90. (taicpu(p).oper[2]^.shifterop^.rs <> NR_NO) then
  91. begin
  92. add_edge(getsupreg(taicpu(p).oper[2]^.shifterop^.rs), RS_R13);
  93. add_edge(getsupreg(taicpu(p).oper[2]^.shifterop^.rs), RS_R15);
  94. end
  95. else if (taicpu(p).oper[2]^.typ = top_reg) then
  96. begin
  97. add_edge(getsupreg(taicpu(p).oper[2]^.reg), RS_R13);
  98. add_edge(getsupreg(taicpu(p).oper[2]^.reg), RS_R15);
  99. end;
  100. end;
  101. end;
  102. end;
  103. A_LDRB,
  104. A_STRB,
  105. A_STR,
  106. A_LDR,
  107. A_LDRH,
  108. A_STRH,
  109. A_LDRSB,
  110. A_LDRSH,
  111. A_LDRD,
  112. A_STRD:
  113. { don't mix up the framepointer and stackpointer with pre/post indexed operations }
  114. if (taicpu(p).oper[1]^.typ=top_ref) and
  115. (taicpu(p).oper[1]^.ref^.addressmode in [AM_PREINDEXED,AM_POSTINDEXED]) then
  116. begin
  117. add_edge(getsupreg(taicpu(p).oper[1]^.ref^.base),getsupreg(current_procinfo.framepointer));
  118. { FIXME: temp variable r is needed here to avoid Internal error 20060521 }
  119. { while compiling the compiler. }
  120. r:=NR_STACK_POINTER_REG;
  121. if current_procinfo.framepointer<>r then
  122. add_edge(getsupreg(taicpu(p).oper[1]^.ref^.base),getsupreg(r));
  123. end;
  124. end;
  125. end;
  126. end;
  127. procedure trgcpu.spilling_create_load_store(list: TAsmList; pos: tai; const spilltemp:treference;tempreg:tregister; is_store: boolean);
  128. var
  129. tmpref : treference;
  130. helplist : TAsmList;
  131. l : tasmlabel;
  132. hreg : tregister;
  133. immshift: byte;
  134. a: aint;
  135. begin
  136. helplist:=TAsmList.create;
  137. { load consts entry }
  138. if getregtype(tempreg)=R_INTREGISTER then
  139. hreg:=getregisterinline(helplist,[R_SUBWHOLE])
  140. else
  141. hreg:=cg.getintregister(helplist,OS_ADDR);
  142. { Lets remove the bits we can fold in later and check if the result can be easily with an add or sub }
  143. a:=abs(spilltemp.offset);
  144. if current_settings.cputype in cpu_thumb then
  145. begin
  146. {$ifdef DEBUG_SPILLING}
  147. helplist.concat(tai_comment.create(strpnew('Spilling: Use a_load_const_reg to fix spill offset')));
  148. {$endif}
  149. cg.a_load_const_reg(helplist,OS_ADDR,spilltemp.offset,hreg);
  150. cg.a_op_reg_reg(helplist,OP_ADD,OS_ADDR,current_procinfo.framepointer,hreg);
  151. reference_reset_base(tmpref,hreg,0,sizeof(aint));
  152. end
  153. else if is_shifter_const(a and not($FFF), immshift) then
  154. if spilltemp.offset > 0 then
  155. begin
  156. {$ifdef DEBUG_SPILLING}
  157. helplist.concat(tai_comment.create(strpnew('Spilling: Use ADD to fix spill offset')));
  158. {$endif}
  159. helplist.concat(taicpu.op_reg_reg_const(A_ADD, hreg, current_procinfo.framepointer,
  160. a and not($FFF)));
  161. reference_reset_base(tmpref, hreg, a and $FFF, sizeof(aint));
  162. end
  163. else
  164. begin
  165. {$ifdef DEBUG_SPILLING}
  166. helplist.concat(tai_comment.create(strpnew('Spilling: Use SUB to fix spill offset')));
  167. {$endif}
  168. helplist.concat(taicpu.op_reg_reg_const(A_SUB, hreg, current_procinfo.framepointer,
  169. a and not($FFF)));
  170. reference_reset_base(tmpref, hreg, -(a and $FFF), sizeof(aint));
  171. end
  172. else
  173. begin
  174. {$ifdef DEBUG_SPILLING}
  175. helplist.concat(tai_comment.create(strpnew('Spilling: Use a_load_const_reg to fix spill offset')));
  176. {$endif}
  177. cg.a_load_const_reg(helplist,OS_ADDR,spilltemp.offset,hreg);
  178. reference_reset_base(tmpref,current_procinfo.framepointer,0,sizeof(aint));
  179. tmpref.index:=hreg;
  180. end;
  181. if spilltemp.index<>NR_NO then
  182. internalerror(200401263);
  183. if is_store then
  184. helplist.concat(spilling_create_store(tempreg,tmpref))
  185. else
  186. helplist.concat(spilling_create_load(tmpref,tempreg));
  187. if getregtype(tempreg)=R_INTREGISTER then
  188. ungetregisterinline(helplist,hreg);
  189. list.insertlistafter(pos,helplist);
  190. helplist.free;
  191. end;
  192. function fix_spilling_offset(offset : ASizeInt) : boolean;
  193. begin
  194. result:=(abs(offset)>4095) or
  195. ((current_settings.cputype in cpu_thumb) and ((offset<0) or (offset>1020)));
  196. end;
  197. procedure trgcpu.do_spill_read(list:TAsmList;pos:tai;const spilltemp:treference;tempreg:tregister);
  198. begin
  199. { don't load spilled register between
  200. mov lr,pc
  201. mov pc,r4
  202. but befure the mov lr,pc
  203. }
  204. if assigned(pos.previous) and
  205. (pos.typ=ait_instruction) and
  206. (taicpu(pos).opcode=A_MOV) and
  207. (taicpu(pos).oper[0]^.typ=top_reg) and
  208. (taicpu(pos).oper[0]^.reg=NR_R14) and
  209. (taicpu(pos).oper[1]^.typ=top_reg) and
  210. (taicpu(pos).oper[1]^.reg=NR_PC) then
  211. pos:=tai(pos.previous);
  212. if fix_spilling_offset(spilltemp.offset) then
  213. spilling_create_load_store(list, pos, spilltemp, tempreg, false)
  214. else
  215. inherited do_spill_read(list,pos,spilltemp,tempreg);
  216. end;
  217. procedure trgcpu.do_spill_written(list:TAsmList;pos:tai;const spilltemp:treference;tempreg:tregister);
  218. begin
  219. if fix_spilling_offset(spilltemp.offset) then
  220. spilling_create_load_store(list, pos, spilltemp, tempreg, true)
  221. else
  222. inherited do_spill_written(list,pos,spilltemp,tempreg);
  223. end;
  224. procedure trgcpu.add_constraints(reg:tregister);
  225. var
  226. supreg,i : Tsuperregister;
  227. begin
  228. case getsubreg(reg) of
  229. { Let 32bit floats conflict with all double precision regs > 15
  230. (since these don't have 32 bit equivalents) }
  231. R_SUBFS:
  232. begin
  233. supreg:=getsupreg(reg);
  234. for i:=RS_D16 to RS_D31 do
  235. add_edge(supreg,i);
  236. end;
  237. end;
  238. end;
  239. function trgcpu.get_spill_subreg(r:tregister) : tsubregister;
  240. begin
  241. if (getregtype(r)<>R_MMREGISTER) then
  242. result:=defaultsub
  243. else
  244. result:=getsubreg(r);
  245. end;
  246. function GetITRemainderOp(originalOp:TAsmOp;remLevels:longint;var newOp: TAsmOp;var NeedsCondSwap:boolean) : TAsmOp;
  247. const
  248. remOps : array[1..3] of array[A_ITE..A_ITTTT] of TAsmOp = (
  249. (A_IT,A_IT, A_IT,A_IT,A_IT,A_IT, A_IT,A_IT,A_IT,A_IT,A_IT,A_IT,A_IT,A_IT),
  250. (A_NONE,A_NONE, A_ITT,A_ITE,A_ITE,A_ITT, A_ITT,A_ITT,A_ITE,A_ITE,A_ITE,A_ITE,A_ITT,A_ITT),
  251. (A_NONE,A_NONE, A_NONE,A_NONE,A_NONE,A_NONE, A_ITTT,A_ITEE,A_ITET,A_ITTE,A_ITTE,A_ITET,A_ITEE,A_ITTT));
  252. newOps : array[1..3] of array[A_ITE..A_ITTTT] of TAsmOp = (
  253. (A_IT,A_IT, A_ITE,A_ITT,A_ITE,A_ITT, A_ITEE,A_ITTE,A_ITET,A_ITTT,A_ITEE,A_ITTE,A_ITET,A_ITTT),
  254. (A_NONE,A_NONE, A_IT,A_IT,A_IT,A_IT, A_ITE,A_ITT,A_ITE,A_ITT,A_ITE,A_ITT,A_ITE,A_ITT),
  255. (A_NONE,A_NONE, A_NONE,A_NONE,A_NONE,A_NONE, A_IT,A_IT,A_IT,A_IT,A_IT,A_IT,A_IT,A_IT));
  256. needsSwap: array[1..3] of array[A_ITE..A_ITTTT] of Boolean = (
  257. (true ,false, true ,true ,false,false, true ,true ,true ,true ,false,false,false,false),
  258. (false,false, true ,false,true ,false, true ,true ,false,false,true ,true ,false,false),
  259. (false,false, false,false,false,false, true ,false,true ,false,true ,false,true ,false));
  260. begin
  261. result:=remOps[remLevels][originalOp];
  262. newOp:=newOps[remLevels][originalOp];
  263. NeedsCondSwap:=needsSwap[remLevels][originalOp];
  264. end;
  265. procedure trgcputhumb2.SplitITBlock(list: TAsmList; pos: tai);
  266. var
  267. hp : tai;
  268. level,itLevel : LongInt;
  269. remOp,newOp : TAsmOp;
  270. needsSwap : boolean;
  271. begin
  272. hp:=pos;
  273. level := 0;
  274. while assigned(hp) do
  275. begin
  276. if IsIT(taicpu(hp).opcode) then
  277. break
  278. else if hp.typ=ait_instruction then
  279. inc(level);
  280. hp:=tai(hp.Previous);
  281. end;
  282. if not assigned(hp) then
  283. internalerror(2012100801); // We are supposed to have found the ITxxx instruction here
  284. if (hp.typ<>ait_instruction) or
  285. (not IsIT(taicpu(hp).opcode)) then
  286. internalerror(2012100802); // Sanity check
  287. itLevel := GetITLevels(taicpu(hp).opcode);
  288. if level=itLevel then
  289. exit; // pos was the last instruction in the IT block anyway
  290. remOp:=GetITRemainderOp(taicpu(hp).opcode,itLevel-level,newOp,needsSwap);
  291. if (remOp=A_NONE) or
  292. (newOp=A_NONE) then
  293. Internalerror(2012100803);
  294. taicpu(hp).opcode:=newOp;
  295. if needsSwap then
  296. list.InsertAfter(taicpu.op_cond(remOp,inverse_cond(taicpu(hp).oper[0]^.cc)), pos)
  297. else
  298. list.InsertAfter(taicpu.op_cond(remOp,taicpu(hp).oper[0]^.cc), pos);
  299. end;
  300. procedure trgcputhumb2.do_spill_read(list:TAsmList;pos:tai;const spilltemp:treference;tempreg:tregister);
  301. var
  302. tmpref : treference;
  303. helplist : TAsmList;
  304. l : tasmlabel;
  305. hreg : tregister;
  306. begin
  307. { don't load spilled register between
  308. mov lr,pc
  309. mov pc,r4
  310. but before the mov lr,pc
  311. }
  312. if assigned(pos.previous) and
  313. (pos.typ=ait_instruction) and
  314. (taicpu(pos).opcode=A_MOV) and
  315. (taicpu(pos).oper[0]^.typ=top_reg) and
  316. (taicpu(pos).oper[0]^.reg=NR_R14) and
  317. (taicpu(pos).oper[1]^.typ=top_reg) and
  318. (taicpu(pos).oper[1]^.reg=NR_PC) then
  319. pos:=tai(pos.previous);
  320. if (pos.typ=ait_instruction) and
  321. (taicpu(pos).condition<>C_None) and
  322. (taicpu(pos).opcode<>A_B) then
  323. SplitITBlock(list, pos)
  324. else if (pos.typ=ait_instruction) and
  325. IsIT(taicpu(pos).opcode) then
  326. begin
  327. if not assigned(pos.Previous) then
  328. list.InsertBefore(tai_comment.Create('Dummy'), pos);
  329. pos:=tai(pos.Previous);
  330. end;
  331. if (spilltemp.offset>4095) or (spilltemp.offset<-255) then
  332. begin
  333. helplist:=TAsmList.create;
  334. reference_reset(tmpref,sizeof(aint));
  335. { create consts entry }
  336. current_asmdata.getjumplabel(l);
  337. cg.a_label(current_procinfo.aktlocaldata,l);
  338. tmpref.symboldata:=current_procinfo.aktlocaldata.last;
  339. current_procinfo.aktlocaldata.concat(tai_const.Create_32bit(spilltemp.offset));
  340. { load consts entry }
  341. if getregtype(tempreg)=R_INTREGISTER then
  342. hreg:=getregisterinline(helplist,[R_SUBWHOLE])
  343. else
  344. hreg:=cg.getintregister(helplist,OS_ADDR);
  345. tmpref.symbol:=l;
  346. tmpref.base:=NR_R15;
  347. helplist.concat(taicpu.op_reg_ref(A_LDR,hreg,tmpref));
  348. reference_reset_base(tmpref,current_procinfo.framepointer,0,sizeof(aint));
  349. tmpref.index:=hreg;
  350. if spilltemp.index<>NR_NO then
  351. internalerror(200401263);
  352. helplist.concat(spilling_create_load(tmpref,tempreg));
  353. if getregtype(tempreg)=R_INTREGISTER then
  354. ungetregisterinline(helplist,hreg);
  355. list.insertlistafter(pos,helplist);
  356. helplist.free;
  357. end
  358. else
  359. inherited do_spill_read(list,pos,spilltemp,tempreg);
  360. end;
  361. procedure trgcputhumb2.do_spill_written(list:TAsmList;pos:tai;const spilltemp:treference;tempreg:tregister);
  362. var
  363. tmpref : treference;
  364. helplist : TAsmList;
  365. l : tasmlabel;
  366. hreg : tregister;
  367. begin
  368. if (pos.typ=ait_instruction) and
  369. (taicpu(pos).condition<>C_None) and
  370. (taicpu(pos).opcode<>A_B) then
  371. SplitITBlock(list, pos)
  372. else if (pos.typ=ait_instruction) and
  373. IsIT(taicpu(pos).opcode) then
  374. begin
  375. if not assigned(pos.Previous) then
  376. list.InsertBefore(tai_comment.Create('Dummy'), pos);
  377. pos:=tai(pos.Previous);
  378. end;
  379. if (spilltemp.offset>4095) or (spilltemp.offset<-255) then
  380. begin
  381. helplist:=TAsmList.create;
  382. reference_reset(tmpref,sizeof(aint));
  383. { create consts entry }
  384. current_asmdata.getjumplabel(l);
  385. cg.a_label(current_procinfo.aktlocaldata,l);
  386. tmpref.symboldata:=current_procinfo.aktlocaldata.last;
  387. current_procinfo.aktlocaldata.concat(tai_const.Create_32bit(spilltemp.offset));
  388. { load consts entry }
  389. if getregtype(tempreg)=R_INTREGISTER then
  390. hreg:=getregisterinline(helplist,[R_SUBWHOLE])
  391. else
  392. hreg:=cg.getintregister(helplist,OS_ADDR);
  393. tmpref.symbol:=l;
  394. tmpref.base:=NR_R15;
  395. helplist.concat(taicpu.op_reg_ref(A_LDR,hreg,tmpref));
  396. if spilltemp.index<>NR_NO then
  397. internalerror(200401263);
  398. reference_reset_base(tmpref,current_procinfo.framepointer,0,sizeof(pint));
  399. tmpref.index:=hreg;
  400. helplist.concat(spilling_create_store(tempreg,tmpref));
  401. if getregtype(tempreg)=R_INTREGISTER then
  402. ungetregisterinline(helplist,hreg);
  403. list.insertlistafter(pos,helplist);
  404. helplist.free;
  405. end
  406. else
  407. inherited do_spill_written(list,pos,spilltemp,tempreg);
  408. end;
  409. procedure trgintcpu.add_cpu_interferences(p : tai);
  410. var
  411. r : tregister;
  412. begin
  413. if p.typ=ait_instruction then
  414. begin
  415. case taicpu(p).opcode of
  416. A_MLA,
  417. A_MUL:
  418. if current_settings.cputype<cpu_armv6 then
  419. add_edge(getsupreg(taicpu(p).oper[0]^.reg),getsupreg(taicpu(p).oper[1]^.reg));
  420. A_UMULL,
  421. A_UMLAL,
  422. A_SMULL,
  423. A_SMLAL:
  424. begin
  425. add_edge(getsupreg(taicpu(p).oper[0]^.reg),getsupreg(taicpu(p).oper[1]^.reg));
  426. add_edge(getsupreg(taicpu(p).oper[1]^.reg),getsupreg(taicpu(p).oper[2]^.reg));
  427. add_edge(getsupreg(taicpu(p).oper[0]^.reg),getsupreg(taicpu(p).oper[2]^.reg));
  428. end;
  429. A_LDRB,
  430. A_STRB,
  431. A_STR,
  432. A_LDR,
  433. A_LDRH,
  434. A_STRH:
  435. { don't mix up the framepointer and stackpointer with pre/post indexed operations }
  436. if (taicpu(p).oper[1]^.typ=top_ref) and
  437. (taicpu(p).oper[1]^.ref^.addressmode in [AM_PREINDEXED,AM_POSTINDEXED]) then
  438. begin
  439. add_edge(getsupreg(taicpu(p).oper[1]^.ref^.base),getsupreg(current_procinfo.framepointer));
  440. { FIXME: temp variable r is needed here to avoid Internal error 20060521 }
  441. { while compiling the compiler. }
  442. r:=NR_STACK_POINTER_REG;
  443. if current_procinfo.framepointer<>r then
  444. add_edge(getsupreg(taicpu(p).oper[1]^.ref^.base),getsupreg(r));
  445. end;
  446. end;
  447. end;
  448. end;
  449. procedure trgintcputhumb.add_cpu_interferences(p: tai);
  450. var
  451. r : tregister;
  452. i,
  453. hr : longint;
  454. begin
  455. if p.typ=ait_instruction then
  456. begin
  457. { prevent that the register allocator merges registers with frame/stack pointer
  458. if an instruction writes to the register }
  459. if (taicpu(p).ops>=1) and (taicpu(p).oper[0]^.typ=top_reg) and
  460. (taicpu(p).spilling_get_operation_type(0) in [operand_write,operand_readwrite]) then
  461. begin
  462. { FIXME: temp variable r is needed here to avoid Internal error 20060521 }
  463. { while compiling the compiler. }
  464. r:=NR_STACK_POINTER_REG;
  465. add_edge(getsupreg(taicpu(p).oper[0]^.reg),getsupreg(r));
  466. add_edge(getsupreg(taicpu(p).oper[0]^.reg),getsupreg(current_procinfo.framepointer));
  467. end;
  468. if (taicpu(p).ops>=2) and (taicpu(p).oper[1]^.typ=top_reg) and
  469. (taicpu(p).spilling_get_operation_type(1) in [operand_write,operand_readwrite]) then
  470. begin
  471. { FIXME: temp variable r is needed here to avoid Internal error 20060521 }
  472. { while compiling the compiler. }
  473. r:=NR_STACK_POINTER_REG;
  474. add_edge(getsupreg(taicpu(p).oper[1]^.reg),getsupreg(r));
  475. add_edge(getsupreg(taicpu(p).oper[1]^.reg),getsupreg(current_procinfo.framepointer));
  476. end;
  477. case taicpu(p).opcode of
  478. A_LDRB,
  479. A_STRB,
  480. A_STR,
  481. A_LDR,
  482. A_LDRH,
  483. A_STRH,
  484. A_LDRSB,
  485. A_LDRSH,
  486. A_LDRD,
  487. A_STRD:
  488. begin
  489. { add_edge handles precoloured registers already }
  490. for i:=RS_R8 to RS_R15 do
  491. begin
  492. add_edge(getsupreg(taicpu(p).oper[1]^.ref^.base),i);
  493. add_edge(getsupreg(taicpu(p).oper[1]^.ref^.index),i);
  494. add_edge(getsupreg(taicpu(p).oper[0]^.reg),i);
  495. end;
  496. end;
  497. end;
  498. end;
  499. end;
  500. end.