ag386int.pas 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829
  1. {
  2. $Id$
  3. Copyright (c) 1996,97 by Florian Klaempfl
  4. This unit implements an asmoutput class for Intel syntax with Intel i386+
  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. {$ifdef TP}
  19. {$N+,E+}
  20. {$endif}
  21. unit ag386int;
  22. interface
  23. uses aasm,assemble;
  24. type
  25. pi386intasmlist=^ti386intasmlist;
  26. ti386intasmlist = object(tasmlist)
  27. procedure WriteTree(p:paasmoutput);virtual;
  28. procedure WriteAsmList;virtual;
  29. procedure WriteExternals;
  30. end;
  31. implementation
  32. uses
  33. dos,strings,
  34. globtype,globals,systems,cobjects,
  35. files,verbose
  36. ,i386base,i386asm
  37. {$ifdef GDB}
  38. ,gdb
  39. {$endif GDB}
  40. ;
  41. const
  42. line_length = 70;
  43. {$ifdef EXTTYPE}
  44. extstr : array[EXT_NEAR..EXT_ABS] of String[8] =
  45. ('NEAR','FAR','PROC','BYTE','WORD','DWORD',
  46. 'CODEPTR','DATAPTR','FWORD','PWORD','QWORD','TBYTE','ABS');
  47. {$endif}
  48. function single2str(d : single) : string;
  49. var
  50. hs : string;
  51. p : byte;
  52. begin
  53. str(d,hs);
  54. { nasm expects a lowercase e }
  55. p:=pos('E',hs);
  56. if p>0 then
  57. hs[p]:='e';
  58. p:=pos('+',hs);
  59. if p>0 then
  60. delete(hs,p,1);
  61. single2str:=lower(hs);
  62. end;
  63. function double2str(d : double) : string;
  64. var
  65. hs : string;
  66. p : byte;
  67. begin
  68. str(d,hs);
  69. { nasm expects a lowercase e }
  70. p:=pos('E',hs);
  71. if p>0 then
  72. hs[p]:='e';
  73. p:=pos('+',hs);
  74. if p>0 then
  75. delete(hs,p,1);
  76. double2str:=lower(hs);
  77. end;
  78. function extended2str(e : extended) : string;
  79. var
  80. hs : string;
  81. p : byte;
  82. begin
  83. str(e,hs);
  84. { nasm expects a lowercase e }
  85. p:=pos('E',hs);
  86. if p>0 then
  87. hs[p]:='e';
  88. p:=pos('+',hs);
  89. if p>0 then
  90. delete(hs,p,1);
  91. extended2str:=lower(hs);
  92. end;
  93. function comp2str(d : bestreal) : string;
  94. type
  95. pdouble = ^double;
  96. var
  97. c : comp;
  98. dd : pdouble;
  99. begin
  100. {$ifdef FPC}
  101. c:=comp(d);
  102. {$else}
  103. c:=d;
  104. {$endif}
  105. dd:=pdouble(@c); { this makes a bitwise copy of c into a double }
  106. comp2str:=double2str(dd^);
  107. end;
  108. function getreferencestring(const ref : treference) : string;
  109. var
  110. s : string;
  111. first : boolean;
  112. begin
  113. if ref.is_immediate then
  114. begin
  115. getreferencestring:=tostr(ref.offset);
  116. exit;
  117. end
  118. else
  119. with ref do
  120. begin
  121. first:=true;
  122. if ref.segment<>R_NO then
  123. s:=int_reg2str[segment]+':['
  124. else
  125. s:='[';
  126. if assigned(symbol) then
  127. begin
  128. s:=s+symbol^.name;
  129. first:=false;
  130. end;
  131. if (base<>R_NO) then
  132. begin
  133. if not(first) then
  134. s:=s+'+'
  135. else
  136. first:=false;
  137. s:=s+int_reg2str[base];
  138. end;
  139. if (index<>R_NO) then
  140. begin
  141. if not(first) then
  142. s:=s+'+'
  143. else
  144. first:=false;
  145. s:=s+int_reg2str[index];
  146. if scalefactor<>0 then
  147. s:=s+'*'+tostr(scalefactor);
  148. end;
  149. if offset<0 then
  150. s:=s+tostr(offset)
  151. else if (offset>0) then
  152. s:=s+'+'+tostr(offset);
  153. s:=s+']';
  154. end;
  155. getreferencestring:=s;
  156. end;
  157. function getopstr(const o:toper;s : topsize; opcode: tasmop;dest : boolean) : string;
  158. var
  159. hs : string;
  160. begin
  161. case o.typ of
  162. top_reg :
  163. getopstr:=int_reg2str[o.reg];
  164. top_const :
  165. getopstr:=tostr(o.val);
  166. top_symbol :
  167. begin
  168. if assigned(o.sym) then
  169. hs:='offset '+o.sym^.name
  170. else
  171. hs:='offset ';
  172. if o.symofs>0 then
  173. hs:=hs+'+'+tostr(o.symofs)
  174. else
  175. if o.symofs<0 then
  176. hs:=hs+tostr(o.symofs)
  177. else
  178. if not(assigned(o.sym)) then
  179. hs:=hs+'0';
  180. getopstr:=hs;
  181. end;
  182. top_ref :
  183. begin
  184. hs:=getreferencestring(o.ref^);
  185. if ((opcode <> A_LGS) and (opcode <> A_LSS) and
  186. (opcode <> A_LFS) and (opcode <> A_LDS) and
  187. (opcode <> A_LES)) then
  188. Begin
  189. case s of
  190. S_B : hs:='byte ptr '+hs;
  191. S_W : hs:='word ptr '+hs;
  192. S_L : hs:='dword ptr '+hs;
  193. S_IS : hs:='word ptr '+hs;
  194. S_IL : hs:='dword ptr '+hs;
  195. S_IQ : hs:='qword ptr '+hs;
  196. S_FS : hs:='dword ptr '+hs;
  197. S_FL : hs:='qword ptr '+hs;
  198. S_FX : hs:='tbyte ptr '+hs;
  199. S_BW : if dest then
  200. hs:='word ptr '+hs
  201. else
  202. hs:='byte ptr '+hs;
  203. S_BL : if dest then
  204. hs:='dword ptr '+hs
  205. else
  206. hs:='byte ptr '+hs;
  207. S_WL : if dest then
  208. hs:='dword ptr '+hs
  209. else
  210. hs:='word ptr '+hs;
  211. end;
  212. end;
  213. getopstr:=hs;
  214. end;
  215. else
  216. internalerror(10001);
  217. end;
  218. end;
  219. function getopstr_jmp(const o:toper) : string;
  220. var
  221. hs : string;
  222. begin
  223. case o.typ of
  224. top_reg :
  225. getopstr_jmp:=int_reg2str[o.reg];
  226. top_const :
  227. getopstr_jmp:=tostr(o.val);
  228. top_symbol :
  229. begin
  230. hs:=o.sym^.name;
  231. if o.symofs>0 then
  232. hs:=hs+'+'+tostr(o.symofs)
  233. else
  234. if o.symofs<0 then
  235. hs:=hs+tostr(o.symofs);
  236. getopstr_jmp:=hs;
  237. end;
  238. top_ref :
  239. getopstr_jmp:=getreferencestring(o.ref^);
  240. else
  241. internalerror(10001);
  242. end;
  243. end;
  244. {****************************************************************************
  245. TI386INTASMLIST
  246. ****************************************************************************}
  247. var
  248. LastSec : tsection;
  249. const
  250. ait_const2str:array[ait_const_32bit..ait_const_8bit] of string[8]=
  251. (#9'DD'#9,#9'DW'#9,#9'DB'#9);
  252. Function PadTabs(const p:string;addch:char):string;
  253. var
  254. s : string;
  255. i : longint;
  256. begin
  257. i:=length(p);
  258. if addch<>#0 then
  259. begin
  260. inc(i);
  261. s:=p+addch;
  262. end
  263. else
  264. s:=p;
  265. if i<8 then
  266. PadTabs:=s+#9#9
  267. else
  268. PadTabs:=s+#9;
  269. end;
  270. procedure ti386intasmlist.WriteTree(p:paasmoutput);
  271. var
  272. s,
  273. prefix,
  274. suffix : string;
  275. hp : pai;
  276. counter,
  277. lines,
  278. i,j,l : longint;
  279. consttyp : tait;
  280. found,
  281. quoted : boolean;
  282. sep : char;
  283. begin
  284. if not assigned(p) then
  285. exit;
  286. hp:=pai(p^.first);
  287. while assigned(hp) do
  288. begin
  289. case hp^.typ of
  290. ait_comment : Begin
  291. AsmWrite(target_asm.comment);
  292. AsmWritePChar(pai_asm_comment(hp)^.str);
  293. AsmLn;
  294. End;
  295. ait_regalloc,
  296. ait_tempalloc : ;
  297. ait_section : begin
  298. if LastSec<>sec_none then
  299. AsmWriteLn('_'+target_asm.secnames[LastSec]+#9#9'ENDS');
  300. if pai_section(hp)^.sec<>sec_none then
  301. begin
  302. AsmLn;
  303. AsmWriteLn('_'+target_asm.secnames[pai_section(hp)^.sec]+#9#9+
  304. 'SEGMENT'#9'PARA PUBLIC USE32 '''+
  305. target_asm.secnames[pai_section(hp)^.sec]+'''');
  306. end;
  307. LastSec:=pai_section(hp)^.sec;
  308. end;
  309. ait_align : begin
  310. { CAUSES PROBLEMS WITH THE SEGMENT DEFINITION }
  311. { SEGMENT DEFINITION SHOULD MATCH TYPE OF ALIGN }
  312. { HERE UNDER TASM! }
  313. AsmWriteLn(#9'ALIGN '+tostr(pai_align(hp)^.aligntype));
  314. end;
  315. ait_datablock : begin
  316. if pai_datablock(hp)^.is_global then
  317. AsmWriteLn(#9'PUBLIC'#9+pai_datablock(hp)^.sym^.name);
  318. AsmWriteLn(PadTabs(pai_datablock(hp)^.sym^.name,#0)+'DB'#9+tostr(pai_datablock(hp)^.size)+' DUP(?)');
  319. end;
  320. ait_const_32bit,
  321. ait_const_8bit,
  322. ait_const_16bit : begin
  323. AsmWrite(ait_const2str[hp^.typ]+tostr(pai_const(hp)^.value));
  324. consttyp:=hp^.typ;
  325. l:=0;
  326. repeat
  327. found:=(not (Pai(hp^.next)=nil)) and (Pai(hp^.next)^.typ=consttyp);
  328. if found then
  329. begin
  330. hp:=Pai(hp^.next);
  331. s:=','+tostr(pai_const(hp)^.value);
  332. AsmWrite(s);
  333. inc(l,length(s));
  334. end;
  335. until (not found) or (l>line_length);
  336. AsmLn;
  337. end;
  338. ait_const_symbol : begin
  339. AsmWriteLn(#9#9'DD'#9'offset '+pai_const_symbol(hp)^.sym^.name);
  340. if pai_const_symbol(hp)^.offset>0 then
  341. AsmWrite('+'+tostr(pai_const_symbol(hp)^.offset))
  342. else if pai_const_symbol(hp)^.offset<0 then
  343. AsmWrite(tostr(pai_const_symbol(hp)^.offset));
  344. AsmLn;
  345. end;
  346. ait_const_rva : begin
  347. AsmWriteLn(#9#9'RVA'#9+pai_const_symbol(hp)^.sym^.name);
  348. end;
  349. ait_real_32bit : AsmWriteLn(#9#9'DD'#9+single2str(pai_real_32bit(hp)^.value));
  350. ait_real_64bit : AsmWriteLn(#9#9'DQ'#9+double2str(pai_real_64bit(hp)^.value));
  351. ait_real_80bit : AsmWriteLn(#9#9'DT'#9+extended2str(pai_real_80bit(hp)^.value));
  352. ait_comp_64bit : AsmWriteLn(#9#9'DQ'#9+comp2str(pai_real_80bit(hp)^.value));
  353. ait_string : begin
  354. counter := 0;
  355. lines := pai_string(hp)^.len div line_length;
  356. { separate lines in different parts }
  357. if pai_string(hp)^.len > 0 then
  358. Begin
  359. for j := 0 to lines-1 do
  360. begin
  361. AsmWrite(#9#9'DB'#9);
  362. quoted:=false;
  363. for i:=counter to counter+line_length do
  364. begin
  365. { it is an ascii character. }
  366. if (ord(pai_string(hp)^.str[i])>31) and
  367. (ord(pai_string(hp)^.str[i])<128) and
  368. (pai_string(hp)^.str[i]<>'"') then
  369. begin
  370. if not(quoted) then
  371. begin
  372. if i>counter then
  373. AsmWrite(',');
  374. AsmWrite('"');
  375. end;
  376. AsmWrite(pai_string(hp)^.str[i]);
  377. quoted:=true;
  378. end { if > 31 and < 128 and ord('"') }
  379. else
  380. begin
  381. if quoted then
  382. AsmWrite('"');
  383. if i>counter then
  384. AsmWrite(',');
  385. quoted:=false;
  386. AsmWrite(tostr(ord(pai_string(hp)^.str[i])));
  387. end;
  388. end; { end for i:=0 to... }
  389. if quoted then AsmWrite('"');
  390. AsmWrite(target_os.newline);
  391. counter := counter+line_length;
  392. end; { end for j:=0 ... }
  393. { do last line of lines }
  394. AsmWrite(#9#9'DB'#9);
  395. quoted:=false;
  396. for i:=counter to pai_string(hp)^.len-1 do
  397. begin
  398. { it is an ascii character. }
  399. if (ord(pai_string(hp)^.str[i])>31) and
  400. (ord(pai_string(hp)^.str[i])<128) and
  401. (pai_string(hp)^.str[i]<>'"') then
  402. begin
  403. if not(quoted) then
  404. begin
  405. if i>counter then
  406. AsmWrite(',');
  407. AsmWrite('"');
  408. end;
  409. AsmWrite(pai_string(hp)^.str[i]);
  410. quoted:=true;
  411. end { if > 31 and < 128 and " }
  412. else
  413. begin
  414. if quoted then
  415. AsmWrite('"');
  416. if i>counter then
  417. AsmWrite(',');
  418. quoted:=false;
  419. AsmWrite(tostr(ord(pai_string(hp)^.str[i])));
  420. end;
  421. end; { end for i:=0 to... }
  422. if quoted then
  423. AsmWrite('"');
  424. end;
  425. AsmLn;
  426. end;
  427. ait_label : begin
  428. if pai_label(hp)^.l^.is_used then
  429. begin
  430. AsmWrite(pai_label(hp)^.l^.name);
  431. if assigned(hp^.next) and not(pai(hp^.next)^.typ in
  432. [ait_const_32bit,ait_const_16bit,ait_const_8bit,
  433. ait_const_symbol,ait_const_rva,
  434. ait_real_32bit,ait_real_64bit,ait_real_80bit,ait_comp_64bit,ait_string]) then
  435. AsmWriteLn(':');
  436. end;
  437. end;
  438. ait_direct : begin
  439. AsmWritePChar(pai_direct(hp)^.str);
  440. AsmLn;
  441. end;
  442. ait_symbol : begin
  443. if pai_symbol(hp)^.is_global then
  444. AsmWriteLn(#9'PUBLIC'#9+pai_symbol(hp)^.sym^.name);
  445. AsmWrite(pai_symbol(hp)^.sym^.name);
  446. if assigned(hp^.next) and not(pai(hp^.next)^.typ in
  447. [ait_const_32bit,ait_const_16bit,ait_const_8bit,
  448. ait_const_symbol,ait_const_rva,
  449. ait_real_32bit,ait_real_64bit,ait_real_80bit,ait_comp_64bit,ait_string]) then
  450. AsmWriteLn(':')
  451. end;
  452. ait_instruction : begin
  453. { We need intel order, no At&t }
  454. pai386(hp)^.SwapOperands;
  455. { Reset }
  456. suffix:='';
  457. prefix:= '';
  458. s:='';
  459. { added prefix instructions, must be on same line as opcode }
  460. if (pai386(hp)^.ops = 0) and
  461. ((pai386(hp)^.opcode = A_REP) or
  462. (pai386(hp)^.opcode = A_LOCK) or
  463. (pai386(hp)^.opcode = A_REPE) or
  464. (pai386(hp)^.opcode = A_REPNZ) or
  465. (pai386(hp)^.opcode = A_REPZ) or
  466. (pai386(hp)^.opcode = A_REPNE)) then
  467. Begin
  468. prefix:=int_op2str[pai386(hp)^.opcode]+#9;
  469. hp:=Pai(hp^.next);
  470. { this is theorically impossible... }
  471. if hp=nil then
  472. begin
  473. s:=#9#9+prefix;
  474. AsmWriteLn(s);
  475. break;
  476. end;
  477. { nasm prefers prefix on a line alone }
  478. AsmWriteln(#9#9+prefix);
  479. prefix:='';
  480. end
  481. else
  482. prefix:= '';
  483. if pai386(hp)^.ops<>0 then
  484. begin
  485. if is_calljmp(pai386(hp)^.opcode) then
  486. s:=#9+getopstr_jmp(pai386(hp)^.oper[0])
  487. else
  488. begin
  489. for i:=0to pai386(hp)^.ops-1 do
  490. begin
  491. if i=0 then
  492. sep:=#9
  493. else
  494. sep:=',';
  495. s:=s+sep+getopstr(pai386(hp)^.oper[i],pai386(hp)^.opsize,pai386(hp)^.opcode,(i=2));
  496. end;
  497. end;
  498. end;
  499. AsmWriteLn(#9#9+prefix+int_op2str[pai386(hp)^.opcode]+cond2str[pai386(hp)^.condition]+suffix+s);
  500. end;
  501. {$ifdef GDB}
  502. ait_stabn,
  503. ait_stabs,
  504. ait_force_line,
  505. ait_stab_function_name : ;
  506. {$endif GDB}
  507. ait_cut : begin
  508. { only reset buffer if nothing has changed }
  509. if AsmSize=AsmStartSize then
  510. AsmClear
  511. else
  512. begin
  513. if LastSec<>sec_none then
  514. AsmWriteLn('_'+target_asm.secnames[LastSec]+#9#9'ENDS');
  515. AsmLn;
  516. AsmWriteLn(#9'END');
  517. AsmClose;
  518. DoAssemble;
  519. if pai_cut(hp)^.EndName then
  520. IsEndFile:=true;
  521. AsmCreate;
  522. end;
  523. { avoid empty files }
  524. while assigned(hp^.next) and (pai(hp^.next)^.typ in [ait_cut,ait_section,ait_comment]) do
  525. begin
  526. if pai(hp^.next)^.typ=ait_section then
  527. begin
  528. lastsec:=pai_section(hp^.next)^.sec;
  529. end;
  530. hp:=pai(hp^.next);
  531. end;
  532. AsmWriteLn(#9'.386p');
  533. AsmWriteLn(#9'LOCALS '+target_asm.labelprefix);
  534. if lastsec<>sec_none then
  535. AsmWriteLn('_'+target_asm.secnames[lastsec]+#9#9+
  536. 'SEGMENT'#9'PARA PUBLIC USE32 '''+
  537. target_asm.secnames[lastsec]+'''');
  538. AsmStartSize:=AsmSize;
  539. end;
  540. ait_marker: ;
  541. else
  542. internalerror(10000);
  543. end;
  544. hp:=pai(hp^.next);
  545. end;
  546. end;
  547. var
  548. currentasmlist : PAsmList;
  549. procedure writeexternal(p:pasmsymbol);{$ifndef FPC}far;{$endif}
  550. begin
  551. if p^.typ=AS_EXTERNAL then
  552. currentasmlist^.AsmWriteln(#9'EXTRN'#9+p^.name);
  553. end;
  554. procedure ti386intasmlist.WriteExternals;
  555. begin
  556. currentasmlist:=@self;
  557. AsmSymbolList^.foreach({$ifndef TP}@{$endif}writeexternal);
  558. end;
  559. procedure ti386intasmlist.WriteAsmList;
  560. begin
  561. {$ifdef EXTDEBUG}
  562. if assigned(current_module^.mainsource) then
  563. comment(v_info,'Start writing intel-styled assembler output for '+current_module^.mainsource^);
  564. {$endif}
  565. LastSec:=sec_none;
  566. AsmWriteLn(#9'.386p');
  567. AsmWriteLn(#9'LOCALS '+target_asm.labelprefix);
  568. AsmWriteLn('DGROUP'#9'GROUP'#9'_BSS,_DATA');
  569. AsmWriteLn(#9'ASSUME'#9'CS:_CODE,ES:DGROUP,DS:DGROUP,SS:DGROUP');
  570. AsmLn;
  571. countlabelref:=false;
  572. WriteExternals;
  573. { INTEL ASM doesn't support stabs
  574. WriteTree(debuglist);}
  575. WriteTree(codesegment);
  576. WriteTree(datasegment);
  577. WriteTree(consts);
  578. WriteTree(rttilist);
  579. WriteTree(bsssegment);
  580. countlabelref:=true;
  581. AsmWriteLn(#9'END');
  582. AsmLn;
  583. {$ifdef EXTDEBUG}
  584. if assigned(current_module^.mainsource) then
  585. comment(v_info,'Done writing intel-styled assembler output for '+current_module^.mainsource^);
  586. {$endif EXTDEBUG}
  587. end;
  588. end.
  589. {
  590. $Log$
  591. Revision 1.47 1999-06-02 22:44:01 pierre
  592. * previous wrong log corrected
  593. Revision 1.46 1999/06/02 22:25:26 pierre
  594. * changed $ifdef FPC @ into $ifndef TP
  595. Revision 1.45 1999/06/01 14:45:43 peter
  596. * @procvar is now always needed for FPC
  597. Revision 1.44 1999/05/27 19:44:00 peter
  598. * removed oldasm
  599. * plabel -> pasmlabel
  600. * -a switches to source writing automaticly
  601. * assembler readers OOPed
  602. * asmsymbol automaticly external
  603. * jumptables and other label fixes for asm readers
  604. Revision 1.43 1999/05/23 18:41:55 florian
  605. * better error recovering in typed constants
  606. * some problems with arrays of const fixed, some problems
  607. due my previous
  608. - the location type of array constructor is now LOC_MEM
  609. - the pushing of high fixed
  610. - parameter copying fixed
  611. - zero temp. allocation removed
  612. * small problem in the assembler writers fixed:
  613. ref to nil wasn't written correctly
  614. Revision 1.42 1999/05/21 13:54:42 peter
  615. * NEWLAB for label as symbol
  616. Revision 1.41 1999/05/12 00:19:38 peter
  617. * removed R_DEFAULT_SEG
  618. * uniform float names
  619. Revision 1.40 1999/05/10 15:18:14 peter
  620. * fixed condition writing
  621. Revision 1.39 1999/05/08 19:52:33 peter
  622. + MessagePos() which is enhanced Message() function but also gets the
  623. position info
  624. * Removed comp warnings
  625. Revision 1.38 1999/05/07 00:08:49 pierre
  626. * AG386BIN cond -> OLDASM, only cosmetic
  627. Revision 1.37 1999/05/06 09:05:09 peter
  628. * generic write_float and str_float
  629. * fixed constant float conversions
  630. Revision 1.36 1999/05/04 21:44:31 florian
  631. * changes to compile it with Delphi 4.0
  632. Revision 1.35 1999/05/02 22:41:49 peter
  633. * moved section names to systems
  634. * fixed nasm,intel writer
  635. Revision 1.34 1999/05/01 13:23:58 peter
  636. * merged nasm compiler
  637. * old asm moved to oldasm/
  638. Revision 1.33 1999/04/17 22:17:05 pierre
  639. * ifdef USE_OP3 released (changed into ifndef NO_OP3)
  640. * SHRD and SHLD first operand (ATT syntax) can only be CL reg or immediate const
  641. Revision 1.32 1999/04/16 11:49:39 peter
  642. + tempalloc
  643. + -at to show temp alloc info in .s file
  644. Revision 1.31 1999/04/16 10:00:55 pierre
  645. + ifdef USE_OP3 code :
  646. added all missing op_... constructors for tai386 needed
  647. for SHRD,SHLD and IMUL code in assembler readers
  648. (check in tests/tbs0123.pp)
  649. Revision 1.30 1999/03/29 16:05:43 peter
  650. * optimizer working for ag386bin
  651. Revision 1.29 1999/03/02 02:56:10 peter
  652. + stabs support for binary writers
  653. * more fixes and missing updates from the previous commit :(
  654. Revision 1.28 1999/03/01 15:46:16 peter
  655. * ag386bin finally make cycles correct
  656. * prefixes are now also normal opcodes
  657. Revision 1.27 1999/02/26 00:48:13 peter
  658. * assembler writers fixed for ag386bin
  659. Revision 1.26 1999/02/25 21:02:18 peter
  660. * ag386bin updates
  661. + coff writer
  662. Revision 1.25 1999/02/22 02:14:59 peter
  663. * updates for ag386bin
  664. Revision 1.24 1998/12/20 16:21:22 peter
  665. * smartlinking doesn't crash anymore
  666. Revision 1.23 1998/12/16 00:27:17 peter
  667. * removed some obsolete version checks
  668. Revision 1.22 1998/12/01 11:19:38 peter
  669. * fixed range problem with in [tasmop]
  670. Revision 1.21 1998/11/30 09:42:55 pierre
  671. * some range check bugs fixed (still not working !)
  672. + added DLL writing support for win32 (also accepts variables)
  673. + TempAnsi for code that could be used for Temporary ansi strings
  674. handling
  675. Revision 1.20 1998/11/17 00:26:09 peter
  676. * fixed for $H+
  677. Revision 1.19 1998/11/16 12:38:05 jonas
  678. + readded ait_marker support
  679. Revision 1.18 1998/11/12 11:19:33 pierre
  680. * fix for first line of function break
  681. Revision 1.17 1998/10/12 12:20:40 pierre
  682. + added tai_const_symbol_offset
  683. for r : pointer = @var.field;
  684. * better message for different arg names on implementation
  685. of function
  686. Revision 1.16 1998/10/06 17:16:33 pierre
  687. * some memory leaks fixed (thanks to Peter for heaptrc !)
  688. Revision 1.15 1998/10/01 20:19:06 jonas
  689. + ait_marker support
  690. Revision 1.14 1998/09/20 17:11:21 jonas
  691. * released REGALLOC
  692. Revision 1.13 1998/08/10 15:49:38 peter
  693. * small fixes for 0.99.5
  694. Revision 1.12 1998/08/08 10:19:17 florian
  695. * small fixes to write the extended type correct
  696. Revision 1.11 1998/06/05 17:46:02 peter
  697. * tp doesn't like comp() typecast
  698. Revision 1.10 1998/05/25 17:11:36 pierre
  699. * firstpasscount bug fixed
  700. now all is already set correctly the first time
  701. under EXTDEBUG try -gp to skip all other firstpasses
  702. it works !!
  703. * small bug fixes
  704. - for smallsets with -dTESTSMALLSET
  705. - some warnings removed (by correcting code !)
  706. Revision 1.9 1998/05/23 01:20:55 peter
  707. + aktasmmode, aktoptprocessor, aktoutputformat
  708. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  709. + $LIBNAME to set the library name where the unit will be put in
  710. * splitted cgi386 a bit (codeseg to large for bp7)
  711. * nasm, tasm works again. nasm moved to ag386nsm.pas
  712. Revision 1.8 1998/05/06 18:36:53 peter
  713. * tai_section extended with code,data,bss sections and enumerated type
  714. * ident 'compiled by FPC' moved to pmodules
  715. * small fix for smartlink
  716. Revision 1.7 1998/05/06 08:38:32 pierre
  717. * better position info with UseTokenInfo
  718. UseTokenInfo greatly simplified
  719. + added check for changed tree after first time firstpass
  720. (if we could remove all the cases were it happen
  721. we could skip all firstpass if firstpasscount > 1)
  722. Only with ExtDebug
  723. Revision 1.6 1998/05/04 17:54:24 peter
  724. + smartlinking works (only case jumptable left todo)
  725. * redesign of systems.pas to support assemblers and linkers
  726. + Unitname is now also in the PPU-file, increased version to 14
  727. Revision 1.5 1998/05/01 07:43:52 florian
  728. + basics for rtti implemented
  729. + switch $m (generate rtti for published sections)
  730. Revision 1.4 1998/04/29 10:33:41 pierre
  731. + added some code for ansistring (not complete nor working yet)
  732. * corrected operator overloading
  733. * corrected nasm output
  734. + started inline procedures
  735. + added starstarn : use ** for exponentiation (^ gave problems)
  736. + started UseTokenInfo cond to get accurate positions
  737. Revision 1.3 1998/04/08 16:58:01 pierre
  738. * several bugfixes
  739. ADD ADC and AND are also sign extended
  740. nasm output OK (program still crashes at end
  741. and creates wrong assembler files !!)
  742. procsym types sym in tdef removed !!
  743. Revision 1.2 1998/04/08 11:34:17 peter
  744. * nasm works (linux only tested)
  745. }