ra386.pas 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 by Carl Eric Codere and Peter Vreman
  4. Handles the common i386 assembler reader routines
  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 Ra386;
  19. {$i defines.inc}
  20. interface
  21. uses
  22. aasm,cpubase,RAUtils;
  23. { Parser helpers }
  24. function is_prefix(t:tasmop):boolean;
  25. function is_override(t:tasmop):boolean;
  26. Function CheckPrefix(prefixop,op:tasmop): Boolean;
  27. Function CheckOverride(overrideop,op:tasmop): Boolean;
  28. Procedure FWaitWarning;
  29. type
  30. T386Operand=class(TOperand)
  31. Procedure SetCorrectSize(opcode:tasmop);override;
  32. Function SetupResult : boolean;override;
  33. end;
  34. T386Instruction=class(TInstruction)
  35. { Operand sizes }
  36. procedure AddReferenceSizes;
  37. procedure SetInstructionOpsize;
  38. procedure CheckOperandSizes;
  39. procedure CheckNonCommutativeOpcodes;
  40. { opcode adding }
  41. procedure ConcatInstruction(p : taasmoutput);override;
  42. end;
  43. implementation
  44. uses
  45. {$ifdef NEWCG}
  46. cgbase,
  47. {$else}
  48. hcodegen,
  49. {$endif}
  50. globtype,symconst,symdef,systems,types,globals,verbose,cpuasm;
  51. {$define ATTOP}
  52. {$define INTELOP}
  53. {$ifdef NORA386INT}
  54. {$ifdef NOAG386NSM}
  55. {$ifdef NOAG386INT}
  56. {$undef INTELOP}
  57. {$endif}
  58. {$endif}
  59. {$endif}
  60. {$ifdef NORA386ATT}
  61. {$ifdef NOAG386ATT}
  62. {$undef ATTOP}
  63. {$endif}
  64. {$endif}
  65. {*****************************************************************************
  66. Parser Helpers
  67. *****************************************************************************}
  68. function is_prefix(t:tasmop):boolean;
  69. var
  70. i : longint;
  71. Begin
  72. is_prefix:=false;
  73. for i:=1 to AsmPrefixes do
  74. if t=AsmPrefix[i-1] then
  75. begin
  76. is_prefix:=true;
  77. exit;
  78. end;
  79. end;
  80. function is_override(t:tasmop):boolean;
  81. var
  82. i : longint;
  83. Begin
  84. is_override:=false;
  85. for i:=1 to AsmOverrides do
  86. if t=AsmOverride[i-1] then
  87. begin
  88. is_override:=true;
  89. exit;
  90. end;
  91. end;
  92. Function CheckPrefix(prefixop,op:tasmop): Boolean;
  93. { Checks if the prefix is valid with the following opcode }
  94. { return false if not, otherwise true }
  95. Begin
  96. CheckPrefix := TRUE;
  97. (* Case prefix of
  98. A_REP,A_REPNE,A_REPE:
  99. Case opcode Of
  100. A_SCASB,A_SCASW,A_SCASD,
  101. A_INS,A_OUTS,A_MOVS,A_CMPS,A_LODS,A_STOS:;
  102. Else
  103. Begin
  104. CheckPrefix := FALSE;
  105. exit;
  106. end;
  107. end; { case }
  108. A_LOCK:
  109. Case opcode Of
  110. A_BT,A_BTS,A_BTR,A_BTC,A_XCHG,A_ADD,A_OR,A_ADC,A_SBB,A_AND,A_SUB,
  111. A_XOR,A_NOT,A_NEG,A_INC,A_DEC:;
  112. Else
  113. Begin
  114. CheckPrefix := FALSE;
  115. Exit;
  116. end;
  117. end; { case }
  118. A_NONE: exit; { no prefix here }
  119. else
  120. CheckPrefix := FALSE;
  121. end; { end case } *)
  122. end;
  123. Function CheckOverride(overrideop,op:tasmop): Boolean;
  124. { Check if the override is valid, and if so then }
  125. { update the instr variable accordingly. }
  126. Begin
  127. CheckOverride := true;
  128. { Case instr.getinstruction of
  129. A_MOVS,A_XLAT,A_CMPS:
  130. Begin
  131. CheckOverride := TRUE;
  132. Message(assem_e_segment_override_not_supported);
  133. end
  134. end }
  135. end;
  136. Procedure FWaitWarning;
  137. begin
  138. if (target_info.target=target_i386_GO32V2) and (cs_fp_emulation in aktmoduleswitches) then
  139. Message(asmr_w_fwait_emu_prob);
  140. end;
  141. {*****************************************************************************
  142. T386Operand
  143. *****************************************************************************}
  144. Procedure T386Operand.SetCorrectSize(opcode:tasmop);
  145. begin
  146. if att_needsuffix[opcode]=attsufFPU then
  147. begin
  148. case size of
  149. S_L : size:=S_FS;
  150. S_IQ : size:=S_FL;
  151. end;
  152. end
  153. else if att_needsuffix[opcode]=attsufFPUint then
  154. begin
  155. case size of
  156. S_W : size:=S_IS;
  157. S_L : size:=S_IL;
  158. end;
  159. end;
  160. end;
  161. Function T386Operand.SetupResult:boolean;
  162. var
  163. Res : boolean;
  164. Begin
  165. Res:=inherited setupResult;
  166. { replace by ref by register if not place was
  167. reserved on stack }
  168. if res and (procinfo^.return_offset=0) then
  169. begin
  170. opr.typ:=OPR_REGISTER;
  171. if is_fpu(procinfo^.returntype.def) then
  172. begin
  173. opr.reg:=R_ST0;
  174. case tfloatdef(procinfo^.returntype.def).typ of
  175. s32real : size:=S_FS;
  176. s64real : size:=S_FL;
  177. s80real : size:=S_FX;
  178. s64comp : size:=S_IQ;
  179. else
  180. begin
  181. Message(asmr_e_cannot_use_RESULT_here);
  182. res:=false;
  183. end;
  184. end;
  185. end
  186. else if ret_in_acc(procinfo^.returntype.def) then
  187. case procinfo^.returntype.def.size of
  188. 1 : begin
  189. opr.reg:=R_AL;
  190. size:=S_B;
  191. end;
  192. 2 : begin
  193. opr.reg:=R_AX;
  194. size:=S_W;
  195. end;
  196. 3,4 : begin
  197. opr.reg:=R_EAX;
  198. size:=S_L;
  199. end;
  200. else
  201. begin
  202. Message(asmr_e_cannot_use_RESULT_here);
  203. res:=false;
  204. end;
  205. end;
  206. Message1(asmr_h_RESULT_is_reg,reg2str(opr.reg));
  207. end;
  208. SetupResult:=res;
  209. end;
  210. {*****************************************************************************
  211. T386Instruction
  212. *****************************************************************************}
  213. procedure T386Instruction.AddReferenceSizes;
  214. { this will add the sizes for references like [esi] which do not
  215. have the size set yet, it will take only the size if the other
  216. operand is a register }
  217. var
  218. operand2,i : longint;
  219. s : tasmsymbol;
  220. so : longint;
  221. begin
  222. for i:=1to ops do
  223. begin
  224. operands[i].SetCorrectSize(opcode);
  225. if (operands[i].size=S_NO) then
  226. begin
  227. case operands[i].Opr.Typ of
  228. OPR_REFERENCE :
  229. begin
  230. if i=2 then
  231. operand2:=1
  232. else
  233. operand2:=2;
  234. if operand2<ops then
  235. begin
  236. { Only allow register as operand to take the size from }
  237. if operands[operand2].opr.typ=OPR_REGISTER then
  238. begin
  239. if ((opcode<>A_MOVD) and
  240. (opcode<>A_CVTSI2SS)) then
  241. operands[i].size:=operands[operand2].size;
  242. end
  243. else
  244. begin
  245. { if no register then take the opsize (which is available with ATT),
  246. if not availble then give an error }
  247. if opsize<>S_NO then
  248. operands[i].size:=opsize
  249. else
  250. begin
  251. Message(asmr_e_unable_to_determine_reference_size);
  252. { recovery }
  253. operands[i].size:=S_L;
  254. end;
  255. end;
  256. end
  257. else
  258. begin
  259. if opsize<>S_NO then
  260. operands[i].size:=opsize
  261. end;
  262. end;
  263. OPR_SYMBOL :
  264. begin
  265. { Fix lea which need a reference }
  266. if opcode=A_LEA then
  267. begin
  268. s:=operands[i].opr.symbol;
  269. so:=operands[i].opr.symofs;
  270. operands[i].opr.typ:=OPR_REFERENCE;
  271. reset_reference(operands[i].opr.ref);
  272. operands[i].opr.ref.symbol:=s;
  273. operands[i].opr.ref.offset:=so;
  274. end;
  275. operands[i].size:=S_L;
  276. end;
  277. end;
  278. end;
  279. end;
  280. end;
  281. procedure T386Instruction.SetInstructionOpsize;
  282. begin
  283. if opsize<>S_NO then
  284. exit;
  285. case ops of
  286. 0 : ;
  287. 1 :
  288. { "push es" must be stored as a long PM }
  289. if ((opcode=A_PUSH) or
  290. (opcode=A_POP)) and
  291. (operands[1].opr.typ=OPR_REGISTER) and
  292. ((operands[1].opr.reg>=firstsreg) and
  293. (operands[1].opr.reg<=lastsreg)) then
  294. opsize:=S_L
  295. else
  296. opsize:=operands[1].size;
  297. 2 :
  298. begin
  299. case opcode of
  300. A_MOVZX,A_MOVSX :
  301. begin
  302. case operands[1].size of
  303. S_W :
  304. case operands[2].size of
  305. S_L :
  306. opsize:=S_WL;
  307. end;
  308. S_B :
  309. case operands[2].size of
  310. S_W :
  311. opsize:=S_BW;
  312. S_L :
  313. opsize:=S_BL;
  314. end;
  315. end;
  316. end;
  317. A_MOVD : { movd is a move from a mmx register to a
  318. 32 bit register or memory, so no opsize is correct here PM }
  319. exit;
  320. A_OUT :
  321. opsize:=operands[1].size;
  322. else
  323. opsize:=operands[2].size;
  324. end;
  325. end;
  326. 3 :
  327. opsize:=operands[3].size;
  328. end;
  329. end;
  330. procedure T386Instruction.CheckOperandSizes;
  331. var
  332. sizeerr : boolean;
  333. i : longint;
  334. begin
  335. { Check only the most common opcodes here, the others are done in
  336. the assembler pass }
  337. { movd also added as it needs special care here PM }
  338. case opcode of
  339. A_PUSH,A_POP,A_DEC,A_INC,A_NOT,A_NEG,
  340. A_CMP,A_MOV,A_MOVD,
  341. A_ADD,A_SUB,A_ADC,A_SBB,
  342. A_AND,A_OR,A_TEST,A_XOR: ;
  343. else
  344. exit;
  345. end;
  346. { Handle the BW,BL,WL separatly }
  347. sizeerr:=false;
  348. { special push/pop selector case }
  349. if ((opcode=A_PUSH) or
  350. (opcode=A_POP)) and
  351. (operands[1].opr.typ=OPR_REGISTER) and
  352. ((operands[1].opr.reg>=firstsreg) and
  353. (operands[1].opr.reg<=lastsreg)) then
  354. exit;
  355. if opsize in [S_BW,S_BL,S_WL] then
  356. begin
  357. if ops<>2 then
  358. sizeerr:=true
  359. else
  360. begin
  361. case opsize of
  362. S_BW :
  363. sizeerr:=(operands[1].size<>S_B) or (operands[2].size<>S_W);
  364. S_BL :
  365. sizeerr:=(operands[1].size<>S_B) or (operands[2].size<>S_L);
  366. S_WL :
  367. sizeerr:=(operands[1].size<>S_W) or (operands[2].size<>S_L);
  368. end;
  369. end;
  370. end
  371. else
  372. begin
  373. for i:=1 to ops do
  374. begin
  375. if (operands[i].opr.typ<>OPR_CONSTANT) and
  376. (operands[i].size in [S_B,S_W,S_L]) and
  377. (operands[i].size<>opsize) then
  378. sizeerr:=true;
  379. end;
  380. end;
  381. if sizeerr then
  382. begin
  383. { if range checks are on then generate an error }
  384. if (cs_compilesystem in aktmoduleswitches) or
  385. not (cs_check_range in aktlocalswitches) then
  386. Message(asmr_w_size_suffix_and_dest_dont_match)
  387. else
  388. Message(asmr_e_size_suffix_and_dest_dont_match);
  389. end;
  390. end;
  391. { This check must be done with the operand in ATT order
  392. i.e.after swapping in the intel reader
  393. but before swapping in the NASM and TASM writers PM }
  394. procedure T386Instruction.CheckNonCommutativeOpcodes;
  395. begin
  396. if ((ops=2) and
  397. (operands[1].opr.typ=OPR_REGISTER) and
  398. (operands[2].opr.typ=OPR_REGISTER) and
  399. { if the first is ST and the second is also a register
  400. it is necessarily ST1 .. ST7 }
  401. (operands[1].opr.reg=R_ST)) or
  402. (ops=0) then
  403. if opcode=A_FSUBR then
  404. opcode:=A_FSUB
  405. else if opcode=A_FSUB then
  406. opcode:=A_FSUBR
  407. else if opcode=A_FDIVR then
  408. opcode:=A_FDIV
  409. else if opcode=A_FDIV then
  410. opcode:=A_FDIVR
  411. else if opcode=A_FSUBRP then
  412. opcode:=A_FSUBP
  413. else if opcode=A_FSUBP then
  414. opcode:=A_FSUBRP
  415. else if opcode=A_FDIVRP then
  416. opcode:=A_FDIVP
  417. else if opcode=A_FDIVP then
  418. opcode:=A_FDIVRP;
  419. if ((ops=1) and
  420. (operands[1].opr.typ=OPR_REGISTER) and
  421. (operands[1].opr.reg in [R_ST1..R_ST7])) then
  422. if opcode=A_FSUBRP then
  423. opcode:=A_FSUBP
  424. else if opcode=A_FSUBP then
  425. opcode:=A_FSUBRP
  426. else if opcode=A_FDIVRP then
  427. opcode:=A_FDIVP
  428. else if opcode=A_FDIVP then
  429. opcode:=A_FDIVRP;
  430. end;
  431. {*****************************************************************************
  432. opcode Adding
  433. *****************************************************************************}
  434. procedure T386Instruction.ConcatInstruction(p : taasmoutput);
  435. var
  436. siz : topsize;
  437. i,asize : longint;
  438. ai : taicpu;
  439. begin
  440. { Get Opsize }
  441. if (opsize<>S_NO) or (Ops=0) then
  442. siz:=opsize
  443. else
  444. begin
  445. if (Ops=2) and (operands[1].opr.typ=OPR_REGISTER) then
  446. siz:=operands[1].size
  447. else
  448. siz:=operands[Ops].size;
  449. { MOVD should be of size S_LQ or S_QL, but these do not exist PM }
  450. if (ops=2) and (operands[1].size<>S_NO) and
  451. (operands[2].size<>S_NO) and (operands[1].size<>operands[2].size) then
  452. siz:=S_NO;
  453. end;
  454. if ((opcode=A_MOVD)or
  455. (opcode=A_CVTSI2SS)) and
  456. ((operands[1].size=S_NO) or
  457. (operands[2].size=S_NO)) then
  458. siz:=S_NO;
  459. { NASM does not support FADD without args
  460. as alias of FADDP
  461. and GNU AS interprets FADD without operand differently
  462. for version 2.9.1 and 2.9.5 !! }
  463. if (ops=0) and
  464. ((opcode=A_FADD) or
  465. (opcode=A_FMUL) or
  466. (opcode=A_FSUB) or
  467. (opcode=A_FSUBR) or
  468. (opcode=A_FDIV) or
  469. (opcode=A_FDIVR)) then
  470. begin
  471. if opcode=A_FADD then
  472. opcode:=A_FADDP
  473. else if opcode=A_FMUL then
  474. opcode:=A_FMULP
  475. else if opcode=A_FSUB then
  476. opcode:=A_FSUBP
  477. else if opcode=A_FSUBR then
  478. opcode:=A_FSUBRP
  479. else if opcode=A_FDIV then
  480. opcode:=A_FDIVP
  481. else if opcode=A_FDIVR then
  482. opcode:=A_FDIVRP;
  483. {$ifdef ATTOP}
  484. message1(asmr_w_fadd_to_faddp,att_op2str[opcode]);
  485. {$else}
  486. {$ifdef INTELOP}
  487. message1(asmr_w_fadd_to_faddp,int_op2str[opcode]);
  488. {$else}
  489. message1(asmr_w_fadd_to_faddp,'fXX');
  490. {$endif INTELOP}
  491. {$endif ATTOP}
  492. end;
  493. { GNU AS interprets FDIV without operand differently
  494. for version 2.9.1 and 2.10
  495. we add explicit args to it !! }
  496. if (ops=0) and
  497. ((opcode=A_FSUBP) or
  498. (opcode=A_FSUBRP) or
  499. (opcode=A_FDIVP) or
  500. (opcode=A_FDIVRP) or
  501. (opcode=A_FSUB) or
  502. (opcode=A_FSUBR) or
  503. (opcode=A_FDIV) or
  504. (opcode=A_FDIVR)) then
  505. begin
  506. {$ifdef ATTOP}
  507. message1(asmr_w_adding_explicit_args_fXX,att_op2str[opcode]);
  508. {$else}
  509. {$ifdef INTELOP}
  510. message1(asmr_w_adding_explicit_args_fXX,int_op2str[opcode]);
  511. {$else}
  512. message1(asmr_w_adding_explicit_args_fXX,'fXX');
  513. {$endif INTELOP}
  514. {$endif ATTOP}
  515. ops:=2;
  516. operands[1].opr.typ:=OPR_REGISTER;
  517. operands[2].opr.typ:=OPR_REGISTER;
  518. operands[1].opr.reg:=R_ST;
  519. operands[2].opr.reg:=R_ST1;
  520. end;
  521. if (ops=1) and
  522. ((operands[1].opr.typ=OPR_REGISTER) and
  523. (operands[1].opr.reg in [R_ST1..R_ST7])) and
  524. ((opcode=A_FSUBP) or
  525. (opcode=A_FSUBRP) or
  526. (opcode=A_FDIVP) or
  527. (opcode=A_FDIVRP) or
  528. (opcode=A_FADDP) or
  529. (opcode=A_FMULP)) then
  530. begin
  531. {$ifdef ATTOP}
  532. message1(asmr_w_adding_explicit_first_arg_fXX,att_op2str[opcode]);
  533. {$else}
  534. {$ifdef INTELOP}
  535. message1(asmr_w_adding_explicit_first_arg_fXX,int_op2str[opcode]);
  536. {$else}
  537. message1(asmr_w_adding_explicit_first_arg_fXX,'fXX');
  538. {$endif INTELOP}
  539. {$endif ATTOP}
  540. ops:=2;
  541. operands[2].opr.typ:=OPR_REGISTER;
  542. operands[2].opr.reg:=operands[1].opr.reg;
  543. operands[1].opr.reg:=R_ST;
  544. end;
  545. if (ops=1) and
  546. ((operands[1].opr.typ=OPR_REGISTER) and
  547. (operands[1].opr.reg in [R_ST1..R_ST7])) and
  548. ((opcode=A_FSUB) or
  549. (opcode=A_FSUBR) or
  550. (opcode=A_FDIV) or
  551. (opcode=A_FDIVR) or
  552. (opcode=A_FADD) or
  553. (opcode=A_FMUL)) then
  554. begin
  555. {$ifdef ATTOP}
  556. message1(asmr_w_adding_explicit_second_arg_fXX,att_op2str[opcode]);
  557. {$else}
  558. {$ifdef INTELOP}
  559. message1(asmr_w_adding_explicit_second_arg_fXX,int_op2str[opcode]);
  560. {$else}
  561. message1(asmr_w_adding_explicit_second_arg_fXX,'fXX');
  562. {$endif INTELOP}
  563. {$endif ATTOP}
  564. ops:=2;
  565. operands[2].opr.typ:=OPR_REGISTER;
  566. operands[2].opr.reg:=R_ST;
  567. end;
  568. { I tried to convince Linus Torwald to add
  569. code to support ENTER instruction
  570. (when raising a stack page fault)
  571. but he replied that ENTER is a bad instruction and
  572. Linux does not need to support it
  573. So I think its at least a good idea to add a warning
  574. if someone uses this in assembler code
  575. FPC itself does not use it at all PM }
  576. if (opcode=A_ENTER) and ((target_info.target=target_i386_linux) or
  577. (target_info.target=target_i386_FreeBSD)) then
  578. begin
  579. message(asmr_w_enter_not_supported_by_linux);
  580. end;
  581. ai:=taicpu.op_none(opcode,siz);
  582. ai.Ops:=Ops;
  583. for i:=1to Ops do
  584. begin
  585. case operands[i].opr.typ of
  586. OPR_CONSTANT :
  587. ai.loadconst(i-1,operands[i].opr.val);
  588. OPR_REGISTER:
  589. ai.loadreg(i-1,operands[i].opr.reg);
  590. OPR_SYMBOL:
  591. ai.loadsymbol(i-1,operands[i].opr.symbol,operands[i].opr.symofs);
  592. OPR_REFERENCE:
  593. begin
  594. ai.loadref(i-1,newreference(operands[i].opr.ref));
  595. if operands[i].size<>S_NO then
  596. begin
  597. asize:=0;
  598. case operands[i].size of
  599. S_B :
  600. asize:=OT_BITS8;
  601. S_W, S_IS :
  602. asize:=OT_BITS16;
  603. S_L, S_IL, S_FS:
  604. asize:=OT_BITS32;
  605. S_Q, S_D, S_FL, S_FV :
  606. asize:=OT_BITS64;
  607. S_FX :
  608. asize:=OT_BITS80;
  609. end;
  610. if asize<>0 then
  611. ai.oper[i-1].ot:=(ai.oper[i-1].ot and not OT_SIZE_MASK) or asize;
  612. end;
  613. end;
  614. end;
  615. end;
  616. if (opcode=A_CALL) and (opsize=S_FAR) then
  617. opcode:=A_LCALL;
  618. if (opcode=A_JMP) and (opsize=S_FAR) then
  619. opcode:=A_LJMP;
  620. if (opcode=A_LCALL) or (opcode=A_LJMP) then
  621. opsize:=S_FAR;
  622. { Condition ? }
  623. if condition<>C_None then
  624. ai.SetCondition(condition);
  625. { Concat the opcode or give an error }
  626. if assigned(ai) then
  627. begin
  628. { Check the instruction if it's valid }
  629. {$ifndef NOAG386BIN}
  630. ai.CheckIfValid;
  631. {$endif NOAG386BIN}
  632. p.concat(ai);
  633. end
  634. else
  635. Message(asmr_e_invalid_opcode_and_operand);
  636. end;
  637. end.
  638. {
  639. $Log$
  640. Revision 1.9 2001-04-13 01:22:19 peter
  641. * symtable change to classes
  642. * range check generation and errors fixed, make cycle DEBUG=1 works
  643. * memory leaks fixed
  644. Revision 1.8 2001/04/05 21:33:45 peter
  645. * movd and opsize fix merged
  646. Revision 1.7 2001/03/05 21:49:44 peter
  647. * noag386bin fix
  648. Revision 1.6 2001/02/20 21:51:36 peter
  649. * fpu fixes (merged)
  650. Revision 1.5 2001/01/12 19:18:42 peter
  651. * check for valid asm instructions
  652. Revision 1.4 2000/12/25 00:07:34 peter
  653. + new tlinkedlist class (merge of old tstringqueue,tcontainer and
  654. tlinkedlist objects)
  655. Revision 1.3 2000/11/29 00:30:50 florian
  656. * unused units removed from uses clause
  657. * some changes for widestrings
  658. Revision 1.2 2000/10/31 22:30:14 peter
  659. * merged asm result patch part 2
  660. Revision 1.1 2000/10/15 09:47:43 peter
  661. * moved to i386/
  662. Revision 1.7 2000/10/08 10:26:33 peter
  663. * merged @result fix from Pierre
  664. Revision 1.6 2000/09/24 21:33:47 peter
  665. * message updates merges
  666. Revision 1.5 2000/09/24 15:06:25 peter
  667. * use defines.inc
  668. Revision 1.4 2000/09/16 12:22:52 peter
  669. * freebsd support merged
  670. Revision 1.3 2000/09/03 11:44:00 peter
  671. * error for not specified operand size, which is now required for
  672. newer binutils (merged)
  673. * previous commit fix for tcflw (merged)
  674. Revision 1.2 2000/07/13 11:32:47 michael
  675. + removed logs
  676. }