EM_table 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110
  1. #define PUSH_POP_OPT TRUE
  2. /******************************************************************************/
  3. /* */
  4. /* Group 1 : load instructions */
  5. /* */
  6. /******************************************************************************/
  7. C_loc ==> "push $1".
  8. C_lol ==> "push $1(ebp)".
  9. C_loe.. ==> "push ($1+$2)".
  10. C_lil ==> "mov eax, $1(ebp)";
  11. "push (eax)".
  12. C_lof ==> "pop eax";
  13. "push $1(eax)".
  14. C_lal ==> "lea eax, $1(ebp)";
  15. "push eax".
  16. C_lae.. ==> "push $1+$2".
  17. C_lxl
  18. $1 == 0 ==> "push ebp".
  19. $1 == 1 ==> "push 8(ebp)".
  20. default ==> "mov ecx, $1-1";
  21. "mov eax, 8(ebp)";
  22. "1: mov eax, 8(eax)";
  23. "loop 1b";
  24. "push eax".
  25. C_lxa
  26. $1 == 0 ==> "lea eax, 8(ebp)";
  27. "push eax".
  28. $1 == 1 ==> "mov eax, 8(ebp)";
  29. "add eax, 8";
  30. "push eax".
  31. default ==> "mov ecx, $1-1";
  32. "mov eax, 8(ebp)";
  33. "1: mov eax, 8(eax)";
  34. "loop 1b";
  35. "add eax, 8";
  36. "push eax".
  37. C_loi
  38. $1 == 1 ==> "pop ecx";
  39. "movzxb eax, (ecx)";
  40. "push eax".
  41. $1 == 2 ==> "pop ecx";
  42. "movzx eax, (ecx)";
  43. "push eax".
  44. $1 == 4 ==> "pop eax";
  45. "push (eax)".
  46. default ==> "pop ebx";
  47. "mov ecx, $1";
  48. "call .loi".
  49. C_los
  50. $1 == 4 ==> "pop ecx";
  51. "pop ebx";
  52. "call .los".
  53. default ==> arg_error( "C_los", $1).
  54. C_los_narg ==> "pop eax";
  55. "cmp eax, 4";
  56. "jne .unknown";
  57. "pop ecx";
  58. "pop ebx";
  59. "call .los".
  60. C_ldl ==> "push $1+4(ebp)";
  61. "push $1(ebp)".
  62. C_lde.. ==> "push ($1+$2+4)";
  63. "push ($1+$2)".
  64. C_ldf ==> "pop eax";
  65. "push $1+4(eax)";
  66. "push $1(eax)".
  67. C_lpi ==> "push $1".
  68. /******************************************************************************/
  69. /* */
  70. /* Group 2 : store instructions */
  71. /* */
  72. /******************************************************************************/
  73. C_stl ==> "pop $1(ebp)".
  74. C_ste.. ==> "pop ($1+$2)".
  75. C_sil ==> "mov eax, $1(ebp)";
  76. "pop (eax)".
  77. C_stf ==> "pop eax";
  78. "pop $1(eax)".
  79. C_sti
  80. $1 == 1 ==> "pop ecx";
  81. "pop eax";
  82. "movb (ecx), al".
  83. $1 == 2 ==> "pop eax";
  84. "pop ecx";
  85. "movw (eax),ecx".
  86. $1 == 4 ==> "pop eax";
  87. "pop (eax)".
  88. default ==> "pop ebx";
  89. "mov ecx, $1";
  90. "call .sti".
  91. C_sts
  92. $1 == 4 ==> "pop ecx";
  93. "pop ebx";
  94. "call .sti".
  95. default ==> arg_error( "C_sts", $1).
  96. C_sts_narg ==> "pop eax";
  97. "cmp eax, 4";
  98. "jne .unknown";
  99. "pop ecx";
  100. "pop ebx";
  101. "call .sti".
  102. C_sdl ==> "pop $1(ebp)";
  103. "pop $1+4(ebp)".
  104. C_sde.. ==> "pop ($1+$2)";
  105. "pop ($1+$2+4)".
  106. C_sdf ==> "pop eax";
  107. "pop $1(eax)";
  108. "pop $1+4(eax)".
  109. /******************************************************************************/
  110. /* */
  111. /* Group 3 : integer arithmetic */
  112. /* */
  113. /******************************************************************************/
  114. C_adi
  115. $1 == 4 ==> "pop eax";
  116. "pop ecx";
  117. "add eax, ecx";
  118. "push eax".
  119. default ==> arg_error("C_adi", $1).
  120. C_adi_narg ==> "pop ecx";
  121. "pop eax";
  122. "call .adi";
  123. "push eax".
  124. C_sbi
  125. $1 == 4 ==> "pop ecx";
  126. "pop eax";
  127. "sub eax, ecx";
  128. "push eax".
  129. default ==> arg_error("C_sbi", $1).
  130. C_sbi_narg ==> "pop ecx";
  131. "pop eax";
  132. "call .sbi";
  133. "push eax".
  134. C_mli
  135. $1 == 4 ==> "pop eax";
  136. "pop ecx";
  137. "imul ecx";
  138. "push eax".
  139. default ==> arg_error( "C_mli", $1).
  140. C_mli_narg ==> "pop eax";
  141. "call .mli".
  142. C_dvi
  143. $1 == 4 ==> "pop ecx";
  144. "pop eax";
  145. "cdq";
  146. "idiv ecx";
  147. "push eax".
  148. default ==> arg_error( "C_dvi", $1).
  149. C_dvi_narg ==> "pop eax";
  150. "call .dvi".
  151. C_rmi
  152. $1 == 4 ==> "pop ebx";
  153. "pop eax";
  154. "cdq";
  155. "idiv ebx";
  156. "push edx".
  157. default ==> arg_error( "C_rmi", $1).
  158. C_rmi_narg ==> "pop eax";
  159. "call .rmi".
  160. C_ngi
  161. $1 == 4 ==> "pop eax";
  162. "neg eax";
  163. "push eax".
  164. default ==> "mov eax, $1";
  165. "call .ngi".
  166. C_ngi_narg ==> "pop eax";
  167. "call .ngi".
  168. C_sli
  169. $1 == 4 ==> "pop ecx";
  170. "pop eax";
  171. "sal eax, cl";
  172. "push eax".
  173. default ==> "mov eax, $1";
  174. "call .sli".
  175. C_sli_narg ==> "pop eax";
  176. "call .sli".
  177. C_sri
  178. $1 == 4 ==> "pop ecx";
  179. "pop eax";
  180. "sar eax, cl";
  181. "push eax".
  182. default ==> "mov eax, $1";
  183. "call .sri".
  184. C_sri_narg ==> "pop eax";
  185. "call .sri".
  186. /******************************************************************************/
  187. /* */
  188. /* Group 4 : Unsigned arithmetic */
  189. /* */
  190. /******************************************************************************/
  191. C_adu ==> C_adi( $1).
  192. C_adu_narg ==> C_adi_narg().
  193. C_sbu ==> C_sbi( $1).
  194. C_sbu_narg ==> C_sbi_narg().
  195. C_mlu ==> C_mli( $1).
  196. C_mlu_narg ==> C_mli_narg().
  197. C_dvu
  198. $1 == 4 ==> "pop ebx";
  199. "pop eax";
  200. "xor edx, edx";
  201. "div ebx";
  202. "push eax".
  203. default ==> "mov eax, $1";
  204. "call .dvu".
  205. C_dvu_narg ==> "pop eax";
  206. "call .dvu".
  207. C_rmu
  208. $1 == 4 ==> "pop ebx";
  209. "pop eax";
  210. "xor edx, edx";
  211. "div ebx";
  212. "push edx".
  213. default ==> "mov eax, $1";
  214. "call .rmu".
  215. C_rmu_narg ==> "pop eax";
  216. "call .rmu".
  217. C_slu ==> C_sli( $1).
  218. C_slu_narg ==> C_sli_narg().
  219. C_sru
  220. $1 == 4 ==> "pop ecx";
  221. "pop eax";
  222. "shr eax, cl";
  223. "push eax".
  224. default ==> arg_error( "C_sru", $1).
  225. /******************************************************************************/
  226. /* */
  227. /* Group 5 : Floating point arithmetic */
  228. /* */
  229. /******************************************************************************/
  230. C_adf
  231. $1 == 4 ==> "call .adf4";
  232. "pop ebx".
  233. $1 == 8 ==> "call .adf8";
  234. "add esp,8".
  235. default ==> arg_error("C_adf", $1).
  236. C_sbf
  237. $1 == 4 ==> "call .sbf4";
  238. "pop ebx".
  239. $1 == 8 ==> "call .sbf8";
  240. "add esp,8".
  241. default ==> arg_error("C_sbf", $1).
  242. C_mlf
  243. $1 == 4 ==> "call .mlf4";
  244. "pop ebx".
  245. $1 == 8 ==> "call .mlf8";
  246. "add esp,8".
  247. default ==> arg_error("C_mlf", $1).
  248. C_dvf
  249. $1 == 4 ==> "call .dvf4";
  250. "pop ebx".
  251. $1 == 8 ==> "call .dvf8";
  252. "add esp,8".
  253. default ==> arg_error("C_dvf", $1).
  254. C_ngf
  255. $1 == 4 ==> "call .ngf4".
  256. $1 == 8 ==> "call .ngf8".
  257. default ==> arg_error("C_ngf", $1).
  258. C_fif
  259. $1 == 4 ==> C_lor((arith)1);
  260. "call .fif4";
  261. "pop ebx".
  262. $1 == 8 ==> C_lor((arith)1);
  263. "call .fif8";
  264. "pop ebx".
  265. default ==> arg_error("C_fif", $1).
  266. C_fef
  267. $1 == 4 ==> "mov eax,esp";
  268. "sub eax,4";
  269. "push eax";
  270. "call .fef4".
  271. $1 == 8 ==> "mov eax,esp";
  272. "sub eax,4";
  273. "push eax";
  274. "call .fef8".
  275. default ==> arg_error("C_fef", $1).
  276. /******************************************************************************/
  277. /* */
  278. /* Group 6 : Pointer arithmetic */
  279. /* */
  280. /******************************************************************************/
  281. C_adp
  282. $1 == 0 ==> .
  283. $1 == 1 ==> "pop eax";
  284. "inc eax";
  285. "push eax".
  286. $1 == -1 ==> "pop eax";
  287. "dec eax";
  288. "push eax".
  289. default ==> "pop eax";
  290. "add eax, $1";
  291. "push eax".
  292. C_ads
  293. $1 == 4 ==> "pop eax";
  294. "pop ebx";
  295. "add eax, ebx";
  296. "push eax".
  297. default ==> arg_error( "C_ads", $1).
  298. C_ads_narg ==> "pop eax";
  299. "cmp eax, 4";
  300. "jne .unknown";
  301. "pop eax";
  302. "pop ebx";
  303. "add eax, ebx";
  304. "push eax".
  305. C_sbs
  306. $1 == 4 ==> "pop ebx";
  307. "pop eax";
  308. "sub eax, ebx";
  309. "push eax".
  310. default ==> arg_error( "C_sbs", $1).
  311. C_sbs_narg ==> "pop eax";
  312. "cmp eax, 4";
  313. "jne .unknown";
  314. "pop ebx";
  315. "pop eax";
  316. "sub eax, ebx";
  317. "push eax".
  318. /******************************************************************************/
  319. /* */
  320. /* Group 7 : Increment/decrement/zero */
  321. /* */
  322. /******************************************************************************/
  323. C_inc ==> "pop eax";
  324. "inc eax";
  325. "push eax".
  326. C_inl ==> "inc $1(ebp)".
  327. C_ine.. ==> "inc ($1+$2)".
  328. C_dec ==> "pop eax";
  329. "dec eax";
  330. "push eax".
  331. C_del ==> "dec $1(ebp)".
  332. C_dee.. ==> "dec ($1+$2)".
  333. C_zrl ==> "mov $1(ebp), 0".
  334. C_zre.. ==> "mov ($1+$2), 0".
  335. C_zer
  336. $1 == 4 ==> "xor eax, eax";
  337. "push eax".
  338. $1 == 8 ==> "xor eax, eax";
  339. "push eax";
  340. "push eax".
  341. $1 % 4 == 0 ==> "mov ecx, $1/4";
  342. "xor eax, eax";
  343. "1: push eax";
  344. "loop 1b".
  345. default ==> arg_error( "C_zer", $1).
  346. C_zrf ==> C_zer($1).
  347. C_zer_narg ==> "pop ecx";
  348. "sar ecx, 2";
  349. "xor eax, eax";
  350. "1: push eax";
  351. "loop 1b".
  352. /******************************************************************************/
  353. /* */
  354. /* Group 8 : Convert */
  355. /* */
  356. /******************************************************************************/
  357. C_cii ==> "pop ecx";
  358. "pop edx";
  359. "pop eax";
  360. "call .cii";
  361. "push eax".
  362. C_cui ==> C_cuu().
  363. C_ciu ==> C_cuu().
  364. C_cuu ==> "pop ecx";
  365. "pop edx".
  366. C_cif ==> "pop eax";
  367. "cmp eax,4";
  368. "jne 1f";
  369. "call .cif4";
  370. "pop ebx";
  371. "jmp 2f";
  372. "1: call .cif8";
  373. "2:".
  374. C_cuf ==> "pop eax";
  375. "cmp eax,4";
  376. "jne 1f";
  377. "call .cuf4";
  378. "pop ebx";
  379. "jmp 2f";
  380. "1: call .cuf8";
  381. "2:".
  382. C_cfi ==> "call .cfi";
  383. "pop ecx";
  384. "pop ebx";
  385. "cmp ebx,4";
  386. "je 1f";
  387. "pop ebx";
  388. "1:".
  389. C_cfu ==> "call .cfu";
  390. "pop ecx";
  391. "pop ebx";
  392. "cmp ebx,4";
  393. "je 1f";
  394. "pop ebx";
  395. "1:".
  396. C_cff ==> "pop eax";
  397. "pop ebx";
  398. "cmp eax,ebx";
  399. "je 1f";
  400. "cmp eax,4";
  401. "jne 2f";
  402. "call .cff4";
  403. "pop ebx";
  404. "jmp 1f";
  405. "2: pop eax";
  406. "xor ebx,ebx";
  407. "push ebx";
  408. "push eax";
  409. "call .cff8";
  410. "1:".
  411. /******************************************************************************/
  412. /* */
  413. /* Group 9 : Logical */
  414. /* */
  415. /******************************************************************************/
  416. C_and
  417. $1 == 4 ==> "pop eax";
  418. "pop ebx";
  419. "and eax, ebx";
  420. "push eax".
  421. default ==> "mov ecx, $1";
  422. "call .and".
  423. C_and_narg ==> "pop ecx";
  424. "call .and".
  425. C_ior
  426. $1 == 4 ==> "pop eax";
  427. "pop ebx";
  428. "or eax, ebx";
  429. "push eax".
  430. default ==> "mov ecx, $1";
  431. "call .ior".
  432. C_ior_narg ==> "pop ecx";
  433. "call .ior".
  434. C_xor
  435. $1 == 4 ==> "pop eax";
  436. "pop ebx";
  437. "xor eax, ebx";
  438. "push eax".
  439. default ==> "mov ecx, $1";
  440. "call .xor".
  441. C_xor_narg ==> "pop ecx";
  442. "call .xor".
  443. C_com
  444. $1 == 4 ==> "pop eax";
  445. "not eax";
  446. "push eax".
  447. default ==> "mov ecx, $1";
  448. "call .com".
  449. C_com_narg ==> "pop ecx";
  450. "call .com".
  451. C_rol
  452. $1 == 4 ==> "pop ecx";
  453. "pop eax";
  454. "rol eax, cl";
  455. "push eax".
  456. default ==> "mov ecx, $1";
  457. "call .rol".
  458. C_rol_narg ==> "pop ecx";
  459. "call .rol".
  460. C_ror
  461. $1 == 4 ==> "pop ecx";
  462. "pop eax";
  463. "ror eax, cl";
  464. "push eax".
  465. default ==> "mov ecx, $1";
  466. "call .ror".
  467. C_ror_narg ==> "pop ecx";
  468. "call .ror".
  469. /******************************************************************************/
  470. /* */
  471. /* Group 10 : Sets */
  472. /* */
  473. /******************************************************************************/
  474. C_inn
  475. $1 == 4 ==> "pop ecx";
  476. "pop eax";
  477. "shr eax, cl";
  478. "and eax, 1";
  479. "push eax".
  480. default ==> "pop eax";
  481. "mov ecx, $1";
  482. "call .inn";
  483. "push eax".
  484. C_inn_narg ==> "pop ecx";
  485. "pop eax";
  486. "call .inn";
  487. "push eax".
  488. C_set
  489. $1 == 4 ==> "pop ecx";
  490. "mov eax, 1";
  491. "shl eax, cl";
  492. "push eax".
  493. default ==> "pop eax";
  494. "mov ecx, $1";
  495. "call .set".
  496. C_set_narg ==> "pop ecx";
  497. "pop eax";
  498. "call .set".
  499. /******************************************************************************/
  500. /* */
  501. /* Group 11 : Array */
  502. /* */
  503. /******************************************************************************/
  504. C_lar
  505. $1 == 4 ==> "pop ebx";
  506. "pop eax";
  507. "call .lar4".
  508. default ==> arg_error( "C_lar", $1).
  509. C_lar_narg ==> "call .ilar".
  510. C_sar
  511. $1 == 4 ==> "pop ebx";
  512. "pop eax";
  513. "call .sar4".
  514. default ==> arg_error( "C_sar", $1).
  515. C_sar_narg ==> "call .isar".
  516. C_aar
  517. $1 == 4 ==> "pop ebx";
  518. "pop eax";
  519. "pop ecx";
  520. "sub eax, (ebx)";
  521. "mul 8(ebx)";
  522. "add eax, ecx";
  523. "push eax".
  524. default ==> arg_error( "C_aar", $1).
  525. C_aar_narg ==> "call .iaar";
  526. "push ebx".
  527. /******************************************************************************/
  528. /* */
  529. /* Group 12 : Compare */
  530. /* */
  531. /******************************************************************************/
  532. C_cmi
  533. $1 == 4 ==> "pop ebx";
  534. "pop ecx";
  535. "xor eax, eax";
  536. "cmp ecx, ebx";
  537. "je 2f";
  538. "jl 1f";
  539. "inc eax";
  540. "jmp 2f";
  541. "1: dec eax";
  542. "2: push eax".
  543. default ==> arg_error( "C_cmi", $1).
  544. C_cmu
  545. $1 == 4 ==> C_cmp().
  546. default ==> arg_error( "C_cmu", $1).
  547. C_cms
  548. $1 == 4 ==> C_sbi( (arith) 4).
  549. default ==> "mov ecx, $1";
  550. "call .cms";
  551. "push ecx".
  552. C_cms_narg ==> "pop ecx";
  553. "call .cms";
  554. "push ecx".
  555. C_cmp ==> "pop ebx";
  556. "pop ecx";
  557. "xor eax, eax";
  558. "cmp ecx, ebx";
  559. "je 2f";
  560. "jb 1f";
  561. "inc eax";
  562. "jmp 2f";
  563. "1: dec eax";
  564. "2: push eax".
  565. C_cmf
  566. $1 == 4 ==> "call .cmf4";
  567. "pop ebx";
  568. "pop ebx";
  569. "push eax".
  570. $1 == 8 ==> "call .cmf8";
  571. "add esp,16";
  572. "push eax".
  573. default ==> arg_error("C_cmf", $1).
  574. C_tlt ==> "pop eax";
  575. "xor ebx, ebx";
  576. "test eax, eax";
  577. "jge 1f";
  578. "inc ebx";
  579. "1: push ebx".
  580. C_tle ==> "pop eax";
  581. "xor ebx, ebx";
  582. "test eax, eax";
  583. "jg 1f";
  584. "inc ebx";
  585. "1: push ebx".
  586. C_teq ==> "pop eax";
  587. "xor ebx, ebx";
  588. "test eax, eax";
  589. "jne 1f";
  590. "inc ebx";
  591. "1: push ebx".
  592. C_tne ==> "pop eax";
  593. "xor ebx, ebx";
  594. "test eax, eax";
  595. "je 1f";
  596. "inc ebx";
  597. "1: push ebx".
  598. C_tge ==> "pop eax";
  599. "xor ebx, ebx";
  600. "test eax, eax";
  601. "jl 1f";
  602. "inc ebx";
  603. "1: push ebx".
  604. C_tgt ==> "pop eax";
  605. "xor ebx, ebx";
  606. "test eax, eax";
  607. "jle 1f";
  608. "inc ebx";
  609. "1: push ebx".
  610. /******************************************************************************/
  611. /* */
  612. /* Group 13 : Branch */
  613. /* */
  614. /******************************************************************************/
  615. C_bra ==> "jmp $1".
  616. C_blt ==> "pop eax";
  617. "pop ebx";
  618. "cmp ebx, eax";
  619. "jl $1".
  620. C_ble ==> "pop eax";
  621. "pop ebx";
  622. "cmp ebx, eax";
  623. "jle $1".
  624. C_beq ==> "pop eax";
  625. "pop ebx";
  626. "cmp ebx, eax";
  627. "je $1".
  628. C_bne ==> "pop eax";
  629. "pop ebx";
  630. "cmp ebx, eax";
  631. "jne $1".
  632. C_bge ==> "pop eax";
  633. "pop ebx";
  634. "cmp ebx, eax";
  635. "jge $1".
  636. C_bgt ==> "pop eax";
  637. "pop ebx";
  638. "cmp ebx, eax";
  639. "jg $1".
  640. C_zlt ==> "pop eax";
  641. "test eax, eax";
  642. "jl $1".
  643. C_zle ==> "pop eax";
  644. "test eax, eax";
  645. "jle $1".
  646. C_zeq ==> "pop eax";
  647. "test eax, eax";
  648. "je $1".
  649. C_zne ==> "pop eax";
  650. "test eax, eax";
  651. "jne $1".
  652. C_zge ==> "pop eax";
  653. "test eax, eax";
  654. "jge $1".
  655. C_zgt ==> "pop eax";
  656. "test eax, eax";
  657. "jg $1".
  658. /******************************************************************************/
  659. /* */
  660. /* Group 14 : Procedure call instructions */
  661. /* */
  662. /******************************************************************************/
  663. C_cai ==> "pop ebx";
  664. "call ebx".
  665. C_cal ==> "call $1".
  666. C_lfr
  667. $1 == 4 ==> "push eax".
  668. $1 == 8 ==> "push edx";
  669. "push eax".
  670. default ==> arg_error( "C_lfr", $1).
  671. C_ret
  672. $1 == 0 ==> "leave";
  673. "ret".
  674. $1 == 4 ==> "pop eax";
  675. "leave";
  676. "ret".
  677. $1 == 8 ==> "pop eax";
  678. "pop edx";
  679. "leave";
  680. "ret".
  681. default ==> arg_error( "C_ret", $1).
  682. /******************************************************************************/
  683. /* */
  684. /* Group 15 : Miscellaneous instructions */
  685. /* */
  686. /******************************************************************************/
  687. C_asp
  688. $1 == 4 ==> "pop ebx".
  689. $1 == 8 ==> "pop ebx";
  690. "pop ebx".
  691. $1 == -4 ==> "push eax".
  692. $1 == -8 ==> "push eax";
  693. "push eax".
  694. default ==> "add esp, $1".
  695. C_ass
  696. $1 == 4 ==> "pop eax";
  697. "add esp, eax".
  698. default ==> arg_error( "C_ass", $1).
  699. C_ass_narg ==> "pop eax";
  700. "cmp eax, 4";
  701. "jne .unknown";
  702. "pop eax";
  703. "add esp, eax".
  704. C_blm
  705. $1 % 4 == 0 ==> "mov ecx, $1/4";
  706. "call .blm".
  707. default ==> arg_error( "C_blm", $1).
  708. C_bls
  709. $1 == 4 ==> "pop ecx";
  710. "sar ecx,2";
  711. "call .blm".
  712. default ==> arg_error( "C_bls", $1).
  713. C_bls_narg ==> "pop eax";
  714. "cmp eax, 4";
  715. "jne .unknown";
  716. "pop ecx";
  717. "sar ecx, 2";
  718. "call .blm".
  719. C_csa
  720. $1 == 4 ==> "pop ebx";
  721. "pop eax";
  722. "jmp .csa4".
  723. default ==> arg_error( "C_csa", $1).
  724. C_csa_narg ==> "pop eax";
  725. "cmp eax, 4";
  726. "jne .unknown";
  727. "pop ebx";
  728. "pop eax";
  729. "jmp .csa4".
  730. C_csb
  731. $1 == 4 ==> "pop ebx";
  732. "pop eax";
  733. "jmp .csb4".
  734. default ==> arg_error( "C_csb", $1).
  735. C_csb_narg ==> "pop eax";
  736. "cmp eax, 4";
  737. "jne .unknown";
  738. "pop ebx";
  739. "pop eax";
  740. "jmp .csb4".
  741. C_dch ==> "mov ebp, (ebp)".
  742. C_dup
  743. $1 == 4 ==> "pop eax";
  744. "push eax";
  745. "push eax".
  746. $1 == 8 ==> "pop eax";
  747. "pop ebx";
  748. "push ebx";
  749. "push eax";
  750. "push ebx";
  751. "push eax".
  752. default ==> "mov ecx, $1";
  753. "call .dup".
  754. C_dus
  755. $1 == 4 ==> "pop ecx";
  756. "call .dup".
  757. default ==> arg_error( "C_dus", $1).
  758. C_dus_narg ==> "pop eax";
  759. "cmp eax, 4";
  760. "jne .unknown";
  761. "pop ecx";
  762. "call .dup".
  763. C_exg ==> "mov ecx, $1";
  764. "call .exg".
  765. C_exg_narg ==> "pop ecx";
  766. "call .exg".
  767. C_fil.. ==> "mov (hol0+4), $1+$2".
  768. C_gto.. ==> "mov ebx, $1+$2";
  769. "call .gto".
  770. C_lim ==> "push (.ignmask)".
  771. C_lin ==> "mov (hol0), $1".
  772. C_lni ==> "inc (hol0)".
  773. C_lor
  774. $1 == 0 ==> "push ebp".
  775. $1 == 1 ==> "mov eax, esp";
  776. "push eax".
  777. $1 == 2 ==> "push (.reghp)".
  778. default ==> arg_error( "C_lor", $1).
  779. C_lpb ==> "pop eax";
  780. "add eax, 8";
  781. "push eax".
  782. C_mon ==> "pop eax";
  783. "call .mon".
  784. C_nop ==> .
  785. C_rck
  786. $1 == 4 ==> "pop ebx";
  787. "pop eax";
  788. "call .rck";
  789. "push eax".
  790. default ==> arg_error( "C_rck", $1).
  791. C_rck_narg ==> "pop eax";
  792. "cmp eax, 4";
  793. "jne .unknown";
  794. "pop ebx";
  795. "pop eax";
  796. "call .rck";
  797. "push eax".
  798. C_rtt ==> C_ret( (arith) 0).
  799. C_sig ==> "pop eax";
  800. "xchg (.trppc), eax";
  801. "push eax".
  802. C_sim ==> "pop (.ignmask)".
  803. C_str
  804. $1 == 0 ==> "pop ebp".
  805. $1 == 1 ==> "pop esp".
  806. $1 == 2 ==> "pop (.reghp)".
  807. default ==> arg_error( "C_str", $1).
  808. C_trp ==> "pop eax";
  809. "call .trp".
  810. /******************************************************************************/
  811. /* */
  812. /* Storage-routines */
  813. /* */
  814. /******************************************************************************/
  815. ..icon
  816. $2 == 1 ==> gen1( (ONE_BYTE) atoi( $1)).
  817. $2 == 2 ==> gen2( (TWO_BYTES) atoi( $1)).
  818. $2 == 4 ==> gen4( (FOUR_BYTES) atol( $1)).
  819. default ==> arg_error( "..icon", $1).
  820. ..ucon
  821. $2 == 1 ==> gen1( (ONE_BYTE) atoi( $1)).
  822. $2 == 2 ==> gen2( (TWO_BYTES) atoi( $1)).
  823. $2 == 4 ==> gen4( (FOUR_BYTES) atol( $1)).
  824. default ==> arg_error( "..ucon", $1).
  825. ..fcon ==> con_float($1, $2).
  826. /******************************************************************************/
  827. /* */
  828. /* Extra-routines */
  829. /* */
  830. /******************************************************************************/
  831. #ifdef PUSH_POP_OPT
  832. C_df_ilb ==> clean_push_buf();
  833. symbol_definition( $1);
  834. set_local_visible( $1).
  835. #endif
  836. C_jump ==> "jmp $1".
  837. C_prolog ==> .
  838. C_locals
  839. ==> "push ebp";
  840. "mov ebp,esp";
  841. "sub esp, $1".
  842. C_db_sline ==> "call ___u_LiB".