cgcpu.pas 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 by Florian Klaempfl
  4. This unit implements the code generator for the PowerPC
  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 cgcpu;
  19. {$i defines.inc}
  20. interface
  21. uses
  22. cgbase,cgobj,aasm,cpuasm,cpubase,cpuinfo,cg64f32;
  23. type
  24. tcgppc = class(tcg64f32)
  25. { passing parameters, per default the parameter is pushed }
  26. { nr gives the number of the parameter (enumerated from }
  27. { left to right), this allows to move the parameter to }
  28. { register, if the cpu supports register calling }
  29. { conventions }
  30. procedure a_param_reg(list : taasmoutput;size : tcgsize;r : tregister;nr : longint);override;
  31. procedure a_param_const(list : taasmoutput;size : tcgsize;a : aword;nr : longint);override;
  32. procedure a_param_ref(list : taasmoutput;size : tcgsize;const r : treference;nr : longint);override;
  33. procedure a_paramaddr_ref(list : taasmoutput;const r : treference;nr : longint);override;
  34. procedure a_call_name(list : taasmoutput;const s : string;
  35. offset : longint);override;
  36. procedure a_op_const_reg(list : taasmoutput; Op: TOpCG; a: AWord; reg: TRegister); override;
  37. procedure a_op_reg_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; src, dst: TRegister); override;
  38. { move instructions }
  39. procedure a_load_const_reg(list : taasmoutput; size: tcgsize; a : aword;reg : tregister);override;
  40. procedure a_load_reg_ref(list : taasmoutput; size: tcgsize; reg : tregister;const ref : treference);override;
  41. procedure a_load_ref_reg(list : taasmoutput;size : tcgsize;const Ref : treference;reg : tregister);override;
  42. procedure a_load_reg_reg(list : taasmoutput;size : tcgsize;reg1,reg2 : tregister);override;
  43. procedure a_load_sym_ofs_reg(list: taasmoutput; const sym: tasmsymbol; ofs: longint; reg: tregister); override;
  44. { comparison operations }
  45. procedure a_cmp_const_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;a : aword;reg : tregister;
  46. l : tasmlabel);override;
  47. procedure a_cmp_reg_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;reg1,reg2 : tregister;l : tasmlabel); override;
  48. procedure a_jmp_cond(list : taasmoutput;cond : TOpCmp;l: tasmlabel); override;
  49. procedure g_flags2reg(list: taasmoutput; const f: TResFlags; reg: TRegister); override;
  50. procedure g_stackframe_entry_sysv(list : taasmoutput;localsize : longint);
  51. procedure g_stackframe_entry_mac(list : taasmoutput;localsize : longint);
  52. procedure g_stackframe_entry(list : taasmoutput;localsize : longint);override;
  53. procedure g_restore_frame_pointer(list : taasmoutput);override;
  54. procedure g_return_from_proc(list : taasmoutput;parasize : aword); override;
  55. procedure a_loadaddress_ref_reg(list : taasmoutput;const ref2 : treference;r : tregister);override;
  56. procedure g_concatcopy(list : taasmoutput;const source,dest : treference;len : aword; delsource,loadref : boolean);override;
  57. { find out whether a is of the form 11..00..11b or 00..11...00. If }
  58. { that's the case, we can use rlwinm to do an AND operation }
  59. function get_rlwi_const(a: longint; var l1, l2: longint): boolean;
  60. procedure a_op_const_reg_reg(list: taasmoutput; op: TOpCg;
  61. a: aword; src, dst: tregister);
  62. procedure a_op_reg_reg_reg(list: taasmoutput; op: TOpCg; src1, src2,
  63. dst: tregister);
  64. private
  65. procedure g_return_from_proc_sysv(list : taasmoutput;parasize : aword);
  66. procedure g_return_from_proc_mac(list : taasmoutput;parasize : aword);
  67. { Make sure ref is a valid reference for the PowerPC and sets the }
  68. { base to the value of the index if (base = R_NO). }
  69. procedure fixref(list: taasmoutput; var ref: treference);
  70. { contains the common code of a_load_reg_ref and a_load_ref_reg }
  71. procedure a_load_store(list:taasmoutput;op: tasmop;reg:tregister;
  72. ref: treference);
  73. { creates the correct branch instruction for a given combination }
  74. { of asmcondflags and destination addressing mode }
  75. procedure a_jmp(list: taasmoutput; op: tasmop;
  76. c: tasmcondflag; l: tasmlabel);
  77. end;
  78. const
  79. {
  80. TOpCG2AsmOp: Array[topcg] of TAsmOp = (A_ADD,A_AND,A_DIVWU,
  81. A_DIVW,A_MULLW, A_MULLW, A_NEG,A_NOT,A_OR,
  82. A_SRAW,A_SLW,A_SRW,A_SUB,A_XOR);
  83. }
  84. TOpCG2AsmOpConstLo: Array[topcg] of TAsmOp = (A_ADDI,A_ANDI_,A_DIVWU,
  85. A_DIVW,A_MULLW, A_MULLW, A_NONE,A_NONE,A_ORI,
  86. A_SRAWI,A_SLWI,A_SRWI,A_SUBI,A_XORI);
  87. TOpCG2AsmOpConstHi: Array[topcg] of TAsmOp = (A_ADDIS,A_ANDIS_,
  88. A_DIVWU,A_DIVW, A_MULLW,A_MULLW,A_NONE,A_NONE,
  89. A_ORIS,A_NONE, A_NONE,A_NONE,A_SUBIS,A_XORIS);
  90. TOpCmp2AsmCond: Array[topcmp] of TAsmCondFlag = (C_NONE,C_EQ,C_GT,
  91. C_LT,C_GE,C_LE,C_NE,C_LE,C_NG,C_GE,C_NL);
  92. LoadInstr: Array[OS_8..OS_S32,boolean, boolean] of TAsmOp =
  93. { indexed? updating?}
  94. (((A_LBZ,A_LBZU),(A_LBZX,A_LBZUX)),
  95. ((A_LHZ,A_LHZU),(A_LHZX,A_LHZUX)),
  96. ((A_LWZ,A_LWZU),(A_LWZX,A_LWZUX)),
  97. { 64bit stuff should be handled separately }
  98. ((A_NONE,A_NONE),(A_NONE,A_NONE)),
  99. { there's no load-byte-with-sign-extend :( }
  100. ((A_LBZ,A_LBZU),(A_LBZX,A_LBZUX)),
  101. ((A_LHA,A_LHAU),(A_LHAX,A_LHAUX)),
  102. ((A_LWZ,A_LWZU),(A_LWZX,A_LWZUX)));
  103. StoreInstr: Array[OS_8..OS_32,boolean, boolean] of TAsmOp =
  104. { indexed? updating?}
  105. (((A_STB,A_STBU),(A_STBX,A_STBUX)),
  106. ((A_STH,A_STHU),(A_STHX,A_STHUX)),
  107. ((A_STW,A_STWU),(A_STWX,A_STWUX)));
  108. implementation
  109. uses
  110. globtype,globals,verbose,systems,cutils, tgcpu;
  111. { parameter passing... Still needs extra support from the processor }
  112. { independent code generator }
  113. procedure tcgppc.a_param_reg(list : taasmoutput;size : tcgsize;r : tregister;nr : longint);
  114. var
  115. ref: treference;
  116. begin
  117. {$ifdef para_sizes_known}
  118. if (nr <= max_param_regs_int) then
  119. a_load_reg_reg(list,size,r,param_regs_int[nr])
  120. else
  121. begin
  122. reset_reference(ref);
  123. ref.base := stack_pointer;
  124. ref.offset := LinkageAreaSize+para_size_till_now;
  125. a_load_reg_ref(list,size,reg,ref);
  126. end;
  127. {$endif para_sizes_known}
  128. end;
  129. procedure tcgppc.a_param_const(list : taasmoutput;size : tcgsize;a : aword;nr : longint);
  130. var
  131. ref: treference;
  132. begin
  133. {$ifdef para_sizes_known}
  134. if (nr <= max_param_regs_int) then
  135. a_load_const_reg(list,size,a,param_regs_int[nr])
  136. else
  137. begin
  138. reset_reference(ref);
  139. ref.base := stack_pointer;
  140. ref.offset := LinkageAreaSize+para_size_till_now;
  141. a_load_const_ref(list,size,a,ref);
  142. end;
  143. {$endif para_sizes_known}
  144. end;
  145. procedure tcgppc.a_param_ref(list : taasmoutput;size : tcgsize;const r : treference;nr : longint);
  146. var
  147. ref: treference;
  148. tmpreg: tregister;
  149. begin
  150. {$ifdef para_sizes_known}
  151. if (nr <= max_param_regs_int) then
  152. a_load_ref_reg(list,size,r,param_regs_int[nr])
  153. else
  154. begin
  155. reset_reference(ref);
  156. ref.base := stack_pointer;
  157. ref.offset := LinkageAreaSize+para_size_till_now;
  158. tmpreg := get_scratch_reg(list);
  159. a_load_ref_reg(list,size,r,tmpreg);
  160. a_load_reg_ref(list,size,tmpreg,ref);
  161. free_scratch_reg(list,tmpreg);
  162. end;
  163. {$endif para_sizes_known}
  164. end;
  165. procedure tcgppc.a_paramaddr_ref(list : taasmoutput;const r : treference;nr : longint);
  166. var
  167. ref: treference;
  168. tmpreg: tregister;
  169. begin
  170. {$ifdef para_sizes_known}
  171. if (nr <= max_param_regs_int) then
  172. a_loadaddress_ref_reg(list,size,r,param_regs_int[nr])
  173. else
  174. begin
  175. reset_reference(ref);
  176. ref.base := stack_pointer;
  177. ref.offset := LinkageAreaSize+para_size_till_now;
  178. tmpreg := get_scratch_reg(list);
  179. a_loadaddress_ref_reg(list,size,r,tmpreg);
  180. a_load_reg_ref(list,size,tmpreg,ref);
  181. free_scratch_reg(list,tmpreg);
  182. end;
  183. {$endif para_sizes_known}
  184. end;
  185. { calling a code fragment by name }
  186. procedure tcgppc.a_call_name(list : taasmoutput;const s : string;
  187. offset : longint);
  188. begin
  189. { save our RTOC register value. Only necessary when doing pointer based }
  190. { calls or cross TOC calls, but currently done always }
  191. list.concat(taicpu.op_reg_ref(A_STW,R_RTOC,
  192. new_reference(stack_pointer,LA_RTOC)));
  193. list.concat(taicpu.op_sym(A_BL,newasmsymbol(s)));
  194. list.concat(taicpu.op_reg_ref(A_LWZ,R_RTOC,
  195. new_reference(stack_pointer,LA_RTOC)));
  196. end;
  197. {********************** load instructions ********************}
  198. procedure tcgppc.a_load_const_reg(list : taasmoutput; size: TCGSize; a : aword; reg : TRegister);
  199. begin
  200. if (a and $ffff) <> 0 Then
  201. begin
  202. list.concat(taicpu.op_reg_const(A_LI,reg,a and $ffff));
  203. if (longint(a) < low(smallint)) or
  204. (longint(a) > high(smallint)) then
  205. list.concat(taicpu.op_reg_const(A_ADDIS,reg,
  206. (a shr 16)+ord(smallint(a and $ffff) < 0)))
  207. end
  208. else
  209. list.concat(taicpu.op_reg_const(A_LIS,reg,a shr 16));
  210. end;
  211. procedure tcgppc.a_load_reg_ref(list : taasmoutput; size: TCGSize; reg : tregister;const ref : treference);
  212. var
  213. op: TAsmOp;
  214. ref2: TReference;
  215. begin
  216. ref2 := ref;
  217. FixRef(list,ref2);
  218. if size in [OS_S8..OS_S16] then
  219. { storing is the same for signed and unsigned values }
  220. size := tcgsize(ord(size)-(ord(OS_S8)-ord(OS_8)));
  221. { 64 bit stuff should be handled separately }
  222. if size in [OS_64,OS_S64] then
  223. internalerror(200109236);
  224. op := storeinstr[size,ref2.index<>R_NO,false];
  225. a_load_store(list,op,reg,ref2);
  226. End;
  227. procedure tcgppc.a_load_ref_reg(list : taasmoutput;size : tcgsize;const ref: treference;reg : tregister);
  228. var
  229. op: tasmop;
  230. tmpreg: tregister;
  231. ref2, tmpref: treference;
  232. begin
  233. if ref.is_immediate then
  234. a_load_const_reg(list,size,ref.offset,reg)
  235. else
  236. begin
  237. ref2 := ref;
  238. fixref(list,ref2);
  239. op := loadinstr[size,ref2.index<>R_NO,false];
  240. a_load_store(list,op,reg,ref2);
  241. { sign extend shortint if necessary, since there is no }
  242. { load instruction that does that automatically (JM) }
  243. if size = OS_S8 then
  244. list.concat(taicpu.op_reg_reg(A_EXTSB,reg,reg));
  245. end;
  246. end;
  247. procedure tcgppc.a_load_reg_reg(list : taasmoutput;size : tcgsize;reg1,reg2 : tregister);
  248. begin
  249. list.concat(taicpu.op_reg_reg(A_MR,reg2,reg1));
  250. end;
  251. procedure tcgppc.a_load_sym_ofs_reg(list: taasmoutput; const sym: tasmsymbol; ofs: longint; reg: tregister);
  252. begin
  253. { can't use op_sym_ofs_reg because sym+ofs can be > 32767!! }
  254. internalerror(200112293);
  255. end;
  256. procedure tcgppc.a_op_const_reg(list : taasmoutput; Op: TOpCG; a: AWord; reg: TRegister);
  257. var
  258. scratch_register: TRegister;
  259. begin
  260. Case Op of
  261. OP_DIV, OP_IDIV, OP_IMUL, OP_MUL:
  262. If (Op = OP_IMUL) And (longint(a) >= -32768) And
  263. (longint(a) <= 32767) Then
  264. list.concat(taicpu.op_reg_reg_const(A_MULLI,reg,reg,a))
  265. Else
  266. Begin
  267. scratch_register := get_scratch_reg(list);
  268. a_load_const_reg(list,OS_32,a,scratch_register);
  269. list.concat(taicpu.op_reg_reg_reg(TOpCG2AsmOpConstLo[Op],
  270. reg,scratch_register,reg));
  271. free_scratch_reg(list,scratch_register);
  272. End;
  273. OP_ADD, OP_AND, OP_OR, OP_SUB,OP_XOR:
  274. a_op_const_reg_reg(list,op,a,reg,reg);
  275. OP_SHL,OP_SHR,OP_SAR:
  276. Begin
  277. if (a and 31) <> 0 Then
  278. list.concat(taicpu.op_reg_reg_const(
  279. TOpCG2AsmOpConstLo[Op],reg,reg,a and 31));
  280. If (a shr 5) <> 0 Then
  281. InternalError(68991);
  282. End
  283. Else InternalError(68992);
  284. end;
  285. end;
  286. procedure tcgppc.a_op_reg_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; src, dst: TRegister);
  287. begin
  288. a_op_reg_reg_reg(list,op,src,dst,dst);
  289. end;
  290. {*************** compare instructructions ****************}
  291. procedure tcgppc.a_cmp_const_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;a : aword;reg : tregister;
  292. l : tasmlabel);
  293. var
  294. p: taicpu;
  295. scratch_register: TRegister;
  296. signed: boolean;
  297. begin
  298. signed := cmp_op in [OC_GT,OC_LT,OC_GTE,OC_LTE];
  299. if signed then
  300. if (longint(a) >= low(smallint)) and (longint(a) <= high(smallint)) Then
  301. list.concat(taicpu.op_reg_reg_const(A_CMPI,R_CR0,reg,a))
  302. else
  303. begin
  304. scratch_register := get_scratch_reg(list);
  305. a_load_const_reg(list,OS_32,a,scratch_register);
  306. list.concat(taicpu.op_reg_reg_reg(A_CMP,R_CR0,reg,scratch_register));
  307. free_scratch_reg(list,scratch_register);
  308. end
  309. else
  310. if (a <= $ffff) then
  311. list.concat(taicpu.op_reg_reg_const(A_CMPLI,R_CR0,reg,a))
  312. else
  313. begin
  314. scratch_register := get_scratch_reg(list);
  315. a_load_const_reg(list,OS_32,a,scratch_register);
  316. list.concat(taicpu.op_reg_reg_reg(A_CMPL,R_CR0,reg,scratch_register));
  317. free_scratch_reg(list,scratch_register);
  318. end;
  319. a_jmp(list,A_BC,TOpCmp2AsmCond[cmp_op],l);
  320. end;
  321. procedure tcgppc.a_cmp_reg_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;
  322. reg1,reg2 : tregister;l : tasmlabel);
  323. var
  324. p: taicpu;
  325. op: tasmop;
  326. begin
  327. if cmp_op in [OC_GT,OC_LT,OC_GTE,OC_LTE] then
  328. op := A_CMP
  329. else op := A_CMPL;
  330. list.concat(taicpu.op_reg_reg_reg(op,R_CR0,reg1,reg2));
  331. a_jmp(list,A_BC,TOpCmp2AsmCond[cmp_op],l);
  332. end;
  333. procedure tcgppc.a_jmp_cond(list : taasmoutput;cond : TOpCmp;l: tasmlabel);
  334. begin
  335. a_jmp(list,A_BC,TOpCmp2AsmCond[cond],l);
  336. end;
  337. procedure tcgppc.g_flags2reg(list: taasmoutput; const f: TResFlags; reg: TRegister);
  338. var
  339. testbit: byte;
  340. bitvalue: boolean;
  341. begin
  342. { get the bit to extract from the conditional register + its }
  343. { requested value (0 or 1) }
  344. testbit := (f.cr * 4);
  345. case f.flag of
  346. F_EQ,F_NE:
  347. bitvalue := f.flag = F_EQ;
  348. F_LT,F_GE:
  349. begin
  350. inc(testbit);
  351. bitvalue := f.flag = F_LT;
  352. end;
  353. F_GT,F_LE:
  354. begin
  355. inc(testbit,2);
  356. bitvalue := f.flag = F_GT;
  357. end;
  358. else
  359. internalerror(200112261);
  360. end;
  361. { load the conditional register in the destination reg }
  362. list.concat(taicpu.op_reg(A_MFCR,reg));
  363. { we will move the bit that has to be tested to bit 31 -> rotate }
  364. { left by bitpos+1 (remember, this is big-endian!) }
  365. testbit := (testbit + 1) and 31;
  366. { extract bit }
  367. list.concat(taicpu.op_reg_reg_const_const_const(
  368. A_RLWINM,reg,reg,testbit,31,31));
  369. { if we need the inverse, xor with 1 }
  370. if not bitvalue then
  371. list.concat(taicpu.op_reg_reg_const(A_XORI,reg,reg,1));
  372. end;
  373. (*
  374. procedure tcgppc.g_flags2reg(list: taasmoutput; const f: TAsmCond; reg: TRegister);
  375. var
  376. testbit: byte;
  377. bitvalue: boolean;
  378. begin
  379. { get the bit to extract from the conditional register + its }
  380. { requested value (0 or 1) }
  381. case f.simple of
  382. false:
  383. begin
  384. { we don't generate this in the compiler }
  385. internalerror(200109062);
  386. end;
  387. true:
  388. case f.cond of
  389. C_None:
  390. internalerror(200109063);
  391. C_LT..C_NU:
  392. begin
  393. testbit := (ord(f.cr) - ord(R_CR0))*4;
  394. inc(testbit,AsmCondFlag2BI[f.cond]);
  395. bitvalue := AsmCondFlagTF[f.cond];
  396. end;
  397. C_T,C_F,C_DNZT,C_DNZF,C_DZT,C_DZF:
  398. begin
  399. testbit := f.crbit
  400. bitvalue := AsmCondFlagTF[f.cond];
  401. end;
  402. else
  403. internalerror(200109064);
  404. end;
  405. end;
  406. { load the conditional register in the destination reg }
  407. list.concat(taicpu.op_reg_reg(A_MFCR,reg));
  408. { we will move the bit that has to be tested to bit 31 -> rotate }
  409. { left by bitpos+1 (remember, this is big-endian!) }
  410. if bitpos <> 31 then
  411. inc(bitpos)
  412. else
  413. bitpos := 0;
  414. { extract bit }
  415. list.concat(taicpu.op_reg_reg_const_const_const(
  416. A_RLWINM,reg,reg,bitpos,31,31));
  417. { if we need the inverse, xor with 1 }
  418. if not bitvalue then
  419. list.concat(taicpu.op_reg_reg_const(A_XORI,reg,reg,1));
  420. end;
  421. *)
  422. { *********** entry/exit code and address loading ************ }
  423. procedure tcgppc.g_stackframe_entry(list : taasmoutput;localsize : longint);
  424. begin
  425. case target_info.target of
  426. target_powerpc_macos:
  427. g_stackframe_entry_mac(list,localsize);
  428. target_powerpc_linux:
  429. g_stackframe_entry_sysv(list,localsize)
  430. else
  431. internalerror(2204001);
  432. end;
  433. end;
  434. procedure tcgppc.g_stackframe_entry_sysv(list : taasmoutput;localsize : longint);
  435. { generated the entry code of a procedure/function. Note: localsize is the }
  436. { sum of the size necessary for local variables and the maximum possible }
  437. { combined size of ALL the parameters of a procedure called by the current }
  438. { one }
  439. var regcounter: TRegister;
  440. begin
  441. if (localsize mod 8) <> 0 then internalerror(58991);
  442. { CR and LR only have to be saved in case they are modified by the current }
  443. { procedure, but currently this isn't checked, so save them always }
  444. { following is the entry code as described in "Altivec Programming }
  445. { Interface Manual", bar the saving of AltiVec registers }
  446. a_reg_alloc(list,stack_pointer);
  447. a_reg_alloc(list,R_0);
  448. { allocate registers containing reg parameters }
  449. for regcounter := R_3 to R_10 do
  450. a_reg_alloc(list,regcounter);
  451. { save return address... }
  452. list.concat(taicpu.op_reg_reg(A_MFSPR,R_0,R_LR));
  453. { ... in caller's frame }
  454. list.concat(taicpu.op_reg_ref(A_STW,R_0,new_reference(STACK_POINTER,4)));
  455. a_reg_dealloc(list,R_0);
  456. a_reg_alloc(list,R_11);
  457. { save end of fpr save area }
  458. list.concat(taicpu.op_reg_reg_const(A_ORI,R_11,STACK_POINTER,0));
  459. a_reg_alloc(list,R_12);
  460. { 0 or 8 based on SP alignment }
  461. list.concat(taicpu.op_reg_reg_const_const_const(A_RLWINM,
  462. R_12,STACK_POINTER,0,28,28));
  463. { add in stack length }
  464. list.concat(taicpu.op_reg_reg_const(A_SUBFIC,R_12,R_12,
  465. -localsize));
  466. { establish new alignment }
  467. list.concat(taicpu.op_reg_reg_reg(A_STWUX,STACK_POINTER,STACK_POINTER,R_12));
  468. a_reg_dealloc(list,R_12);
  469. { save floating-point registers }
  470. { !!! has to be optimized: only save registers that are used }
  471. list.concat(taicpu.op_sym_ofs(A_BL,newasmsymbol('_savefpr_14'),0));
  472. { compute end of gpr save area }
  473. list.concat(taicpu.op_reg_reg_const(A_ADDI,R_11,R_11,-144));
  474. { save gprs and fetch GOT pointer }
  475. { !!! has to be optimized: only save registers that are used }
  476. list.concat(taicpu.op_sym_ofs(A_BL,newasmsymbol('_savegpr_14_go'),0));
  477. a_reg_alloc(list,R_31);
  478. { place GOT ptr in r31 }
  479. list.concat(taicpu.op_reg_reg(A_MFSPR,R_31,R_LR));
  480. { save the CR if necessary ( !!! always done currently ) }
  481. { still need to find out where this has to be done for SystemV
  482. a_reg_alloc(list,R_0);
  483. list.concat(taicpu.op_reg_reg(A_MFSPR,R_0,R_CR);
  484. list.concat(taicpu.op_reg_ref(A_STW,scratch_register,
  485. new_reference(stack_pointer,LA_CR)));
  486. a_reg_dealloc(list,R_0); }
  487. { save pointer to incoming arguments }
  488. list.concat(taicpu.op_reg_reg_const(A_ADDI,R_30,R_11,144));
  489. { now comes the AltiVec context save, not yet implemented !!! }
  490. end;
  491. procedure tcgppc.g_stackframe_entry_mac(list : taasmoutput;localsize : longint);
  492. { generated the entry code of a procedure/function. Note: localsize is the }
  493. { sum of the size necessary for local variables and the maximum possible }
  494. { combined size of ALL the parameters of a procedure called by the current }
  495. { one }
  496. var regcounter: TRegister;
  497. begin
  498. if (localsize mod 8) <> 0 then internalerror(58991);
  499. { CR and LR only have to be saved in case they are modified by the current }
  500. { procedure, but currently this isn't checked, so save them always }
  501. { following is the entry code as described in "Altivec Programming }
  502. { Interface Manual", bar the saving of AltiVec registers }
  503. a_reg_alloc(list,STACK_POINTER);
  504. a_reg_alloc(list,R_0);
  505. { allocate registers containing reg parameters }
  506. for regcounter := R_3 to R_10 do
  507. a_reg_alloc(list,regcounter);
  508. { save return address... }
  509. list.concat(taicpu.op_reg_reg(A_MFSPR,R_0,R_LR));
  510. { ... in caller's frame }
  511. list.concat(taicpu.op_reg_ref(A_STW,R_0,new_reference(STACK_POINTER,8)));
  512. a_reg_dealloc(list,R_0);
  513. { save floating-point registers }
  514. { !!! has to be optimized: only save registers that are used }
  515. list.concat(taicpu.op_sym_ofs(A_BL,newasmsymbol('_savef14'),0));
  516. { save gprs in gpr save area }
  517. { !!! has to be optimized: only save registers that are used }
  518. list.concat(taicpu.op_reg_ref(A_STMW,R_13,new_reference(STACK_POINTER,-220)));
  519. { save the CR if necessary ( !!! always done currently ) }
  520. a_reg_alloc(list,R_0);
  521. list.concat(taicpu.op_reg_reg(A_MFSPR,R_0,R_CR));
  522. list.concat(taicpu.op_reg_ref(A_STW,R_0,
  523. new_reference(stack_pointer,LA_CR)));
  524. a_reg_dealloc(list,R_0);
  525. { save pointer to incoming arguments }
  526. list.concat(taicpu.op_reg_reg_const(A_ORI,R_31,STACK_POINTER,0));
  527. a_reg_alloc(list,R_12);
  528. { 0 or 8 based on SP alignment }
  529. list.concat(taicpu.op_reg_reg_const_const_const(A_RLWINM,
  530. R_12,STACK_POINTER,0,28,28));
  531. { add in stack length }
  532. list.concat(taicpu.op_reg_reg_const(A_SUBFIC,R_12,R_12,
  533. -localsize));
  534. { establish new alignment }
  535. list.concat(taicpu.op_reg_reg_reg(A_STWUX,STACK_POINTER,STACK_POINTER,R_12));
  536. a_reg_dealloc(list,R_12);
  537. { now comes the AltiVec context save, not yet implemented !!! }
  538. end;
  539. procedure tcgppc.g_restore_frame_pointer(list : taasmoutput);
  540. begin
  541. { no frame pointer on the PowerPC (maybe there is one in the SystemV ABI?)}
  542. end;
  543. procedure tcgppc.g_return_from_proc(list : taasmoutput;parasize : aword);
  544. begin
  545. case target_info.target of
  546. target_powerpc_macos:
  547. g_return_from_proc_mac(list,parasize);
  548. target_powerpc_linux:
  549. g_return_from_proc_sysv(list,parasize)
  550. else
  551. internalerror(2204001);
  552. end;
  553. end;
  554. procedure tcgppc.a_loadaddress_ref_reg(list : taasmoutput;const ref2 : treference;r : tregister);
  555. var tmpreg: tregister;
  556. ref, tmpref: treference;
  557. begin
  558. ref := ref2;
  559. FixRef(list,ref);
  560. if assigned(ref.symbol) then
  561. { add the symbol's value to the base of the reference, and if the }
  562. { reference doesn't have a base, create one }
  563. begin
  564. tmpreg := get_scratch_reg(list);
  565. reset_reference(tmpref);
  566. tmpref.symbol := ref.symbol;
  567. tmpref.symaddr := refs_ha;
  568. tmpref.is_immediate := true;
  569. if ref.base <> R_NO then
  570. list.concat(taicpu.op_reg_reg_ref(A_ADDIS,tmpreg,
  571. ref.base,newreference(tmpref)))
  572. else
  573. list.concat(taicpu.op_reg_ref(A_LIS,tmpreg,
  574. newreference(tmpref)));
  575. ref.base := tmpreg;
  576. ref.symaddr := refs_l;
  577. { can be folded with one of the next instructions by the }
  578. { optimizer probably }
  579. list.concat(taicpu.op_reg_reg_ref(A_ADDI,tmpreg,tmpreg,
  580. newreference(tmpref)));
  581. end;
  582. if ref.offset <> 0 Then
  583. if ref.base <> R_NO then
  584. a_op_const_reg_reg(list,OP_ADD,ref.offset,ref.base,r)
  585. { FixRef makes sure that "(ref.index <> R_NO) and (ref.offset <> 0)" never}
  586. { occurs, so now only ref.offset has to be loaded }
  587. else a_load_const_reg(list, OS_32, ref.offset, r)
  588. else
  589. if ref.index <> R_NO Then
  590. list.concat(taicpu.op_reg_reg_reg(A_ADD,r,ref.base,ref.index))
  591. else
  592. if r <> ref.base then
  593. list.concat(taicpu.op_reg_reg(A_MR,r,ref.base));
  594. if assigned(ref.symbol) then
  595. free_scratch_reg(list,tmpreg);
  596. end;
  597. { ************* concatcopy ************ }
  598. procedure tcgppc.g_concatcopy(list : taasmoutput;const source,dest : treference;len : aword; delsource,loadref : boolean);
  599. var
  600. t: taicpu;
  601. countreg, tempreg: TRegister;
  602. src, dst: TReference;
  603. lab: tasmlabel;
  604. count, count2: aword;
  605. begin
  606. { make sure source and dest are valid }
  607. src := source;
  608. fixref(list,src);
  609. dst := dest;
  610. fixref(list,dst);
  611. reset_reference(src);
  612. reset_reference(dst);
  613. { load the address of source into src.base }
  614. src.base := get_scratch_reg(list);
  615. if loadref then
  616. a_load_ref_reg(list,OS_32,source,src.base)
  617. else a_loadaddress_ref_reg(list,source,src.base);
  618. if delsource then
  619. del_reference(source);
  620. { load the address of dest into dst.base }
  621. dst.base := get_scratch_reg(list);
  622. a_loadaddress_ref_reg(list,dest,dst.base);
  623. count := len div 4;
  624. if count > 3 then
  625. { generate a loop }
  626. begin
  627. { the offsets are zero after the a_loadaddress_ref_reg and just }
  628. { have to be set to 4. I put an Inc there so debugging may be }
  629. { easier (should offset be different from zero here, it will be }
  630. { easy to notice in the genreated assembler }
  631. Inc(dst.offset,4);
  632. Inc(src.offset,4);
  633. list.concat(taicpu.op_reg_reg_const(A_SUBI,src.base,src.base,4));
  634. list.concat(taicpu.op_reg_reg_const(A_SUBI,dst.base,dst.base,4));
  635. countreg := get_scratch_reg(list);
  636. a_load_const_reg(list,OS_32,count-1,countreg);
  637. { explicitely allocate R_0 since it can be used safely here }
  638. { (for holding date that's being copied) }
  639. tempreg := R_0;
  640. a_reg_alloc(list,R_0);
  641. getlabel(lab);
  642. a_label(list, lab);
  643. list.concat(taicpu.op_reg_ref(A_LWZU,tempreg,
  644. newreference(src)));
  645. list.concat(taicpu.op_reg_reg_const(A_CMPI,R_CR0,countreg,0));
  646. list.concat(taicpu.op_reg_ref(A_STWU,tempreg,newreference(dst)));
  647. list.concat(taicpu.op_reg_reg_const(A_SUBI,countreg,countreg,1));
  648. a_jmp(list,A_BC,C_NE,lab);
  649. free_scratch_reg(list,countreg);
  650. end
  651. else
  652. { unrolled loop }
  653. begin
  654. tempreg := get_scratch_reg(list);
  655. for count2 := 1 to count do
  656. begin
  657. a_load_ref_reg(list,OS_32,src,tempreg);
  658. a_load_reg_ref(list,OS_32,tempreg,dst);
  659. inc(src.offset,4);
  660. inc(dst.offset,4);
  661. end
  662. end;
  663. { copy the leftovers }
  664. if (len and 2) <> 0 then
  665. begin
  666. a_load_ref_reg(list,OS_16,src,tempreg);
  667. a_load_reg_ref(list,OS_16,tempreg,dst);
  668. inc(src.offset,2);
  669. inc(dst.offset,2);
  670. end;
  671. if (len and 1) <> 0 then
  672. begin
  673. a_load_ref_reg(list,OS_8,src,tempreg);
  674. a_load_reg_ref(list,OS_8,tempreg,dst);
  675. end;
  676. a_reg_dealloc(list,tempreg);
  677. free_scratch_reg(list,src.base);
  678. free_scratch_reg(list,dst.base);
  679. end;
  680. {***************** This is private property, keep out! :) *****************}
  681. procedure tcgppc.g_return_from_proc_sysv(list : taasmoutput;parasize : aword);
  682. var
  683. regcounter: TRegister;
  684. begin
  685. { release parameter registers }
  686. for regcounter := R_3 to R_10 do
  687. a_reg_dealloc(list,regcounter);
  688. { AltiVec context restore, not yet implemented !!! }
  689. { address of gpr save area to r11 }
  690. list.concat(taicpu.op_reg_reg_const(A_ADDI,R_11,R_31,-144));
  691. { restore gprs }
  692. list.concat(taicpu.op_sym_ofs(A_BL,newasmsymbol('_restgpr_14'),0));
  693. { address of fpr save area to r11 }
  694. list.concat(taicpu.op_reg_reg_const(A_ADDI,R_11,R_11,144));
  695. { restore fprs and return }
  696. list.concat(taicpu.op_sym_ofs(A_BL,newasmsymbol('_restfpr_14_x'),0));
  697. end;
  698. procedure tcgppc.g_return_from_proc_mac(list : taasmoutput;parasize : aword);
  699. var
  700. regcounter: TRegister;
  701. begin
  702. { release parameter registers }
  703. for regcounter := R_3 to R_10 do
  704. a_reg_dealloc(list,regcounter);
  705. { AltiVec context restore, not yet implemented !!! }
  706. { restore SP }
  707. list.concat(taicpu.op_reg_reg_const(A_ORI,STACK_POINTER,R_31,0));
  708. { restore gprs }
  709. list.concat(taicpu.op_reg_ref(A_LMW,R_13,new_reference(STACK_POINTER,-220)));
  710. { restore return address ... }
  711. list.concat(taicpu.op_reg_ref(A_LWZ,R_0,new_reference(STACK_POINTER,8)));
  712. { ... and return from _restf14 }
  713. list.concat(taicpu.op_sym_ofs(A_B,newasmsymbol('_restf14'),0));
  714. end;
  715. procedure tcgppc.fixref(list: taasmoutput; var ref: treference);
  716. begin
  717. If (ref.base <> R_NO) then
  718. begin
  719. if (ref.index <> R_NO) and
  720. ((ref.offset <> 0) or assigned(ref.symbol)) then
  721. begin
  722. if not assigned(ref.symbol) and
  723. (cardinal(ref.offset-low(smallint)) <=
  724. high(smallint)-low(smallint)) then
  725. begin
  726. list.concat(taicpu.op_reg_reg_const(
  727. A_ADDI,ref.base,ref.base,ref.offset));
  728. ref.offset := 0;
  729. end
  730. else
  731. begin
  732. list.concat(taicpu.op_reg_reg_reg(
  733. A_ADD,ref.base,ref.base,ref.index));
  734. ref.index := R_NO;
  735. end;
  736. end
  737. end
  738. else
  739. begin
  740. ref.base := ref.index;
  741. ref.index := R_NO
  742. end
  743. end;
  744. { find out whether a is of the form 11..00..11b or 00..11...00. If }
  745. { that's the case, we can use rlwinm to do an AND operation }
  746. function tcgppc.get_rlwi_const(a: longint; var l1, l2: longint): boolean;
  747. var
  748. temp, testbit: longint;
  749. compare: boolean;
  750. begin
  751. get_rlwi_const := false;
  752. { start with the lowest bit }
  753. testbit := 1;
  754. { check its value }
  755. compare := boolean(a and testbit);
  756. { find out how long the run of bits with this value is }
  757. { (it's impossible that all bits are 1 or 0, because in that case }
  758. { this function wouldn't have been called) }
  759. l1 := 31;
  760. while (((a and testbit) <> 0) = compare) do
  761. begin
  762. testbit := testbit shl 1;
  763. dec(l1);
  764. end;
  765. { check the length of the run of bits that comes next }
  766. compare := not compare;
  767. l2 := l1;
  768. while (((a and testbit) <> 0) = compare) and
  769. (l2 >= 0) do
  770. begin
  771. testbit := testbit shl 1;
  772. dec(l2);
  773. end;
  774. { and finally the check whether the rest of the bits all have the }
  775. { same value }
  776. compare := not compare;
  777. temp := l2;
  778. if temp >= 0 then
  779. if (a shr (31-temp)) <> ((-ord(compare)) shr (31-temp)) then
  780. exit;
  781. { we have done "not(not(compare))", so compare is back to its }
  782. { initial value. If the lowest bit was 0, a is of the form }
  783. { 00..11..00 and we need "rlwinm reg,reg,0,l2+1,l1", (+1 }
  784. { because l2 now contains the position of the last zero of the }
  785. { first run instead of that of the first 1) so switch l1 and l2 }
  786. { in that case (we will generate "rlwinm reg,reg,0,l1,l2") }
  787. if not compare then
  788. begin
  789. temp := l1;
  790. l1 := l2+1;
  791. l2 := temp;
  792. end
  793. else
  794. { otherwise, l1 currently contains the position of the last }
  795. { zero instead of that of the first 1 of the second run -> +1 }
  796. inc(l1);
  797. { the following is the same as "if l1 = -1 then l1 := 31;" }
  798. l1 := l1 and 31;
  799. l2 := l2 and 31;
  800. get_rlwi_const := true;
  801. end;
  802. procedure tcgppc.a_op_const_reg_reg(list: taasmoutput; op: TOpCg;
  803. a: aword; src, dst: tregister);
  804. var
  805. l1,l2: longint;
  806. var
  807. oplo, ophi: tasmop;
  808. scratchreg: tregister;
  809. useReg: boolean;
  810. begin
  811. ophi := TOpCG2AsmOpConstHi[op];
  812. oplo := TOpCG2AsmOpConstLo[op];
  813. { constants in a PPC instruction are always interpreted as signed }
  814. { 16bit values, so if the value is between low(smallint) and }
  815. { high(smallint), it's easy }
  816. if (longint(a) >= low(smallint)) and
  817. (longint(a) <= high(smallint)) then
  818. begin
  819. list.concat(taicpu.op_reg_reg_const(oplo,dst,src,a));
  820. exit;
  821. end;
  822. { all basic constant instructions also have a shifted form that }
  823. { works only on the highest 16bits, so if low(a) is 0, we can }
  824. { use that one }
  825. if (lo(a) = 0) then
  826. begin
  827. list.concat(taicpu.op_reg_reg_const(ophi,dst,src,hi(a)));
  828. exit;
  829. end;
  830. { otherwise, the instructions we can generate depend on the }
  831. { operation }
  832. useReg := false;
  833. case op of
  834. OP_ADD,OP_SUB:
  835. begin
  836. list.concat(taicpu.op_reg_reg_const(oplo,dst,src,low(a)));
  837. list.concat(taicpu.op_reg_reg_const(ophi,dst,dst,
  838. high(a) + ord(smallint(a) < 0)));
  839. end;
  840. OP_OR:
  841. { try to use rlwimi }
  842. if get_rlwi_const(a,l1,l2) then
  843. begin
  844. if src <> dst then
  845. list.concat(taicpu.op_reg_reg(A_MR,dst,src));
  846. scratchreg := get_scratch_reg(list);
  847. list.concat(taicpu.op_reg_const(A_LI,scratchreg,-1));
  848. list.concat(taicpu.op_reg_reg_const_const_const(A_RLWIMI,dst,
  849. scratchreg,0,l1,l2));
  850. free_scratch_reg(list,scratchreg);
  851. end
  852. else
  853. useReg := true;
  854. OP_AND:
  855. { try to use rlwinm }
  856. if get_rlwi_const(a,l1,l2) then
  857. list.concat(taicpu.op_reg_reg_const_const_const(A_RLWINM,dst,
  858. src,0,l1,l2))
  859. else
  860. useReg := true;
  861. OP_XOR:
  862. useReg := true;
  863. else
  864. internalerror(200109091);
  865. end;
  866. { if all else failed, load the constant in a register and then }
  867. { perform the operation }
  868. if useReg then
  869. begin
  870. scratchreg := get_scratch_reg(list);
  871. a_load_const_reg(list,OS_32,a,scratchreg);
  872. a_op_reg_reg_reg(list,op,scratchreg,src,dst);
  873. free_scratch_reg(list,scratchreg);
  874. end;
  875. end;
  876. procedure tcgppc.a_op_reg_reg_reg(list: taasmoutput; op: TOpCg;
  877. src1, src2, dst: tregister);
  878. const
  879. op_reg_reg_opcg2asmop: array[TOpCG] of tasmop =
  880. (A_ADD,A_AND,A_DIVWU,A_DIVW,A_MULLW,A_MULLW,A_NEG,A_NOT,A_OR,
  881. A_SRAW,A_SLW,A_SRW,A_SUB,A_XOR);
  882. begin
  883. case op of
  884. OP_NEG,OP_NOT:
  885. list.concat(taicpu.op_reg_reg(op_reg_reg_opcg2asmop[op],dst,dst));
  886. else
  887. list.concat(taicpu.op_reg_reg_reg(op_reg_reg_opcg2asmop[op],dst,src2,src1));
  888. end;
  889. end;
  890. procedure tcgppc.a_load_store(list:taasmoutput;op: tasmop;reg:tregister;
  891. ref: treference);
  892. var
  893. tmpreg: tregister;
  894. tmpref: treference;
  895. begin
  896. if assigned(ref.symbol) then
  897. begin
  898. tmpreg := get_scratch_reg(list);
  899. reset_reference(tmpref);
  900. tmpref.symbol := ref.symbol;
  901. tmpref.symaddr := refs_ha;
  902. tmpref.is_immediate := true;
  903. if ref.base <> R_NO then
  904. list.concat(taicpu.op_reg_reg_ref(A_ADDIS,tmpreg,
  905. ref.base,newreference(tmpref)))
  906. else
  907. list.concat(taicpu.op_reg_ref(A_LIS,tmpreg,
  908. newreference(tmpref)));
  909. ref.base := tmpreg;
  910. ref.symaddr := refs_l;
  911. end;
  912. list.concat(taicpu.op_reg_ref(op,reg,newreference(ref)));
  913. if assigned(ref.symbol) then
  914. free_scratch_reg(list,tmpreg);
  915. end;
  916. procedure tcgppc.a_jmp(list: taasmoutput; op: tasmop; c: tasmcondflag;
  917. l: tasmlabel);
  918. var
  919. p: taicpu;
  920. begin
  921. p := taicpu.op_sym(op,newasmsymbol(l.name));
  922. create_cond_norm(c,0,p.condition);
  923. list.concat(p)
  924. end;
  925. begin
  926. cg := tcgppc.create;
  927. end.
  928. {
  929. $Log$
  930. Revision 1.9 2001-12-29 15:28:58 jonas
  931. * powerpc/cgcpu.pas compiles :)
  932. * several powerpc-related fixes
  933. * cpuasm unit is now based on common tainst unit
  934. + nppcmat unit for powerpc (almost complete)
  935. Revision 1.8 2001/10/28 14:16:49 jonas
  936. * small fixes
  937. Revision 1.7 2001/09/29 21:33:30 jonas
  938. * small optimization
  939. Revision 1.6 2001/09/28 20:40:05 jonas
  940. * several additions, almost complete (only some problems with resflags left)
  941. Revision 1.5 2001/09/16 10:33:21 jonas
  942. * some fixes to operations with constants
  943. Revision 1.3 2001/09/06 15:25:55 jonas
  944. * changed type of tcg from object to class -> abstract methods are now
  945. a lot cleaner :)
  946. + more updates: load_*_loc methods, op_*_* methods, g_flags2reg method
  947. (if possible with generic implementation and necessary ppc
  948. implementations)
  949. * worked a bit further on cgflw, now working on exitnode
  950. Revision 1.2 2001/09/05 20:21:03 jonas
  951. * new cgflow based on n386flw with all nodes until forn "translated"
  952. + a_cmp_loc_*_label methods for tcg
  953. + base implementatino for a_cmp_ref_*_label methods
  954. * small bugfixes to powerpc cg
  955. Revision 1.1 2001/08/26 13:31:04 florian
  956. * some cg reorganisation
  957. * some PPC updates
  958. Revision 1.2 2001/08/26 13:29:33 florian
  959. * some cg reorganisation
  960. * some PPC updates
  961. Revision 1.1 2000/07/13 06:30:12 michael
  962. + Initial import
  963. Revision 1.12 2000/04/22 14:25:04 jonas
  964. * aasm.pas: pai_align instead of pai_align_abstract if cpu <> i386
  965. + systems.pas: info for macos/ppc
  966. * new/cgobj.pas: compiles again without newst define
  967. * new/powerpc/cgcpu: generate different entry/exit code depending on
  968. whether target_os is MacOs or Linux
  969. Revision 1.11 2000/01/07 01:14:57 peter
  970. * updated copyright to 2000
  971. Revision 1.10 1999/12/24 22:48:10 jonas
  972. * compiles again
  973. Revision 1.9 1999/11/05 07:05:56 jonas
  974. + a_jmp_cond()
  975. Revision 1.8 1999/10/24 09:22:18 jonas
  976. + entry/exitcode for SystemV (Linux) and AIX/Mac from the Altivec
  977. PIM (no AltiVec support yet though)
  978. * small fix to the a_cmp_* methods
  979. Revision 1.7 1999/10/20 12:23:24 jonas
  980. * fixed a_loadaddress_ref_reg (mentioned as ToDo in rev. 1.5)
  981. * small bugfix in a_load_store
  982. Revision 1.6 1999/09/15 20:35:47 florian
  983. * small fix to operator overloading when in MMX mode
  984. + the compiler uses now fldz and fld1 if possible
  985. + some fixes to floating point registers
  986. + some math. functions (arctan, ln, sin, cos, sqrt, sqr, pi) are now inlined
  987. * .... ???
  988. Revision 1.5 1999/09/03 13:14:11 jonas
  989. + implemented some parameter passing methods, but they require
  990. some more helper routines
  991. * fix for loading symbol addresses (still needs to be done in a_loadaddress)
  992. * several changes to the way conditional branches are handled
  993. Revision 1.4 1999/08/26 14:53:41 jonas
  994. * first implementation of concatcopy (requires 4 scratch regs)
  995. Revision 1.3 1999/08/25 12:00:23 jonas
  996. * changed pai386, paippc and paiapha (same for tai*) to paicpu (taicpu)
  997. Revision 1.2 1999/08/18 17:05:57 florian
  998. + implemented initilizing of data for the new code generator
  999. so it should compile now simple programs
  1000. Revision 1.1 1999/08/06 16:41:11 jonas
  1001. * PowerPC compiles again, several routines implemented in cgcpu.pas
  1002. * added constant to cpubase of alpha and powerpc for maximum
  1003. number of operands
  1004. }