cg386add.pas 88 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898
  1. {
  2. $Id$
  3. Copyright (c) 1993-98 by Florian Klaempfl
  4. Generate i386 assembler for in add node
  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 cg386add;
  19. interface
  20. {$define usecreateset}
  21. uses
  22. tree;
  23. procedure secondadd(var p : ptree);
  24. implementation
  25. uses
  26. globtype,systems,
  27. cobjects,verbose,globals,
  28. symtable,aasm,types,
  29. hcodegen,temp_gen,pass_2,
  30. i386,cgai386,tgeni386;
  31. {*****************************************************************************
  32. Helpers
  33. *****************************************************************************}
  34. function getresflags(p : ptree;unsigned : boolean) : tresflags;
  35. begin
  36. if not(unsigned) then
  37. begin
  38. if p^.swaped then
  39. case p^.treetype of
  40. equaln : getresflags:=F_E;
  41. unequaln : getresflags:=F_NE;
  42. ltn : getresflags:=F_G;
  43. lten : getresflags:=F_GE;
  44. gtn : getresflags:=F_L;
  45. gten : getresflags:=F_LE;
  46. end
  47. else
  48. case p^.treetype of
  49. equaln : getresflags:=F_E;
  50. unequaln : getresflags:=F_NE;
  51. ltn : getresflags:=F_L;
  52. lten : getresflags:=F_LE;
  53. gtn : getresflags:=F_G;
  54. gten : getresflags:=F_GE;
  55. end;
  56. end
  57. else
  58. begin
  59. if p^.swaped then
  60. case p^.treetype of
  61. equaln : getresflags:=F_E;
  62. unequaln : getresflags:=F_NE;
  63. ltn : getresflags:=F_A;
  64. lten : getresflags:=F_AE;
  65. gtn : getresflags:=F_B;
  66. gten : getresflags:=F_BE;
  67. end
  68. else
  69. case p^.treetype of
  70. equaln : getresflags:=F_E;
  71. unequaln : getresflags:=F_NE;
  72. ltn : getresflags:=F_B;
  73. lten : getresflags:=F_BE;
  74. gtn : getresflags:=F_A;
  75. gten : getresflags:=F_AE;
  76. end;
  77. end;
  78. end;
  79. procedure SetResultLocation(cmpop,unsigned:boolean;var p :ptree);
  80. begin
  81. { remove temporary location if not a set or string }
  82. { that's a bad hack (FK) who did this ? }
  83. if (p^.left^.resulttype^.deftype<>stringdef) and
  84. ((p^.left^.resulttype^.deftype<>setdef) or (psetdef(p^.left^.resulttype)^.settype=smallset)) and
  85. (p^.left^.location.loc in [LOC_MEM,LOC_REFERENCE]) then
  86. ungetiftemp(p^.left^.location.reference);
  87. if (p^.right^.resulttype^.deftype<>stringdef) and
  88. ((p^.right^.resulttype^.deftype<>setdef) or (psetdef(p^.right^.resulttype)^.settype=smallset)) and
  89. (p^.right^.location.loc in [LOC_MEM,LOC_REFERENCE]) then
  90. ungetiftemp(p^.right^.location.reference);
  91. { in case of comparison operation the put result in the flags }
  92. if cmpop then
  93. begin
  94. clear_location(p^.location);
  95. p^.location.loc:=LOC_FLAGS;
  96. p^.location.resflags:=getresflags(p,unsigned);
  97. end;
  98. end;
  99. {*****************************************************************************
  100. Addstring
  101. *****************************************************************************}
  102. procedure addstring(var p : ptree);
  103. var
  104. pushedregs : tpushed;
  105. href : treference;
  106. pushed,
  107. cmpop : boolean;
  108. savedunused : tregisterset;
  109. hr : treference;
  110. oldrl : plinkedlist;
  111. begin
  112. { string operations are not commutative }
  113. if p^.swaped then
  114. swaptree(p);
  115. case pstringdef(p^.left^.resulttype)^.string_typ of
  116. st_ansistring:
  117. begin
  118. case p^.treetype of
  119. addn:
  120. begin
  121. oldrl:=temptoremove;
  122. temptoremove:=new(plinkedlist,init);
  123. cmpop:=false;
  124. secondpass(p^.left);
  125. pushed:=maybe_push(p^.right^.registers32,p);
  126. secondpass(p^.right);
  127. if pushed then restore(p);
  128. { release used registers }
  129. case p^.right^.location.loc of
  130. LOC_REFERENCE,LOC_MEM:
  131. del_reference(p^.right^.location.reference);
  132. LOC_REGISTER,LOC_CREGISTER:
  133. ungetregister32(p^.right^.location.register);
  134. end;
  135. case p^.left^.location.loc of
  136. LOC_REFERENCE,LOC_MEM:
  137. del_reference(p^.left^.location.reference);
  138. LOC_REGISTER,LOC_CREGISTER:
  139. ungetregister32(p^.left^.location.register);
  140. end;
  141. savedunused:=unused;
  142. { push the still used registers }
  143. pushusedregisters(pushedregs,$ff);
  144. { push data }
  145. emit_push_loc(p^.right^.location);
  146. emit_push_loc(p^.left^.location);
  147. emitcall('FPC_ANSISTR_CONCAT',true);
  148. unused:=savedunused;
  149. clear_location(p^.location);
  150. p^.location.register:=getexplicitregister32(R_EAX);
  151. p^.location.loc:=LOC_REGISTER;
  152. emit_reg_reg(A_MOV,S_L,R_EAX,p^.location.register);
  153. { unused:=unused-[R_EAX]; }
  154. removetemps(exprasmlist,temptoremove);
  155. dispose(temptoremove,done);
  156. temptoremove:=oldrl;
  157. { unused:=unused+[R_EAX]; }
  158. popusedregisters(pushedregs);
  159. maybe_loadesi;
  160. ungetiftemp(p^.left^.location.reference);
  161. ungetiftemp(p^.right^.location.reference);
  162. reset_reference(hr);
  163. gettempansistringreference(hr);
  164. addtemptodestroy(p^.resulttype,hr);
  165. exprasmlist^.concat(new(pai386,op_reg_ref(A_MOV,S_L,p^.location.register,
  166. newreference(hr))));
  167. end;
  168. ltn,lten,gtn,gten,
  169. equaln,unequaln:
  170. begin
  171. oldrl:=temptoremove;
  172. temptoremove:=new(plinkedlist,init);
  173. secondpass(p^.left);
  174. pushed:=maybe_push(p^.right^.registers32,p);
  175. secondpass(p^.right);
  176. if pushed then restore(p);
  177. { release used registers }
  178. case p^.right^.location.loc of
  179. LOC_REFERENCE,LOC_MEM:
  180. del_reference(p^.right^.location.reference);
  181. LOC_REGISTER,LOC_CREGISTER:
  182. ungetregister32(p^.right^.location.register);
  183. end;
  184. case p^.left^.location.loc of
  185. LOC_REFERENCE,LOC_MEM:
  186. del_reference(p^.left^.location.reference);
  187. LOC_REGISTER,LOC_CREGISTER:
  188. ungetregister32(p^.left^.location.register);
  189. end;
  190. { push the still used registers }
  191. pushusedregisters(pushedregs,$ff);
  192. { push data }
  193. case p^.right^.location.loc of
  194. LOC_REFERENCE,LOC_MEM:
  195. emit_push_mem(p^.right^.location.reference);
  196. LOC_REGISTER,LOC_CREGISTER:
  197. exprasmlist^.concat(new(pai386,op_reg(A_PUSH,S_L,p^.right^.location.register)));
  198. end;
  199. case p^.left^.location.loc of
  200. LOC_REFERENCE,LOC_MEM:
  201. emit_push_mem(p^.left^.location.reference);
  202. LOC_REGISTER,LOC_CREGISTER:
  203. exprasmlist^.concat(new(pai386,op_reg(A_PUSH,S_L,p^.left^.location.register)));
  204. end;
  205. emitcall('FPC_ANSISTR_COMPARE',true);
  206. unused:=unused-[R_EAX];
  207. removetemps(exprasmlist,temptoremove);
  208. dispose(temptoremove,done);
  209. temptoremove:=oldrl;
  210. unused:=unused+[R_EAX];
  211. emit_reg_reg(A_OR,S_L,R_EAX,R_EAX);
  212. popusedregisters(pushedregs);
  213. maybe_loadesi;
  214. ungetiftemp(p^.left^.location.reference);
  215. ungetiftemp(p^.right^.location.reference);
  216. end;
  217. end;
  218. { the result of ansicompare is signed }
  219. SetResultLocation(cmpop,false,p);
  220. end;
  221. st_shortstring:
  222. begin
  223. case p^.treetype of
  224. addn:
  225. begin
  226. cmpop:=false;
  227. secondpass(p^.left);
  228. { if str_concat is set in expr
  229. s:=s+ ... no need to create a temp string (PM) }
  230. if (p^.left^.treetype<>addn) and not (p^.use_strconcat) then
  231. begin
  232. { can only reference be }
  233. { string in register would be funny }
  234. { therefore produce a temporary string }
  235. { release the registers }
  236. del_reference(p^.left^.location.reference);
  237. gettempofsizereference(256,href);
  238. copyshortstring(href,p^.left^.location.reference,255,false);
  239. ungetiftemp(p^.left^.location.reference);
  240. { does not hurt: }
  241. clear_location(p^.left^.location);
  242. p^.left^.location.loc:=LOC_MEM;
  243. p^.left^.location.reference:=href;
  244. end;
  245. secondpass(p^.right);
  246. { on the right we do not need the register anymore too }
  247. del_reference(p^.right^.location.reference);
  248. pushusedregisters(pushedregs,$ff);
  249. emitpushreferenceaddr(exprasmlist,p^.left^.location.reference);
  250. emitpushreferenceaddr(exprasmlist,p^.right^.location.reference);
  251. emitcall('FPC_SHORTSTR_CONCAT',true);
  252. maybe_loadesi;
  253. popusedregisters(pushedregs);
  254. set_location(p^.location,p^.left^.location);
  255. ungetiftemp(p^.right^.location.reference);
  256. end;
  257. ltn,lten,gtn,gten,
  258. equaln,unequaln :
  259. begin
  260. cmpop:=true;
  261. { generate better code for s='' and s<>'' }
  262. if (p^.treetype in [equaln,unequaln]) and
  263. (((p^.left^.treetype=stringconstn) and (str_length(p^.left)=0)) or
  264. ((p^.right^.treetype=stringconstn) and (str_length(p^.right)=0))) then
  265. begin
  266. secondpass(p^.left);
  267. { are too few registers free? }
  268. pushed:=maybe_push(p^.right^.registers32,p);
  269. secondpass(p^.right);
  270. if pushed then restore(p);
  271. del_reference(p^.right^.location.reference);
  272. del_reference(p^.left^.location.reference);
  273. { only one node can be stringconstn }
  274. { else pass 1 would have evaluted }
  275. { this node }
  276. if p^.left^.treetype=stringconstn then
  277. exprasmlist^.concat(new(pai386,op_const_ref(
  278. A_CMP,S_B,0,newreference(p^.right^.location.reference))))
  279. else
  280. exprasmlist^.concat(new(pai386,op_const_ref(
  281. A_CMP,S_B,0,newreference(p^.left^.location.reference))));
  282. end
  283. else
  284. begin
  285. pushusedregisters(pushedregs,$ff);
  286. secondpass(p^.left);
  287. del_reference(p^.left^.location.reference);
  288. emitpushreferenceaddr(exprasmlist,p^.left^.location.reference);
  289. secondpass(p^.right);
  290. del_reference(p^.right^.location.reference);
  291. emitpushreferenceaddr(exprasmlist,p^.right^.location.reference);
  292. emitcall('FPC_SHORTSTR_COMPARE',true);
  293. maybe_loadesi;
  294. popusedregisters(pushedregs);
  295. end;
  296. ungetiftemp(p^.left^.location.reference);
  297. ungetiftemp(p^.right^.location.reference);
  298. end;
  299. else CGMessage(type_e_mismatch);
  300. end;
  301. SetResultLocation(cmpop,true,p);
  302. end;
  303. end;
  304. end;
  305. {*****************************************************************************
  306. Addset
  307. *****************************************************************************}
  308. procedure addset(var p : ptree);
  309. var
  310. createset,
  311. cmpop,
  312. pushed : boolean;
  313. href : treference;
  314. pushedregs : tpushed;
  315. begin
  316. cmpop:=false;
  317. { not commutative }
  318. if p^.swaped then
  319. swaptree(p);
  320. { optimize first loading of a set }
  321. {$ifdef usecreateset}
  322. if (p^.right^.treetype=setelementn) and
  323. is_emptyset(p^.left) then
  324. createset:=true
  325. else
  326. {$endif}
  327. begin
  328. createset:=false;
  329. secondpass(p^.left);
  330. end;
  331. { are too few registers free? }
  332. pushed:=maybe_push(p^.right^.registers32,p);
  333. secondpass(p^.right);
  334. if codegenerror then
  335. exit;
  336. if pushed then
  337. restore(p);
  338. set_location(p^.location,p^.left^.location);
  339. { handle operations }
  340. case p^.treetype of
  341. equaln,
  342. unequaln : begin
  343. cmpop:=true;
  344. del_reference(p^.left^.location.reference);
  345. del_reference(p^.right^.location.reference);
  346. pushusedregisters(pushedregs,$ff);
  347. emitpushreferenceaddr(exprasmlist,p^.right^.location.reference);
  348. emitpushreferenceaddr(exprasmlist,p^.left^.location.reference);
  349. emitcall('FPC_SET_COMP_SETS',true);
  350. maybe_loadesi;
  351. popusedregisters(pushedregs);
  352. ungetiftemp(p^.left^.location.reference);
  353. ungetiftemp(p^.right^.location.reference);
  354. end;
  355. addn : begin
  356. { add can be an other SET or Range or Element ! }
  357. del_reference(p^.left^.location.reference);
  358. del_reference(p^.right^.location.reference);
  359. pushusedregisters(pushedregs,$ff);
  360. href.symbol:=nil;
  361. gettempofsizereference(32,href);
  362. if createset then
  363. begin
  364. pushsetelement(p^.right^.left);
  365. emitpushreferenceaddr(exprasmlist,href);
  366. emitcall('FPC_SET_CREATE_ELEMENT',true);
  367. end
  368. else
  369. begin
  370. { add a range or a single element? }
  371. if p^.right^.treetype=setelementn then
  372. begin
  373. concatcopy(p^.left^.location.reference,href,32,false,false);
  374. if assigned(p^.right^.right) then
  375. begin
  376. pushsetelement(p^.right^.right);
  377. pushsetelement(p^.right^.left);
  378. emitpushreferenceaddr(exprasmlist,href);
  379. emitcall('FPC_SET_SET_RANGE',true);
  380. end
  381. else
  382. begin
  383. pushsetelement(p^.right^.left);
  384. emitpushreferenceaddr(exprasmlist,href);
  385. emitcall('FPC_SET_SET_BYTE',true);
  386. end;
  387. end
  388. else
  389. begin
  390. { must be an other set }
  391. emitpushreferenceaddr(exprasmlist,href);
  392. emitpushreferenceaddr(exprasmlist,p^.right^.location.reference);
  393. emitpushreferenceaddr(exprasmlist,p^.left^.location.reference);
  394. emitcall('FPC_SET_ADD_SETS',true);
  395. end;
  396. end;
  397. maybe_loadesi;
  398. popusedregisters(pushedregs);
  399. ungetiftemp(p^.left^.location.reference);
  400. ungetiftemp(p^.right^.location.reference);
  401. p^.location.loc:=LOC_MEM;
  402. stringdispose(p^.location.reference.symbol);
  403. p^.location.reference:=href;
  404. end;
  405. subn,
  406. symdifn,
  407. muln : begin
  408. del_reference(p^.left^.location.reference);
  409. del_reference(p^.right^.location.reference);
  410. href.symbol:=nil;
  411. pushusedregisters(pushedregs,$ff);
  412. gettempofsizereference(32,href);
  413. emitpushreferenceaddr(exprasmlist,href);
  414. emitpushreferenceaddr(exprasmlist,p^.right^.location.reference);
  415. emitpushreferenceaddr(exprasmlist,p^.left^.location.reference);
  416. case p^.treetype of
  417. subn : emitcall('FPC_SET_SUB_SETS',true);
  418. symdifn : emitcall('FPC_SET_SYMDIF_SETS',true);
  419. muln : emitcall('FPC_SET_MUL_SETS',true);
  420. end;
  421. maybe_loadesi;
  422. popusedregisters(pushedregs);
  423. ungetiftemp(p^.left^.location.reference);
  424. ungetiftemp(p^.right^.location.reference);
  425. p^.location.loc:=LOC_MEM;
  426. stringdispose(p^.location.reference.symbol);
  427. p^.location.reference:=href;
  428. end;
  429. else
  430. CGMessage(type_e_mismatch);
  431. end;
  432. SetResultLocation(cmpop,true,p);
  433. end;
  434. {*****************************************************************************
  435. SecondAdd
  436. *****************************************************************************}
  437. procedure secondadd(var p : ptree);
  438. { is also being used for xor, and "mul", "sub, or and comparative }
  439. { operators }
  440. label do_normal;
  441. var
  442. hregister,hregister2 : tregister;
  443. noswap,popeax,popedx,
  444. pushed,mboverflow,cmpop : boolean;
  445. op,op2 : tasmop;
  446. flags : tresflags;
  447. otl,ofl : plabel;
  448. power : longint;
  449. opsize : topsize;
  450. hl4: plabel;
  451. hr : preference;
  452. { true, if unsigned types are compared }
  453. unsigned : boolean;
  454. { true, if a small set is handled with the longint code }
  455. is_set : boolean;
  456. { is_in_dest if the result is put directly into }
  457. { the resulting refernce or varregister }
  458. is_in_dest : boolean;
  459. { true, if for sets subtractions the extra not should generated }
  460. extra_not : boolean;
  461. {$ifdef SUPPORT_MMX}
  462. mmxbase : tmmxtype;
  463. {$endif SUPPORT_MMX}
  464. pushedreg : tpushed;
  465. begin
  466. { to make it more readable, string and set (not smallset!) have their
  467. own procedures }
  468. case p^.left^.resulttype^.deftype of
  469. stringdef : begin
  470. addstring(p);
  471. exit;
  472. end;
  473. setdef : begin
  474. { normalsets are handled separate }
  475. if not(psetdef(p^.left^.resulttype)^.settype=smallset) then
  476. begin
  477. addset(p);
  478. exit;
  479. end;
  480. end;
  481. end;
  482. { defaults }
  483. unsigned:=false;
  484. is_in_dest:=false;
  485. extra_not:=false;
  486. noswap:=false;
  487. opsize:=S_L;
  488. { are we a (small)set, must be set here because the side can be
  489. swapped ! (PFV) }
  490. is_set:=(p^.left^.resulttype^.deftype=setdef);
  491. { calculate the operator which is more difficult }
  492. firstcomplex(p);
  493. { handling boolean expressions extra: }
  494. if ((p^.left^.resulttype^.deftype=orddef) and
  495. (porddef(p^.left^.resulttype)^.typ in [bool8bit,bool16bit,bool32bit])) or
  496. ((p^.right^.resulttype^.deftype=orddef) and
  497. (porddef(p^.right^.resulttype)^.typ in [bool8bit,bool16bit,bool32bit])) then
  498. begin
  499. if (porddef(p^.left^.resulttype)^.typ=bool8bit) or
  500. (porddef(p^.right^.resulttype)^.typ=bool8bit) then
  501. opsize:=S_B
  502. else
  503. if (porddef(p^.left^.resulttype)^.typ=bool16bit) or
  504. (porddef(p^.right^.resulttype)^.typ=bool16bit) then
  505. opsize:=S_W
  506. else
  507. opsize:=S_L;
  508. case p^.treetype of
  509. andn,
  510. orn : begin
  511. clear_location(p^.location);
  512. p^.location.loc:=LOC_JUMP;
  513. cmpop:=false;
  514. case p^.treetype of
  515. andn : begin
  516. otl:=truelabel;
  517. getlabel(truelabel);
  518. secondpass(p^.left);
  519. maketojumpbool(p^.left);
  520. emitl(A_LABEL,truelabel);
  521. truelabel:=otl;
  522. end;
  523. orn : begin
  524. ofl:=falselabel;
  525. getlabel(falselabel);
  526. secondpass(p^.left);
  527. maketojumpbool(p^.left);
  528. emitl(A_LABEL,falselabel);
  529. falselabel:=ofl;
  530. end;
  531. else
  532. CGMessage(type_e_mismatch);
  533. end;
  534. secondpass(p^.right);
  535. maketojumpbool(p^.right);
  536. end;
  537. unequaln,
  538. equaln,xorn : begin
  539. if p^.left^.treetype=ordconstn then
  540. swaptree(p);
  541. secondpass(p^.left);
  542. set_location(p^.location,p^.left^.location);
  543. {p^.location:=p^.left^.location;
  544. created a bug !!! PM
  545. because symbol was used twice }
  546. { are enough registers free ? }
  547. pushed:=maybe_push(p^.right^.registers32,p);
  548. secondpass(p^.right);
  549. if pushed then restore(p);
  550. goto do_normal;
  551. end
  552. else
  553. CGMessage(type_e_mismatch);
  554. end
  555. end
  556. else
  557. begin
  558. { in case of constant put it to the left }
  559. if (p^.left^.treetype=ordconstn) then
  560. swaptree(p);
  561. secondpass(p^.left);
  562. { this will be complicated as
  563. a lot of code below assumes that
  564. p^.location and p^.left^.location are the same }
  565. {$ifdef test_dest_loc}
  566. if dest_loc_known and (dest_loc_tree=p) and
  567. ((dest_loc.loc=LOC_REGISTER) or (dest_loc.loc=LOC_CREGISTER)) then
  568. begin
  569. set_location(p^.location,dest_loc);
  570. in_dest_loc:=true;
  571. is_in_dest:=true;
  572. end
  573. else
  574. {$endif test_dest_loc}
  575. set_location(p^.location,p^.left^.location);
  576. { are too few registers free? }
  577. pushed:=maybe_push(p^.right^.registers32,p);
  578. secondpass(p^.right);
  579. if pushed then
  580. restore(p);
  581. if (p^.left^.resulttype^.deftype=pointerdef) or
  582. (p^.right^.resulttype^.deftype=pointerdef) or
  583. ((p^.right^.resulttype^.deftype=objectdef) and
  584. pobjectdef(p^.right^.resulttype)^.isclass and
  585. (p^.left^.resulttype^.deftype=objectdef) and
  586. pobjectdef(p^.left^.resulttype)^.isclass
  587. ) or
  588. (p^.left^.resulttype^.deftype=classrefdef) or
  589. (p^.left^.resulttype^.deftype=procvardef) or
  590. (p^.left^.resulttype^.deftype=enumdef) or
  591. ((p^.left^.resulttype^.deftype=orddef) and
  592. (porddef(p^.left^.resulttype)^.typ=s32bit)) or
  593. ((p^.right^.resulttype^.deftype=orddef) and
  594. (porddef(p^.right^.resulttype)^.typ=s32bit)) or
  595. ((p^.left^.resulttype^.deftype=orddef) and
  596. (porddef(p^.left^.resulttype)^.typ=u32bit)) or
  597. ((p^.right^.resulttype^.deftype=orddef) and
  598. (porddef(p^.right^.resulttype)^.typ=u32bit)) or
  599. { as well as small sets }
  600. is_set then
  601. begin
  602. do_normal:
  603. mboverflow:=false;
  604. cmpop:=false;
  605. if (p^.left^.resulttype^.deftype=pointerdef) or
  606. (p^.right^.resulttype^.deftype=pointerdef) or
  607. ((p^.left^.resulttype^.deftype=orddef) and
  608. (porddef(p^.left^.resulttype)^.typ=u32bit)) or
  609. ((p^.right^.resulttype^.deftype=orddef) and
  610. (porddef(p^.right^.resulttype)^.typ=u32bit)) then
  611. unsigned:=true;
  612. case p^.treetype of
  613. addn : begin
  614. if is_set then
  615. begin
  616. { adding elements is not commutative }
  617. if p^.swaped and (p^.left^.treetype=setelementn) then
  618. swaptree(p);
  619. { are we adding set elements ? }
  620. if p^.right^.treetype=setelementn then
  621. begin
  622. { no range support for smallsets! }
  623. if assigned(p^.right^.right) then
  624. internalerror(43244);
  625. { bts requires both elements to be registers }
  626. if p^.left^.location.loc in [LOC_MEM,LOC_REFERENCE] then
  627. begin
  628. ungetiftemp(p^.left^.location.reference);
  629. del_reference(p^.left^.location.reference);
  630. hregister:=getregister32;
  631. exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,opsize,
  632. newreference(p^.left^.location.reference),hregister)));
  633. clear_location(p^.left^.location);
  634. p^.left^.location.loc:=LOC_REGISTER;
  635. p^.left^.location.register:=hregister;
  636. set_location(p^.location,p^.left^.location);
  637. end;
  638. if p^.right^.location.loc in [LOC_MEM,LOC_REFERENCE] then
  639. begin
  640. ungetiftemp(p^.right^.location.reference);
  641. del_reference(p^.right^.location.reference);
  642. hregister:=getregister32;
  643. exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,opsize,
  644. newreference(p^.right^.location.reference),hregister)));
  645. clear_location(p^.right^.location);
  646. p^.right^.location.loc:=LOC_REGISTER;
  647. p^.right^.location.register:=hregister;
  648. end;
  649. op:=A_BTS;
  650. noswap:=true;
  651. end
  652. else
  653. op:=A_OR;
  654. mboverflow:=false;
  655. unsigned:=false;
  656. end
  657. else
  658. begin
  659. op:=A_ADD;
  660. mboverflow:=true;
  661. end;
  662. end;
  663. symdifn : begin
  664. { the symetric diff is only for sets }
  665. if is_set then
  666. begin
  667. op:=A_XOR;
  668. mboverflow:=false;
  669. unsigned:=false;
  670. end
  671. else
  672. CGMessage(type_e_mismatch);
  673. end;
  674. muln : begin
  675. if is_set then
  676. begin
  677. op:=A_AND;
  678. mboverflow:=false;
  679. unsigned:=false;
  680. end
  681. else
  682. begin
  683. if unsigned then
  684. op:=A_MUL
  685. else
  686. op:=A_IMUL;
  687. mboverflow:=true;
  688. end;
  689. end;
  690. subn : begin
  691. if is_set then
  692. begin
  693. op:=A_AND;
  694. mboverflow:=false;
  695. unsigned:=false;
  696. extra_not:=true;
  697. end
  698. else
  699. begin
  700. op:=A_SUB;
  701. mboverflow:=true;
  702. end;
  703. end;
  704. ltn,lten,
  705. gtn,gten,
  706. equaln,unequaln : begin
  707. op:=A_CMP;
  708. cmpop:=true;
  709. end;
  710. xorn : op:=A_XOR;
  711. orn : op:=A_OR;
  712. andn : op:=A_AND;
  713. else
  714. CGMessage(type_e_mismatch);
  715. end;
  716. { filter MUL, which requires special handling }
  717. if op=A_MUL then
  718. begin
  719. popeax:=false;
  720. popedx:=false;
  721. { here you need to free the symbol first }
  722. clear_location(p^.location);
  723. p^.location.register:=getregister32;
  724. p^.location.loc:=LOC_REGISTER;
  725. if not(R_EAX in unused) and (p^.location.register<>R_EAX) then
  726. begin
  727. exprasmlist^.concat(new(pai386,op_reg(A_PUSH,S_L,R_EAX)));
  728. popeax:=true;
  729. end;
  730. if not(R_EDX in unused) and (p^.location.register<>R_EDX) then
  731. begin
  732. exprasmlist^.concat(new(pai386,op_reg(A_PUSH,S_L,R_EDX)));
  733. popedx:=true;
  734. end;
  735. emitloadord2reg(p^.left^.location,u32bitdef,R_EDI,true);
  736. emitloadord2reg(p^.right^.location,u32bitdef,R_EAX,true);
  737. exprasmlist^.concat(new(pai386,op_reg(A_MUL,S_L,R_EDI)));
  738. emit_reg_reg(A_MOV,S_L,R_EAX,p^.location.register);
  739. if popedx then
  740. exprasmlist^.concat(new(pai386,op_reg(A_POP,S_L,R_EDX)));
  741. if popeax then
  742. exprasmlist^.concat(new(pai386,op_reg(A_POP,S_L,R_EAX)));
  743. SetResultLocation(false,true,p);
  744. exit;
  745. end;
  746. { left and right no register? }
  747. { then one must be demanded }
  748. if (p^.left^.location.loc<>LOC_REGISTER) and
  749. (p^.right^.location.loc<>LOC_REGISTER) then
  750. begin
  751. { register variable ? }
  752. if (p^.left^.location.loc=LOC_CREGISTER) then
  753. begin
  754. { it is OK if this is the destination }
  755. if is_in_dest then
  756. begin
  757. hregister:=p^.location.register;
  758. emit_reg_reg(A_MOV,opsize,p^.left^.location.register,
  759. hregister);
  760. end
  761. else
  762. if cmpop then
  763. begin
  764. { do not disturb the register }
  765. hregister:=p^.location.register;
  766. end
  767. else
  768. begin
  769. case opsize of
  770. S_L : hregister:=getregister32;
  771. S_B : hregister:=reg32toreg8(getregister32);
  772. end;
  773. emit_reg_reg(A_MOV,opsize,p^.left^.location.register,
  774. hregister);
  775. end
  776. end
  777. else
  778. begin
  779. ungetiftemp(p^.left^.location.reference);
  780. del_reference(p^.left^.location.reference);
  781. if is_in_dest then
  782. begin
  783. hregister:=p^.location.register;
  784. exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,opsize,
  785. newreference(p^.left^.location.reference),hregister)));
  786. end
  787. else
  788. begin
  789. { first give free, then demand new register }
  790. case opsize of
  791. S_L : hregister:=getregister32;
  792. S_W : hregister:=reg32toreg16(getregister32);
  793. S_B : hregister:=reg32toreg8(getregister32);
  794. end;
  795. exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,opsize,
  796. newreference(p^.left^.location.reference),hregister)));
  797. end;
  798. end;
  799. clear_location(p^.location);
  800. p^.location.loc:=LOC_REGISTER;
  801. p^.location.register:=hregister;
  802. end
  803. else
  804. { if on the right the register then swap }
  805. if not(noswap) and (p^.right^.location.loc=LOC_REGISTER) then
  806. begin
  807. swap_location(p^.location,p^.right^.location);
  808. { newly swapped also set swapped flag }
  809. p^.swaped:=not(p^.swaped);
  810. end;
  811. { at this point, p^.location.loc should be LOC_REGISTER }
  812. { and p^.location.register should be a valid register }
  813. { containing the left result }
  814. if p^.right^.location.loc<>LOC_REGISTER then
  815. begin
  816. if (p^.treetype=subn) and p^.swaped then
  817. begin
  818. if p^.right^.location.loc=LOC_CREGISTER then
  819. begin
  820. if extra_not then
  821. exprasmlist^.concat(new(pai386,op_reg(A_NOT,opsize,p^.location.register)));
  822. emit_reg_reg(A_MOV,opsize,p^.right^.location.register,R_EDI);
  823. emit_reg_reg(op,opsize,p^.location.register,R_EDI);
  824. emit_reg_reg(A_MOV,opsize,R_EDI,p^.location.register);
  825. end
  826. else
  827. begin
  828. if extra_not then
  829. exprasmlist^.concat(new(pai386,op_reg(A_NOT,opsize,p^.location.register)));
  830. exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,opsize,
  831. newreference(p^.right^.location.reference),R_EDI)));
  832. exprasmlist^.concat(new(pai386,op_reg_reg(op,opsize,p^.location.register,R_EDI)));
  833. exprasmlist^.concat(new(pai386,op_reg_reg(A_MOV,opsize,R_EDI,p^.location.register)));
  834. ungetiftemp(p^.right^.location.reference);
  835. del_reference(p^.right^.location.reference);
  836. end;
  837. end
  838. else
  839. begin
  840. if (p^.right^.treetype=ordconstn) and
  841. (op=A_CMP) and
  842. (p^.right^.value=0) then
  843. begin
  844. exprasmlist^.concat(new(pai386,op_reg_reg(A_TEST,opsize,p^.location.register,
  845. p^.location.register)));
  846. end
  847. else if (p^.right^.treetype=ordconstn) and
  848. (op=A_ADD) and
  849. (p^.right^.value=1) and
  850. not(cs_check_overflow in aktlocalswitches) then
  851. begin
  852. exprasmlist^.concat(new(pai386,op_reg(A_INC,opsize,
  853. p^.location.register)));
  854. end
  855. else if (p^.right^.treetype=ordconstn) and
  856. (op=A_SUB) and
  857. (p^.right^.value=1) and
  858. not(cs_check_overflow in aktlocalswitches) then
  859. begin
  860. exprasmlist^.concat(new(pai386,op_reg(A_DEC,opsize,
  861. p^.location.register)));
  862. end
  863. else if (p^.right^.treetype=ordconstn) and
  864. (op=A_IMUL) and
  865. (ispowerof2(p^.right^.value,power)) and
  866. not(cs_check_overflow in aktlocalswitches) then
  867. begin
  868. exprasmlist^.concat(new(pai386,op_const_reg(A_SHL,opsize,power,
  869. p^.location.register)));
  870. end
  871. else
  872. begin
  873. if (p^.right^.location.loc=LOC_CREGISTER) then
  874. begin
  875. if extra_not then
  876. begin
  877. emit_reg_reg(A_MOV,S_L,p^.right^.location.register,R_EDI);
  878. exprasmlist^.concat(new(pai386,op_reg(A_NOT,S_L,R_EDI)));
  879. emit_reg_reg(A_AND,S_L,R_EDI,
  880. p^.location.register);
  881. end
  882. else
  883. begin
  884. emit_reg_reg(op,opsize,p^.right^.location.register,
  885. p^.location.register);
  886. end;
  887. end
  888. else
  889. begin
  890. if extra_not then
  891. begin
  892. exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,S_L,newreference(
  893. p^.right^.location.reference),R_EDI)));
  894. exprasmlist^.concat(new(pai386,op_reg(A_NOT,S_L,R_EDI)));
  895. emit_reg_reg(A_AND,S_L,R_EDI,
  896. p^.location.register);
  897. end
  898. else
  899. begin
  900. exprasmlist^.concat(new(pai386,op_ref_reg(op,opsize,newreference(
  901. p^.right^.location.reference),p^.location.register)));
  902. end;
  903. ungetiftemp(p^.right^.location.reference);
  904. del_reference(p^.right^.location.reference);
  905. end;
  906. end;
  907. end;
  908. end
  909. else
  910. begin
  911. { when swapped another result register }
  912. if (p^.treetype=subn) and p^.swaped then
  913. begin
  914. if extra_not then
  915. exprasmlist^.concat(new(pai386,op_reg(A_NOT,S_L,p^.location.register)));
  916. exprasmlist^.concat(new(pai386,op_reg_reg(op,opsize,
  917. p^.location.register,p^.right^.location.register)));
  918. swap_location(p^.location,p^.right^.location);
  919. { newly swapped also set swapped flag }
  920. { just to maintain ordering }
  921. p^.swaped:=not(p^.swaped);
  922. end
  923. else
  924. begin
  925. if extra_not then
  926. exprasmlist^.concat(new(pai386,op_reg(A_NOT,S_L,p^.right^.location.register)));
  927. exprasmlist^.concat(new(pai386,op_reg_reg(op,opsize,
  928. p^.right^.location.register,
  929. p^.location.register)));
  930. end;
  931. case opsize of
  932. S_L : ungetregister32(p^.right^.location.register);
  933. S_B : ungetregister32(reg8toreg32(p^.right^.location.register));
  934. end;
  935. end;
  936. if cmpop then
  937. case opsize of
  938. S_L : ungetregister32(p^.location.register);
  939. S_B : ungetregister32(reg8toreg32(p^.location.register));
  940. end;
  941. { only in case of overflow operations }
  942. { produce overflow code }
  943. { we must put it here directly, because sign of operation }
  944. { is in unsigned VAR!! }
  945. if mboverflow then
  946. begin
  947. if cs_check_overflow in aktlocalswitches then
  948. begin
  949. getlabel(hl4);
  950. if unsigned then
  951. emitl(A_JNB,hl4)
  952. else
  953. emitl(A_JNO,hl4);
  954. emitcall('FPC_OVERFLOW',true);
  955. emitl(A_LABEL,hl4);
  956. end;
  957. end;
  958. end
  959. else
  960. { Char type }
  961. if ((p^.left^.resulttype^.deftype=orddef) and
  962. (porddef(p^.left^.resulttype)^.typ=uchar)) then
  963. begin
  964. case p^.treetype of
  965. ltn,lten,gtn,gten,
  966. equaln,unequaln :
  967. cmpop:=true;
  968. else CGMessage(type_e_mismatch);
  969. end;
  970. unsigned:=true;
  971. { left and right no register? }
  972. { the one must be demanded }
  973. if (p^.location.loc<>LOC_REGISTER) and
  974. (p^.right^.location.loc<>LOC_REGISTER) then
  975. begin
  976. if p^.location.loc=LOC_CREGISTER then
  977. begin
  978. if cmpop then
  979. { do not disturb register }
  980. hregister:=p^.location.register
  981. else
  982. begin
  983. hregister:=reg32toreg8(getregister32);
  984. emit_reg_reg(A_MOV,S_B,p^.location.register,
  985. hregister);
  986. end;
  987. end
  988. else
  989. begin
  990. del_reference(p^.location.reference);
  991. { first give free then demand new register }
  992. hregister:=reg32toreg8(getregister32);
  993. exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,S_B,newreference(p^.location.reference),
  994. hregister)));
  995. end;
  996. clear_location(p^.location);
  997. p^.location.loc:=LOC_REGISTER;
  998. p^.location.register:=hregister;
  999. end;
  1000. { now p always a register }
  1001. if (p^.right^.location.loc=LOC_REGISTER) and
  1002. (p^.location.loc<>LOC_REGISTER) then
  1003. begin
  1004. swap_location(p^.location,p^.right^.location);
  1005. { newly swapped also set swapped flag }
  1006. p^.swaped:=not(p^.swaped);
  1007. end;
  1008. if p^.right^.location.loc<>LOC_REGISTER then
  1009. begin
  1010. if p^.right^.location.loc=LOC_CREGISTER then
  1011. begin
  1012. emit_reg_reg(A_CMP,S_B,
  1013. p^.right^.location.register,p^.location.register);
  1014. end
  1015. else
  1016. begin
  1017. exprasmlist^.concat(new(pai386,op_ref_reg(A_CMP,S_B,newreference(
  1018. p^.right^.location.reference),p^.location.register)));
  1019. del_reference(p^.right^.location.reference);
  1020. end;
  1021. end
  1022. else
  1023. begin
  1024. emit_reg_reg(A_CMP,S_B,p^.right^.location.register,
  1025. p^.location.register);
  1026. ungetregister32(reg8toreg32(p^.right^.location.register));
  1027. end;
  1028. ungetregister32(reg8toreg32(p^.location.register));
  1029. end
  1030. else
  1031. { 64 bit types }
  1032. if is_64bitint(p^.left^.resulttype) then
  1033. begin
  1034. mboverflow:=false;
  1035. cmpop:=false;
  1036. unsigned:=((p^.left^.resulttype^.deftype=orddef) and
  1037. (porddef(p^.left^.resulttype)^.typ=u64bit)) or
  1038. ((p^.right^.resulttype^.deftype=orddef) and
  1039. (porddef(p^.right^.resulttype)^.typ=u64bit));
  1040. case p^.treetype of
  1041. addn : begin
  1042. begin
  1043. op:=A_ADD;
  1044. op2:=A_ADC;
  1045. mboverflow:=true;
  1046. end;
  1047. end;
  1048. subn : begin
  1049. op:=A_SUB;
  1050. op2:=A_SBB;
  1051. mboverflow:=true;
  1052. end;
  1053. ltn,lten,
  1054. gtn,gten,
  1055. equaln,unequaln:
  1056. begin
  1057. op:=A_CMP;
  1058. op2:=A_CMP;
  1059. cmpop:=true;
  1060. end;
  1061. xorn:
  1062. begin
  1063. op:=A_XOR;
  1064. op2:=A_XOR;
  1065. end;
  1066. orn:
  1067. begin
  1068. op:=A_OR;
  1069. op2:=A_OR;
  1070. end;
  1071. andn:
  1072. begin
  1073. op:=A_AND;
  1074. op2:=A_AND;
  1075. end;
  1076. muln:
  1077. ;
  1078. else
  1079. CGMessage(type_e_mismatch);
  1080. end;
  1081. if p^.treetype=muln then
  1082. begin
  1083. release_qword_loc(p^.left^.location);
  1084. release_qword_loc(p^.right^.location);
  1085. p^.location.registerlow:=getexplicitregister32(R_EAX);
  1086. p^.location.registerhigh:=getexplicitregister32(R_EDX);
  1087. pushusedregisters(pushedreg,$ff
  1088. and not($80 shr byte(p^.location.registerlow))
  1089. and not($80 shr byte(p^.location.registerhigh)));
  1090. if cs_check_overflow in aktlocalswitches then
  1091. push_int(1)
  1092. else
  1093. push_int(0);
  1094. emit_pushq_loc(p^.left^.location);
  1095. emit_pushq_loc(p^.right^.location);
  1096. if porddef(p^.resulttype)^.typ=u64bit then
  1097. emitcall('FPC_MUL_QWORD',true)
  1098. else
  1099. emitcall('FPC_MUL_INT64',true);
  1100. emit_reg_reg(A_MOV,S_L,R_EAX,p^.location.registerlow);
  1101. emit_reg_reg(A_MOV,S_L,R_EDX,p^.location.registerhigh);
  1102. popusedregisters(pushedreg);
  1103. p^.location.loc:=LOC_REGISTER;
  1104. end
  1105. else
  1106. begin
  1107. { left and right no register? }
  1108. { then one must be demanded }
  1109. if (p^.left^.location.loc<>LOC_REGISTER) and
  1110. (p^.right^.location.loc<>LOC_REGISTER) then
  1111. begin
  1112. { register variable ? }
  1113. if (p^.left^.location.loc=LOC_CREGISTER) then
  1114. begin
  1115. { it is OK if this is the destination }
  1116. if is_in_dest then
  1117. begin
  1118. hregister:=p^.location.registerlow;
  1119. hregister2:=p^.location.registerhigh;
  1120. emit_reg_reg(A_MOV,S_L,p^.left^.location.registerlow,
  1121. hregister);
  1122. emit_reg_reg(A_MOV,S_L,p^.left^.location.registerlow,
  1123. hregister2);
  1124. end
  1125. else
  1126. if cmpop then
  1127. begin
  1128. { do not disturb the register }
  1129. hregister:=p^.location.registerlow;
  1130. hregister2:=p^.location.registerhigh;
  1131. end
  1132. else
  1133. begin
  1134. hregister:=getregister32;
  1135. hregister2:=getregister32;
  1136. emit_reg_reg(A_MOV,S_L,p^.left^.location.registerlow,
  1137. hregister);
  1138. emit_reg_reg(A_MOV,S_L,p^.left^.location.registerhigh,
  1139. hregister2);
  1140. end
  1141. end
  1142. else
  1143. begin
  1144. ungetiftemp(p^.left^.location.reference);
  1145. del_reference(p^.left^.location.reference);
  1146. if is_in_dest then
  1147. begin
  1148. hregister:=p^.location.registerlow;
  1149. hregister2:=p^.location.registerhigh;
  1150. exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,S_L,
  1151. newreference(p^.left^.location.reference),hregister)));
  1152. hr:=newreference(p^.left^.location.reference);
  1153. inc(hr^.offset,4);
  1154. exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,S_L,
  1155. hr,hregister2)));
  1156. end
  1157. else
  1158. begin
  1159. hregister:=getregister32;
  1160. hregister2:=getregister32;
  1161. exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,S_L,
  1162. newreference(p^.left^.location.reference),hregister)));
  1163. hr:=newreference(p^.left^.location.reference);
  1164. inc(hr^.offset,4);
  1165. exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,S_L,
  1166. hr,hregister2)));
  1167. end;
  1168. end;
  1169. clear_location(p^.location);
  1170. p^.location.loc:=LOC_REGISTER;
  1171. p^.location.registerlow:=hregister;
  1172. p^.location.registerhigh:=hregister2;
  1173. end
  1174. else
  1175. { if on the right the register then swap }
  1176. if not(noswap) and (p^.right^.location.loc=LOC_REGISTER) then
  1177. begin
  1178. swap_location(p^.location,p^.right^.location);
  1179. { newly swapped also set swapped flag }
  1180. p^.swaped:=not(p^.swaped);
  1181. end;
  1182. { at this point, p^.location.loc should be LOC_REGISTER }
  1183. { and p^.location.register should be a valid register }
  1184. { containing the left result }
  1185. if p^.right^.location.loc<>LOC_REGISTER then
  1186. begin
  1187. if (p^.treetype=subn) and p^.swaped then
  1188. begin
  1189. if p^.right^.location.loc=LOC_CREGISTER then
  1190. begin
  1191. emit_reg_reg(A_MOV,opsize,p^.right^.location.register,R_EDI);
  1192. emit_reg_reg(op,opsize,p^.location.register,R_EDI);
  1193. emit_reg_reg(A_MOV,opsize,R_EDI,p^.location.register);
  1194. end
  1195. else
  1196. begin
  1197. exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,opsize,
  1198. newreference(p^.right^.location.reference),R_EDI)));
  1199. exprasmlist^.concat(new(pai386,op_reg_reg(op,opsize,p^.location.register,R_EDI)));
  1200. exprasmlist^.concat(new(pai386,op_reg_reg(A_MOV,opsize,R_EDI,p^.location.register)));
  1201. ungetiftemp(p^.right^.location.reference);
  1202. del_reference(p^.right^.location.reference);
  1203. end;
  1204. end
  1205. else if cmpop then
  1206. begin
  1207. if (p^.right^.location.loc=LOC_CREGISTER) then
  1208. begin
  1209. emit_reg_reg(A_CMP,S_L,p^.right^.location.registerhigh,
  1210. p^.location.registerhigh);
  1211. emitl(flag_2_jmp[getresflags(p,unsigned)],truelabel);
  1212. emit_reg_reg(A_CMP,S_L,p^.right^.location.registerlow,
  1213. p^.location.registerlow);
  1214. emitl(flag_2_jmp[getresflags(p,unsigned)],truelabel);
  1215. emitl(A_JMP,falselabel);
  1216. end
  1217. else
  1218. begin
  1219. hr:=newreference(p^.right^.location.reference);
  1220. inc(hr^.offset,4);
  1221. exprasmlist^.concat(new(pai386,op_ref_reg(A_CMP,S_L,
  1222. hr,p^.location.registerhigh)));
  1223. emitl(flag_2_jmp[getresflags(p,unsigned)],truelabel);
  1224. exprasmlist^.concat(new(pai386,op_ref_reg(A_CMP,S_L,newreference(
  1225. p^.right^.location.reference),p^.location.registerlow)));
  1226. emitl(flag_2_jmp[getresflags(p,unsigned)],truelabel);
  1227. emitl(A_JMP,falselabel);
  1228. ungetiftemp(p^.right^.location.reference);
  1229. del_reference(p^.right^.location.reference);
  1230. end;
  1231. end
  1232. else
  1233. begin
  1234. {
  1235. if (p^.right^.treetype=ordconstn) and
  1236. (op=A_CMP) and
  1237. (p^.right^.value=0) then
  1238. begin
  1239. exprasmlist^.concat(new(pai386,op_reg_reg(A_TEST,opsize,p^.location.register,
  1240. p^.location.register)));
  1241. end
  1242. else if (p^.right^.treetype=ordconstn) and
  1243. (op=A_IMUL) and
  1244. (ispowerof2(p^.right^.value,power)) then
  1245. begin
  1246. exprasmlist^.concat(new(pai386,op_const_reg(A_SHL,opsize,power,
  1247. p^.location.register)));
  1248. end
  1249. else
  1250. }
  1251. begin
  1252. if (p^.right^.location.loc=LOC_CREGISTER) then
  1253. begin
  1254. emit_reg_reg(op,S_L,p^.right^.location.registerlow,
  1255. p^.location.registerlow);
  1256. emit_reg_reg(op2,S_L,p^.right^.location.registerhigh,
  1257. p^.location.registerhigh);
  1258. end
  1259. else
  1260. begin
  1261. exprasmlist^.concat(new(pai386,op_ref_reg(op,S_L,newreference(
  1262. p^.right^.location.reference),p^.location.registerlow)));
  1263. hr:=newreference(p^.right^.location.reference);
  1264. inc(hr^.offset,4);
  1265. exprasmlist^.concat(new(pai386,op_ref_reg(op2,S_L,
  1266. hr,p^.location.registerhigh)));
  1267. ungetiftemp(p^.right^.location.reference);
  1268. del_reference(p^.right^.location.reference);
  1269. end;
  1270. end;
  1271. end;
  1272. end
  1273. else
  1274. begin
  1275. { when swapped another result register }
  1276. if (p^.treetype=subn) and p^.swaped then
  1277. begin
  1278. exprasmlist^.concat(new(pai386,op_reg_reg(op,opsize,
  1279. p^.location.register,p^.right^.location.register)));
  1280. swap_location(p^.location,p^.right^.location);
  1281. { newly swapped also set swapped flag }
  1282. { just to maintain ordering }
  1283. p^.swaped:=not(p^.swaped);
  1284. end
  1285. else if cmpop then
  1286. begin
  1287. exprasmlist^.concat(new(pai386,op_reg_reg(A_CMP,S_L,
  1288. p^.right^.location.registerhigh,
  1289. p^.location.registerhigh)));
  1290. emitl(flag_2_jmp[getresflags(p,unsigned)],truelabel);
  1291. exprasmlist^.concat(new(pai386,op_reg_reg(A_CMP,S_L,
  1292. p^.right^.location.registerlow,
  1293. p^.location.registerlow)));
  1294. emitl(flag_2_jmp[getresflags(p,unsigned)],truelabel);
  1295. emitl(A_JMP,falselabel);
  1296. end
  1297. else
  1298. begin
  1299. exprasmlist^.concat(new(pai386,op_reg_reg(op,S_L,
  1300. p^.right^.location.registerlow,
  1301. p^.location.registerlow)));
  1302. exprasmlist^.concat(new(pai386,op_reg_reg(op2,S_L,
  1303. p^.right^.location.registerhigh,
  1304. p^.location.registerhigh)));
  1305. end;
  1306. ungetregister32(p^.right^.location.registerlow);
  1307. ungetregister32(p^.right^.location.registerhigh);
  1308. end;
  1309. if cmpop then
  1310. begin
  1311. ungetregister32(p^.location.registerlow);
  1312. ungetregister32(p^.location.registerhigh);
  1313. end;
  1314. { only in case of overflow operations }
  1315. { produce overflow code }
  1316. { we must put it here directly, because sign of operation }
  1317. { is in unsigned VAR!! }
  1318. if mboverflow then
  1319. begin
  1320. if cs_check_overflow in aktlocalswitches then
  1321. begin
  1322. getlabel(hl4);
  1323. if unsigned then
  1324. emitl(A_JNB,hl4)
  1325. else
  1326. emitl(A_JNO,hl4);
  1327. emitcall('FPC_OVERFLOW',true);
  1328. emitl(A_LABEL,hl4);
  1329. end;
  1330. end;
  1331. { we have LOC_JUMP as result }
  1332. if cmpop then
  1333. begin
  1334. clear_location(p^.location);
  1335. p^.location.loc:=LOC_JUMP;
  1336. cmpop:=false;
  1337. end;
  1338. end;
  1339. end
  1340. else
  1341. { Floating point }
  1342. if (p^.left^.resulttype^.deftype=floatdef) and
  1343. (pfloatdef(p^.left^.resulttype)^.typ<>f32bit) then
  1344. begin
  1345. { real constants to the left }
  1346. if p^.left^.treetype=realconstn then
  1347. swaptree(p);
  1348. cmpop:=false;
  1349. case p^.treetype of
  1350. addn : op:=A_FADDP;
  1351. muln : op:=A_FMULP;
  1352. subn : op:=A_FSUBP;
  1353. slashn : op:=A_FDIVP;
  1354. ltn,lten,gtn,gten,
  1355. equaln,unequaln : begin
  1356. op:=A_FCOMPP;
  1357. cmpop:=true;
  1358. end;
  1359. else CGMessage(type_e_mismatch);
  1360. end;
  1361. if (p^.right^.location.loc<>LOC_FPU) then
  1362. begin
  1363. floatload(pfloatdef(p^.right^.resulttype)^.typ,p^.right^.location.reference);
  1364. if (p^.left^.location.loc<>LOC_FPU) then
  1365. floatload(pfloatdef(p^.left^.resulttype)^.typ,p^.left^.location.reference)
  1366. { left was on the stack => swap }
  1367. else
  1368. p^.swaped:=not(p^.swaped);
  1369. { releases the right reference }
  1370. del_reference(p^.right^.location.reference);
  1371. end
  1372. { the nominator in st0 }
  1373. else if (p^.left^.location.loc<>LOC_FPU) then
  1374. floatload(pfloatdef(p^.left^.resulttype)^.typ,p^.left^.location.reference)
  1375. { fpu operands are always in the wrong order on the stack }
  1376. else
  1377. p^.swaped:=not(p^.swaped);
  1378. { releases the left reference }
  1379. if (p^.left^.location.loc<>LOC_FPU) then
  1380. del_reference(p^.left^.location.reference);
  1381. { if we swaped the tree nodes, then use the reverse operator }
  1382. if p^.swaped then
  1383. begin
  1384. if (p^.treetype=slashn) then
  1385. op:=A_FDIVRP
  1386. else if (p^.treetype=subn) then
  1387. op:=A_FSUBRP;
  1388. end;
  1389. { to avoid the pentium bug
  1390. if (op=FDIVP) and (opt_processors=pentium) then
  1391. exprasmlist^.concat(new(pai386,op_CALL,S_NO,'EMUL_FDIVP')
  1392. else
  1393. }
  1394. { the Intel assemblers want operands }
  1395. if op<>A_FCOMPP then
  1396. exprasmlist^.concat(new(pai386,op_reg_reg(op,S_NO,R_ST,R_ST1)))
  1397. else
  1398. exprasmlist^.concat(new(pai386,op_none(op,S_NO)));
  1399. { on comparison load flags }
  1400. if cmpop then
  1401. begin
  1402. if not(R_EAX in unused) then
  1403. emit_reg_reg(A_MOV,S_L,R_EAX,R_EDI);
  1404. exprasmlist^.concat(new(pai386,op_reg(A_FNSTSW,S_NO,R_AX)));
  1405. exprasmlist^.concat(new(pai386,op_none(A_SAHF,S_NO)));
  1406. if not(R_EAX in unused) then
  1407. emit_reg_reg(A_MOV,S_L,R_EDI,R_EAX);
  1408. if p^.swaped then
  1409. begin
  1410. case p^.treetype of
  1411. equaln : flags:=F_E;
  1412. unequaln : flags:=F_NE;
  1413. ltn : flags:=F_A;
  1414. lten : flags:=F_AE;
  1415. gtn : flags:=F_B;
  1416. gten : flags:=F_BE;
  1417. end;
  1418. end
  1419. else
  1420. begin
  1421. case p^.treetype of
  1422. equaln : flags:=F_E;
  1423. unequaln : flags:=F_NE;
  1424. ltn : flags:=F_B;
  1425. lten : flags:=F_BE;
  1426. gtn : flags:=F_A;
  1427. gten : flags:=F_AE;
  1428. end;
  1429. end;
  1430. clear_location(p^.location);
  1431. p^.location.loc:=LOC_FLAGS;
  1432. p^.location.resflags:=flags;
  1433. cmpop:=false;
  1434. end
  1435. else
  1436. begin
  1437. clear_location(p^.location);
  1438. p^.location.loc:=LOC_FPU;
  1439. end;
  1440. end
  1441. {$ifdef SUPPORT_MMX}
  1442. else
  1443. { MMX Arrays }
  1444. if is_mmx_able_array(p^.left^.resulttype) then
  1445. begin
  1446. cmpop:=false;
  1447. mmxbase:=mmx_type(p^.left^.resulttype);
  1448. case p^.treetype of
  1449. addn : begin
  1450. if (cs_mmx_saturation in aktlocalswitches) then
  1451. begin
  1452. case mmxbase of
  1453. mmxs8bit:
  1454. op:=A_PADDSB;
  1455. mmxu8bit:
  1456. op:=A_PADDUSB;
  1457. mmxs16bit,mmxfixed16:
  1458. op:=A_PADDSB;
  1459. mmxu16bit:
  1460. op:=A_PADDUSW;
  1461. end;
  1462. end
  1463. else
  1464. begin
  1465. case mmxbase of
  1466. mmxs8bit,mmxu8bit:
  1467. op:=A_PADDB;
  1468. mmxs16bit,mmxu16bit,mmxfixed16:
  1469. op:=A_PADDW;
  1470. mmxs32bit,mmxu32bit:
  1471. op:=A_PADDD;
  1472. end;
  1473. end;
  1474. end;
  1475. muln : begin
  1476. case mmxbase of
  1477. mmxs16bit,mmxu16bit:
  1478. op:=A_PMULLW;
  1479. mmxfixed16:
  1480. op:=A_PMULHW;
  1481. end;
  1482. end;
  1483. subn : begin
  1484. if (cs_mmx_saturation in aktlocalswitches) then
  1485. begin
  1486. case mmxbase of
  1487. mmxs8bit:
  1488. op:=A_PSUBSB;
  1489. mmxu8bit:
  1490. op:=A_PSUBUSB;
  1491. mmxs16bit,mmxfixed16:
  1492. op:=A_PSUBSB;
  1493. mmxu16bit:
  1494. op:=A_PSUBUSW;
  1495. end;
  1496. end
  1497. else
  1498. begin
  1499. case mmxbase of
  1500. mmxs8bit,mmxu8bit:
  1501. op:=A_PSUBB;
  1502. mmxs16bit,mmxu16bit,mmxfixed16:
  1503. op:=A_PSUBW;
  1504. mmxs32bit,mmxu32bit:
  1505. op:=A_PSUBD;
  1506. end;
  1507. end;
  1508. end;
  1509. {
  1510. ltn,lten,gtn,gten,
  1511. equaln,unequaln :
  1512. begin
  1513. op:=A_CMP;
  1514. cmpop:=true;
  1515. end;
  1516. }
  1517. xorn:
  1518. op:=A_PXOR;
  1519. orn:
  1520. op:=A_POR;
  1521. andn:
  1522. op:=A_PAND;
  1523. else CGMessage(type_e_mismatch);
  1524. end;
  1525. { left and right no register? }
  1526. { then one must be demanded }
  1527. if (p^.left^.location.loc<>LOC_MMXREGISTER) and
  1528. (p^.right^.location.loc<>LOC_MMXREGISTER) then
  1529. begin
  1530. { register variable ? }
  1531. if (p^.left^.location.loc=LOC_CMMXREGISTER) then
  1532. begin
  1533. { it is OK if this is the destination }
  1534. if is_in_dest then
  1535. begin
  1536. hregister:=p^.location.register;
  1537. emit_reg_reg(A_MOVQ,S_NO,p^.left^.location.register,
  1538. hregister);
  1539. end
  1540. else
  1541. begin
  1542. hregister:=getregistermmx;
  1543. emit_reg_reg(A_MOVQ,S_NO,p^.left^.location.register,
  1544. hregister);
  1545. end
  1546. end
  1547. else
  1548. begin
  1549. del_reference(p^.left^.location.reference);
  1550. if is_in_dest then
  1551. begin
  1552. hregister:=p^.location.register;
  1553. exprasmlist^.concat(new(pai386,op_ref_reg(A_MOVQ,S_NO,
  1554. newreference(p^.left^.location.reference),hregister)));
  1555. end
  1556. else
  1557. begin
  1558. hregister:=getregistermmx;
  1559. exprasmlist^.concat(new(pai386,op_ref_reg(A_MOVQ,S_NO,
  1560. newreference(p^.left^.location.reference),hregister)));
  1561. end;
  1562. end;
  1563. clear_location(p^.location);
  1564. p^.location.loc:=LOC_MMXREGISTER;
  1565. p^.location.register:=hregister;
  1566. end
  1567. else
  1568. { if on the right the register then swap }
  1569. if (p^.right^.location.loc=LOC_MMXREGISTER) then
  1570. begin
  1571. swap_location(p^.location,p^.right^.location);
  1572. { newly swapped also set swapped flag }
  1573. p^.swaped:=not(p^.swaped);
  1574. end;
  1575. { at this point, p^.location.loc should be LOC_MMXREGISTER }
  1576. { and p^.location.register should be a valid register }
  1577. { containing the left result }
  1578. if p^.right^.location.loc<>LOC_MMXREGISTER then
  1579. begin
  1580. if (p^.treetype=subn) and p^.swaped then
  1581. begin
  1582. if p^.right^.location.loc=LOC_CMMXREGISTER then
  1583. begin
  1584. emit_reg_reg(A_MOVQ,S_NO,p^.right^.location.register,R_MM7);
  1585. emit_reg_reg(op,S_NO,p^.location.register,R_EDI);
  1586. emit_reg_reg(A_MOVQ,S_NO,R_MM7,p^.location.register);
  1587. end
  1588. else
  1589. begin
  1590. exprasmlist^.concat(new(pai386,op_ref_reg(A_MOVQ,S_NO,
  1591. newreference(p^.right^.location.reference),R_MM7)));
  1592. exprasmlist^.concat(new(pai386,op_reg_reg(op,S_NO,p^.location.register,
  1593. R_MM7)));
  1594. exprasmlist^.concat(new(pai386,op_reg_reg(A_MOVQ,S_NO,
  1595. R_MM7,p^.location.register)));
  1596. del_reference(p^.right^.location.reference);
  1597. end;
  1598. end
  1599. else
  1600. begin
  1601. if (p^.right^.location.loc=LOC_CREGISTER) then
  1602. begin
  1603. emit_reg_reg(op,S_NO,p^.right^.location.register,
  1604. p^.location.register);
  1605. end
  1606. else
  1607. begin
  1608. exprasmlist^.concat(new(pai386,op_ref_reg(op,S_NO,newreference(
  1609. p^.right^.location.reference),p^.location.register)));
  1610. del_reference(p^.right^.location.reference);
  1611. end;
  1612. end;
  1613. end
  1614. else
  1615. begin
  1616. { when swapped another result register }
  1617. if (p^.treetype=subn) and p^.swaped then
  1618. begin
  1619. exprasmlist^.concat(new(pai386,op_reg_reg(op,S_NO,
  1620. p^.location.register,p^.right^.location.register)));
  1621. swap_location(p^.location,p^.right^.location);
  1622. { newly swapped also set swapped flag }
  1623. { just to maintain ordering }
  1624. p^.swaped:=not(p^.swaped);
  1625. end
  1626. else
  1627. begin
  1628. exprasmlist^.concat(new(pai386,op_reg_reg(op,S_NO,
  1629. p^.right^.location.register,
  1630. p^.location.register)));
  1631. end;
  1632. ungetregistermmx(p^.right^.location.register);
  1633. end;
  1634. end
  1635. {$endif SUPPORT_MMX}
  1636. else CGMessage(type_e_mismatch);
  1637. end;
  1638. SetResultLocation(cmpop,unsigned,p);
  1639. end;
  1640. end.
  1641. {
  1642. $Log$
  1643. Revision 1.39 1999-01-19 10:18:58 florian
  1644. * bug with mul. of dwords fixed, reported by Alexander Stohr
  1645. * some changes to compile with TP
  1646. + small enhancements for the new code generator
  1647. Revision 1.38 1999/01/05 17:03:36 jonas
  1648. * don't output inc/dec if cs_check_overflow is on, because inc/dec don't change
  1649. the carry flag
  1650. Revision 1.37 1998/12/22 13:10:56 florian
  1651. * memory leaks for ansistring type casts fixed
  1652. Revision 1.36 1998/12/19 00:23:40 florian
  1653. * ansistring memory leaks fixed
  1654. Revision 1.35 1998/12/11 23:36:06 florian
  1655. + again more stuff for int64/qword:
  1656. - comparision operators
  1657. - code generation for: str, read(ln), write(ln)
  1658. Revision 1.34 1998/12/11 00:02:46 peter
  1659. + globtype,tokens,version unit splitted from globals
  1660. Revision 1.33 1998/12/10 11:16:00 florian
  1661. + some basic operations with qwords and int64 added: +, xor, and, or;
  1662. the register allocation works fine
  1663. Revision 1.32 1998/12/10 09:47:13 florian
  1664. + basic operations with int64/qord (compiler with -dint64)
  1665. + rtti of enumerations extended: names are now written
  1666. Revision 1.31 1998/11/30 09:42:59 pierre
  1667. * some range check bugs fixed (still not working !)
  1668. + added DLL writing support for win32 (also accepts variables)
  1669. + TempAnsi for code that could be used for Temporary ansi strings
  1670. handling
  1671. Revision 1.30 1998/11/24 12:52:40 peter
  1672. * sets are not written twice anymore
  1673. * optimize for emptyset+single element which uses a new routine from
  1674. set.inc FPC_SET_CREATE_ELEMENT
  1675. Revision 1.29 1998/11/18 15:44:05 peter
  1676. * VALUEPARA for tp7 compatible value parameters
  1677. Revision 1.28 1998/11/18 09:18:01 pierre
  1678. + automatic loading of profile unit with -pg option
  1679. in go32v2 mode (also defines FPC_PROFILE)
  1680. * some memory leaks removed
  1681. * unreleased temp problem with sets solved
  1682. Revision 1.27 1998/11/17 00:36:38 peter
  1683. * more ansistring fixes
  1684. Revision 1.26 1998/11/16 16:17:16 peter
  1685. * fixed ansistring temp which forgot a reset
  1686. Revision 1.25 1998/11/16 15:35:35 peter
  1687. * rename laod/copystring -> load/copyshortstring
  1688. * fixed int-bool cnv bug
  1689. + char-ansistring conversion
  1690. Revision 1.24 1998/11/07 12:49:30 peter
  1691. * fixed ansicompare which returns signed
  1692. Revision 1.23 1998/10/29 15:42:43 florian
  1693. + partial disposing of temp. ansistrings
  1694. Revision 1.22 1998/10/28 18:26:12 pierre
  1695. * removed some erros after other errors (introduced by useexcept)
  1696. * stabs works again correctly (for how long !)
  1697. Revision 1.21 1998/10/25 23:32:48 peter
  1698. * fixed unsigned mul
  1699. Revision 1.20 1998/10/21 08:39:56 florian
  1700. + ansistring operator +
  1701. + $h and string[n] for n>255 added
  1702. * small problem with TP fixed
  1703. Revision 1.19 1998/10/20 15:09:21 florian
  1704. + binary operators for ansi strings
  1705. Revision 1.18 1998/10/20 08:06:38 pierre
  1706. * several memory corruptions due to double freemem solved
  1707. => never use p^.loc.location:=p^.left^.loc.location;
  1708. + finally I added now by default
  1709. that ra386dir translates global and unit symbols
  1710. + added a first field in tsymtable and
  1711. a nextsym field in tsym
  1712. (this allows to obtain ordered type info for
  1713. records and objects in gdb !)
  1714. Revision 1.17 1998/10/09 11:47:45 pierre
  1715. * still more memory leaks fixes !!
  1716. Revision 1.16 1998/10/09 08:56:21 pierre
  1717. * several memory leaks fixed
  1718. Revision 1.15 1998/10/08 17:17:10 pierre
  1719. * current_module old scanner tagged as invalid if unit is recompiled
  1720. + added ppheap for better info on tracegetmem of heaptrc
  1721. (adds line column and file index)
  1722. * several memory leaks removed ith help of heaptrc !!
  1723. Revision 1.14 1998/09/28 16:57:13 pierre
  1724. * changed all length(p^.value_str^) into str_length(p)
  1725. to get it work with and without ansistrings
  1726. * changed sourcefiles field of tmodule to a pointer
  1727. Revision 1.13 1998/09/17 09:42:09 peter
  1728. + pass_2 for cg386
  1729. * Message() -> CGMessage() for pass_1/pass_2
  1730. Revision 1.12 1998/09/14 10:43:44 peter
  1731. * all internal RTL functions start with FPC_
  1732. Revision 1.11 1998/09/07 18:45:52 peter
  1733. * update smartlinking, uses getdatalabel
  1734. * renamed ptree.value vars to value_str,value_real,value_set
  1735. Revision 1.10 1998/09/04 10:05:04 florian
  1736. * ugly fix for STRCAT, nevertheless it needs more fixing !!!!!!!
  1737. we need an new version of STRCAT which takes a length parameter
  1738. Revision 1.9 1998/09/04 08:41:36 peter
  1739. * updated some error CGMessages
  1740. Revision 1.8 1998/08/28 10:54:18 peter
  1741. * fixed smallset generation from elements, it has never worked before!
  1742. Revision 1.7 1998/08/19 14:56:59 peter
  1743. * forgot to removed some unused code in addset for set<>set
  1744. Revision 1.6 1998/08/18 09:24:35 pierre
  1745. * small warning position bug fixed
  1746. * support_mmx switches splitting was missing
  1747. * rhide error and warning output corrected
  1748. Revision 1.5 1998/08/14 18:18:37 peter
  1749. + dynamic set contruction
  1750. * smallsets are now working (always longint size)
  1751. Revision 1.4 1998/08/10 14:49:42 peter
  1752. + localswitches, moduleswitches, globalswitches splitting
  1753. Revision 1.3 1998/06/25 08:48:04 florian
  1754. * first version of rtti support
  1755. Revision 1.2 1998/06/08 13:13:28 pierre
  1756. + temporary variables now in temp_gen.pas unit
  1757. because it is processor independent
  1758. * mppc68k.bat modified to undefine i386 and support_mmx
  1759. (which are defaults for i386)
  1760. Revision 1.1 1998/06/05 17:44:10 peter
  1761. * splitted cgi386
  1762. }