aasmcpu.pas 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807
  1. {
  2. Copyright (c) 2019 by Free Pascal and Lazarus foundation
  3. Contains the assembler object for the WebAssembly
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. ****************************************************************************
  16. }
  17. unit aasmcpu;
  18. {$i fpcdefs.inc}
  19. interface
  20. uses
  21. cclasses,
  22. globtype,globals,verbose,
  23. aasmbase,aasmtai,aasmdata,aasmsym,
  24. cgbase,cgutils,cpubase,cpuinfo,ogbase,
  25. widestr;
  26. { fake, there are no "mov reg,reg" instructions here }
  27. const
  28. { "mov reg,reg" source operand number }
  29. O_MOV_SOURCE = 0;
  30. { "mov reg,reg" source operand number }
  31. O_MOV_DEST = 0;
  32. type
  33. { taicpu }
  34. taicpu = class(tai_cpu_abstract_sym)
  35. constructor op_none(op : tasmop);
  36. constructor op_reg(op : tasmop;_op1 : tregister);
  37. constructor op_const(op : tasmop;_op1 : aint);
  38. constructor op_ref(op : tasmop;const _op1 : treference);
  39. constructor op_sym(op : tasmop;_op1 : tasmsymbol);
  40. constructor op_sym_const(op : tasmop;_op1 : tasmsymbol;_op2 : aint);
  41. constructor op_single(op : tasmop;_op1 : single);
  42. constructor op_double(op : tasmop;_op1 : double);
  43. constructor op_functype(op : tasmop; _op1: TWasmFuncType);
  44. procedure loadfunctype(opidx:longint;ft:TWasmFuncType);
  45. procedure loadsingle(opidx:longint;f:single);
  46. procedure loaddouble(opidx:longint;d:double);
  47. { register allocation }
  48. function is_same_reg_move(regtype: Tregistertype):boolean; override;
  49. { register spilling code }
  50. function spilling_get_operation_type(opnr: longint): topertype;override;
  51. function Pass1(objdata:TObjData):longint;override;
  52. procedure Pass2(objdata:TObjData);override;
  53. end;
  54. tai_align = class(tai_align_abstract)
  55. { nothing to add }
  56. end;
  57. TImpExpType= (
  58. ie_Func, // functions
  59. ie_Table, // tables (arrays of methods)
  60. ie_Memory, // memory reference
  61. ie_Global // global variables
  62. );
  63. // the actual use is defined by the assembly section used
  64. { timpexp_ai }
  65. tai_impexp = class(tai)
  66. extname : ansistring; // external name
  67. intname : ansistring; // internal name
  68. extmodule : ansistring; // external unit name
  69. symstype: TImpExpType;
  70. constructor create(const aextname, aintname: ansistring; asymtype: timpexptype); overload;
  71. constructor create(const aextmodule, aextname, aintname: ansistring; asymtype: timpexptype); overload;
  72. end;
  73. // local variable declaration
  74. { tai_local }
  75. tai_local = class(tai)
  76. bastyp: TWasmBasicType;
  77. name : string;
  78. first: boolean;
  79. last: boolean;
  80. constructor create(abasictype: TWasmBasicType; const aname: string = '');
  81. end;
  82. { tai_functype }
  83. tai_functype = class(tai)
  84. funcname: string;
  85. functype: TWasmFuncType;
  86. constructor create(const afuncname: string; afunctype: TWasmFuncType);
  87. destructor destroy;override;
  88. end;
  89. { tai_tagtype }
  90. tai_tagtype = class(tai)
  91. tagname: string;
  92. params: TWasmResultType;
  93. constructor create(const atagname: string; aparams: TWasmResultType);
  94. end;
  95. procedure InitAsm;
  96. procedure DoneAsm;
  97. function spilling_create_load(const ref:treference;r:tregister):Taicpu;
  98. function spilling_create_store(r:tregister; const ref:treference):Taicpu;
  99. implementation
  100. { tai_functype }
  101. constructor tai_functype.create(const afuncname: string; afunctype: TWasmFuncType);
  102. begin
  103. inherited Create;
  104. typ:=ait_functype;
  105. funcname:=afuncname;
  106. functype:=afunctype;
  107. end;
  108. destructor tai_functype.destroy;
  109. begin
  110. functype.free;
  111. inherited;
  112. end;
  113. { tai_tagtype }
  114. constructor tai_tagtype.create(const atagname: string; aparams: TWasmResultType);
  115. begin
  116. typ:=ait_tagtype;
  117. tagname:=atagname;
  118. params:=aparams;
  119. end;
  120. { tai_local }
  121. constructor tai_local.create(abasictype: TWasmBasicType; const aname: string);
  122. begin
  123. inherited Create;
  124. bastyp := abasictype;
  125. typ := ait_local;
  126. name := aname;
  127. end;
  128. { timpexp_ai }
  129. constructor tai_impexp.create(const aextname, aintname: ansistring;
  130. asymtype: timpexptype);
  131. begin
  132. create('', aextname, aintname, asymtype);;
  133. end;
  134. constructor tai_impexp.create(const aextmodule, aextname, aintname: ansistring; asymtype: timpexptype);
  135. begin
  136. inherited create;
  137. typ := ait_importexport;
  138. extmodule := aextmodule;
  139. extname := aextname;
  140. intname := aintname;
  141. symstype:= asymtype;
  142. end;
  143. {*****************************************************************************
  144. taicpu Constructors
  145. *****************************************************************************}
  146. constructor taicpu.op_none(op : tasmop);
  147. begin
  148. inherited create(op);
  149. end;
  150. constructor taicpu.op_reg(op : tasmop;_op1 : tregister);
  151. begin
  152. inherited create(op);
  153. ops:=1;
  154. {$ifdef EXTDEBUG}
  155. if getregtype(_op1)=R_INVALIDREGISTER then
  156. InternalError(2021011901);
  157. {$endif EXTDEBUG}
  158. loadreg(0,_op1);
  159. end;
  160. constructor taicpu.op_ref(op : tasmop;const _op1 : treference);
  161. begin
  162. inherited create(op);
  163. ops:=1;
  164. loadref(0,_op1);
  165. if op in [a_local_get,a_local_set,a_local_tee] then
  166. begin
  167. if (_op1.base<>NR_LOCAL_STACK_POINTER_REG) or (_op1.index<>NR_NO) then
  168. internalerror(2021010201);
  169. end
  170. else
  171. begin
  172. if (_op1.base<>NR_NO) or (_op1.index<>NR_NO) then
  173. internalerror(2021010202);
  174. end;
  175. end;
  176. constructor taicpu.op_const(op : tasmop;_op1 : aint);
  177. begin
  178. inherited create(op);
  179. ops:=1;
  180. loadconst(0,_op1);
  181. end;
  182. constructor taicpu.op_sym(op : tasmop;_op1 : tasmsymbol);
  183. begin
  184. inherited create(op);
  185. ops:=1;
  186. loadsymbol(0,_op1,0);
  187. end;
  188. constructor taicpu.op_sym_const(op: tasmop; _op1: tasmsymbol; _op2: aint);
  189. begin
  190. inherited create(op);
  191. ops:=2;
  192. loadsymbol(0,_op1,0);
  193. loadconst(1,_op2);
  194. end;
  195. constructor taicpu.op_single(op: tasmop; _op1: single);
  196. begin
  197. inherited create(op);
  198. ops:=1;
  199. loadsingle(0,_op1);
  200. end;
  201. constructor taicpu.op_double(op: tasmop; _op1: double);
  202. begin
  203. inherited create(op);
  204. ops:=1;
  205. loaddouble(0,_op1);
  206. end;
  207. constructor taicpu.op_functype(op: tasmop; _op1: TWasmFuncType);
  208. begin
  209. inherited create(op);
  210. ops:=1;
  211. loadfunctype(0,_op1);
  212. end;
  213. procedure taicpu.loadfunctype(opidx: longint; ft: TWasmFuncType);
  214. begin
  215. allocate_oper(opidx+1);
  216. with oper[opidx]^ do
  217. begin
  218. if typ<>top_functype then
  219. clearop(opidx);
  220. functype:=ft;
  221. typ:=top_functype;
  222. end;
  223. end;
  224. procedure taicpu.loadsingle(opidx:longint;f:single);
  225. begin
  226. allocate_oper(opidx+1);
  227. with oper[opidx]^ do
  228. begin
  229. if typ<>top_single then
  230. clearop(opidx);
  231. sval:=f;
  232. typ:=top_single;
  233. end;
  234. end;
  235. procedure taicpu.loaddouble(opidx: longint; d: double);
  236. begin
  237. allocate_oper(opidx+1);
  238. with oper[opidx]^ do
  239. begin
  240. if typ<>top_double then
  241. clearop(opidx);
  242. dval:=d;
  243. typ:=top_double;
  244. end;
  245. end;
  246. function taicpu.is_same_reg_move(regtype: Tregistertype):boolean;
  247. begin
  248. result:=false;
  249. end;
  250. function taicpu.spilling_get_operation_type(opnr: longint): topertype;
  251. begin
  252. if opcode in AsmOp_Store then
  253. result:=operand_write
  254. else
  255. result:=operand_read;
  256. end;
  257. function taicpu.Pass1(objdata: TObjData): longint;
  258. begin
  259. case opcode of
  260. a_unreachable,
  261. a_nop,
  262. a_return,
  263. a_drop,
  264. a_i32_eqz,
  265. a_i32_eq,
  266. a_i32_ne,
  267. a_i32_lt_s,
  268. a_i32_lt_u,
  269. a_i32_gt_s,
  270. a_i32_gt_u,
  271. a_i32_le_s,
  272. a_i32_le_u,
  273. a_i32_ge_s,
  274. a_i32_ge_u,
  275. a_i64_eqz,
  276. a_i64_eq,
  277. a_i64_ne,
  278. a_i64_lt_s,
  279. a_i64_lt_u,
  280. a_i64_gt_s,
  281. a_i64_gt_u,
  282. a_i64_le_s,
  283. a_i64_le_u,
  284. a_i64_ge_s,
  285. a_i64_ge_u,
  286. a_f32_eq,
  287. a_f32_ne,
  288. a_f32_lt,
  289. a_f32_gt,
  290. a_f32_le,
  291. a_f32_ge,
  292. a_f64_eq,
  293. a_f64_ne,
  294. a_f64_lt,
  295. a_f64_gt,
  296. a_f64_le,
  297. a_f64_ge,
  298. a_i32_clz,
  299. a_i32_ctz,
  300. a_i32_popcnt,
  301. a_i32_add,
  302. a_i32_sub,
  303. a_i32_mul,
  304. a_i32_div_s,
  305. a_i32_div_u,
  306. a_i32_rem_s,
  307. a_i32_rem_u,
  308. a_i32_and,
  309. a_i32_or,
  310. a_i32_xor,
  311. a_i32_shl,
  312. a_i32_shr_s,
  313. a_i32_shr_u,
  314. a_i32_rotl,
  315. a_i32_rotr,
  316. a_i64_clz,
  317. a_i64_ctz,
  318. a_i64_popcnt,
  319. a_i64_add,
  320. a_i64_sub,
  321. a_i64_mul,
  322. a_i64_div_s,
  323. a_i64_div_u,
  324. a_i64_rem_s,
  325. a_i64_rem_u,
  326. a_i64_and,
  327. a_i64_or,
  328. a_i64_xor,
  329. a_i64_shl,
  330. a_i64_shr_s,
  331. a_i64_shr_u,
  332. a_i64_rotl,
  333. a_i64_rotr,
  334. a_f32_abs,
  335. a_f32_neg,
  336. a_f32_ceil,
  337. a_f32_floor,
  338. a_f32_trunc,
  339. a_f32_nearest,
  340. a_f32_sqrt,
  341. a_f32_add,
  342. a_f32_sub,
  343. a_f32_mul,
  344. a_f32_div,
  345. a_f32_min,
  346. a_f32_max,
  347. a_f32_copysign,
  348. a_f64_abs,
  349. a_f64_neg,
  350. a_f64_ceil,
  351. a_f64_floor,
  352. a_f64_trunc,
  353. a_f64_nearest,
  354. a_f64_sqrt,
  355. a_f64_add,
  356. a_f64_sub,
  357. a_f64_mul,
  358. a_f64_div,
  359. a_f64_min,
  360. a_f64_max,
  361. a_f64_copysign,
  362. a_i32_wrap_i64,
  363. a_i32_trunc_f32_s,
  364. a_i32_trunc_f32_u,
  365. a_i32_trunc_f64_s,
  366. a_i32_trunc_f64_u,
  367. a_i64_extend_i32_s,
  368. a_i64_extend_i32_u,
  369. a_i64_trunc_f32_s,
  370. a_i64_trunc_f32_u,
  371. a_i64_trunc_f64_s,
  372. a_i64_trunc_f64_u,
  373. a_f32_convert_i32_s,
  374. a_f32_convert_i32_u,
  375. a_f32_convert_i64_s,
  376. a_f32_convert_i64_u,
  377. a_f32_demote_f64,
  378. a_f64_convert_i32_s,
  379. a_f64_convert_i32_u,
  380. a_f64_convert_i64_s,
  381. a_f64_convert_i64_u,
  382. a_f64_promote_f32,
  383. a_i32_reinterpret_f32,
  384. a_i64_reinterpret_f64,
  385. a_f32_reinterpret_i32,
  386. a_f64_reinterpret_i64,
  387. a_i32_extend8_s,
  388. a_i32_extend16_s,
  389. a_i64_extend8_s,
  390. a_i64_extend16_s,
  391. a_i64_extend32_s,
  392. a_end_block,
  393. a_end_if,
  394. a_end_loop,
  395. a_end_try,
  396. a_catch_all:
  397. result:=1;
  398. a_memory_size,
  399. a_memory_grow:
  400. result:=2;
  401. else
  402. begin
  403. Writeln('Warning! Not implemented opcode, pass1: ', opcode);
  404. result:=0;
  405. end;
  406. end;
  407. end;
  408. procedure taicpu.Pass2(objdata: TObjData);
  409. procedure WriteByte(b: byte);
  410. begin
  411. objdata.writebytes(b,1);
  412. end;
  413. begin
  414. case opcode of
  415. a_unreachable:
  416. WriteByte($00);
  417. a_nop:
  418. WriteByte($01);
  419. a_return:
  420. WriteByte($0F);
  421. a_drop:
  422. WriteByte($1A);
  423. a_memory_size:
  424. begin
  425. WriteByte($3F);
  426. WriteByte($00);
  427. end;
  428. a_memory_grow:
  429. begin
  430. WriteByte($40);
  431. WriteByte($00);
  432. end;
  433. a_i32_eqz:
  434. WriteByte($45);
  435. a_i32_eq:
  436. WriteByte($46);
  437. a_i32_ne:
  438. WriteByte($47);
  439. a_i32_lt_s:
  440. WriteByte($48);
  441. a_i32_lt_u:
  442. WriteByte($49);
  443. a_i32_gt_s:
  444. WriteByte($4A);
  445. a_i32_gt_u:
  446. WriteByte($4B);
  447. a_i32_le_s:
  448. WriteByte($4C);
  449. a_i32_le_u:
  450. WriteByte($4D);
  451. a_i32_ge_s:
  452. WriteByte($4E);
  453. a_i32_ge_u:
  454. WriteByte($4F);
  455. a_i64_eqz:
  456. WriteByte($50);
  457. a_i64_eq:
  458. WriteByte($51);
  459. a_i64_ne:
  460. WriteByte($52);
  461. a_i64_lt_s:
  462. WriteByte($53);
  463. a_i64_lt_u:
  464. WriteByte($54);
  465. a_i64_gt_s:
  466. WriteByte($55);
  467. a_i64_gt_u:
  468. WriteByte($56);
  469. a_i64_le_s:
  470. WriteByte($57);
  471. a_i64_le_u:
  472. WriteByte($58);
  473. a_i64_ge_s:
  474. WriteByte($59);
  475. a_i64_ge_u:
  476. WriteByte($5A);
  477. a_f32_eq:
  478. WriteByte($5B);
  479. a_f32_ne:
  480. WriteByte($5C);
  481. a_f32_lt:
  482. WriteByte($5D);
  483. a_f32_gt:
  484. WriteByte($5E);
  485. a_f32_le:
  486. WriteByte($5F);
  487. a_f32_ge:
  488. WriteByte($60);
  489. a_f64_eq:
  490. WriteByte($61);
  491. a_f64_ne:
  492. WriteByte($62);
  493. a_f64_lt:
  494. WriteByte($63);
  495. a_f64_gt:
  496. WriteByte($64);
  497. a_f64_le:
  498. WriteByte($65);
  499. a_f64_ge:
  500. WriteByte($66);
  501. a_i32_clz:
  502. WriteByte($67);
  503. a_i32_ctz:
  504. WriteByte($68);
  505. a_i32_popcnt:
  506. WriteByte($69);
  507. a_i32_add:
  508. WriteByte($6A);
  509. a_i32_sub:
  510. WriteByte($6B);
  511. a_i32_mul:
  512. WriteByte($6C);
  513. a_i32_div_s:
  514. WriteByte($6D);
  515. a_i32_div_u:
  516. WriteByte($6E);
  517. a_i32_rem_s:
  518. WriteByte($6F);
  519. a_i32_rem_u:
  520. WriteByte($70);
  521. a_i32_and:
  522. WriteByte($71);
  523. a_i32_or:
  524. WriteByte($72);
  525. a_i32_xor:
  526. WriteByte($73);
  527. a_i32_shl:
  528. WriteByte($74);
  529. a_i32_shr_s:
  530. WriteByte($75);
  531. a_i32_shr_u:
  532. WriteByte($76);
  533. a_i32_rotl:
  534. WriteByte($77);
  535. a_i32_rotr:
  536. WriteByte($78);
  537. a_i64_clz:
  538. WriteByte($79);
  539. a_i64_ctz:
  540. WriteByte($7A);
  541. a_i64_popcnt:
  542. WriteByte($7B);
  543. a_i64_add:
  544. WriteByte($7C);
  545. a_i64_sub:
  546. WriteByte($7D);
  547. a_i64_mul:
  548. WriteByte($7E);
  549. a_i64_div_s:
  550. WriteByte($7F);
  551. a_i64_div_u:
  552. WriteByte($80);
  553. a_i64_rem_s:
  554. WriteByte($81);
  555. a_i64_rem_u:
  556. WriteByte($82);
  557. a_i64_and:
  558. WriteByte($83);
  559. a_i64_or:
  560. WriteByte($84);
  561. a_i64_xor:
  562. WriteByte($85);
  563. a_i64_shl:
  564. WriteByte($86);
  565. a_i64_shr_s:
  566. WriteByte($87);
  567. a_i64_shr_u:
  568. WriteByte($88);
  569. a_i64_rotl:
  570. WriteByte($89);
  571. a_i64_rotr:
  572. WriteByte($8A);
  573. a_f32_abs:
  574. WriteByte($8B);
  575. a_f32_neg:
  576. WriteByte($8C);
  577. a_f32_ceil:
  578. WriteByte($8D);
  579. a_f32_floor:
  580. WriteByte($8E);
  581. a_f32_trunc:
  582. WriteByte($8F);
  583. a_f32_nearest:
  584. WriteByte($90);
  585. a_f32_sqrt:
  586. WriteByte($91);
  587. a_f32_add:
  588. WriteByte($92);
  589. a_f32_sub:
  590. WriteByte($93);
  591. a_f32_mul:
  592. WriteByte($94);
  593. a_f32_div:
  594. WriteByte($95);
  595. a_f32_min:
  596. WriteByte($96);
  597. a_f32_max:
  598. WriteByte($97);
  599. a_f32_copysign:
  600. WriteByte($98);
  601. a_f64_abs:
  602. WriteByte($99);
  603. a_f64_neg:
  604. WriteByte($9A);
  605. a_f64_ceil:
  606. WriteByte($9B);
  607. a_f64_floor:
  608. WriteByte($9C);
  609. a_f64_trunc:
  610. WriteByte($9D);
  611. a_f64_nearest:
  612. WriteByte($9E);
  613. a_f64_sqrt:
  614. WriteByte($9F);
  615. a_f64_add:
  616. WriteByte($A0);
  617. a_f64_sub:
  618. WriteByte($A1);
  619. a_f64_mul:
  620. WriteByte($A2);
  621. a_f64_div:
  622. WriteByte($A3);
  623. a_f64_min:
  624. WriteByte($A4);
  625. a_f64_max:
  626. WriteByte($A5);
  627. a_f64_copysign:
  628. WriteByte($A6);
  629. a_i32_wrap_i64:
  630. WriteByte($A7);
  631. a_i32_trunc_f32_s:
  632. WriteByte($A8);
  633. a_i32_trunc_f32_u:
  634. WriteByte($A9);
  635. a_i32_trunc_f64_s:
  636. WriteByte($AA);
  637. a_i32_trunc_f64_u:
  638. WriteByte($AB);
  639. a_i64_extend_i32_s:
  640. WriteByte($AC);
  641. a_i64_extend_i32_u:
  642. WriteByte($AD);
  643. a_i64_trunc_f32_s:
  644. WriteByte($AE);
  645. a_i64_trunc_f32_u:
  646. WriteByte($AF);
  647. a_i64_trunc_f64_s:
  648. WriteByte($B0);
  649. a_i64_trunc_f64_u:
  650. WriteByte($B1);
  651. a_f32_convert_i32_s:
  652. WriteByte($B2);
  653. a_f32_convert_i32_u:
  654. WriteByte($B3);
  655. a_f32_convert_i64_s:
  656. WriteByte($B4);
  657. a_f32_convert_i64_u:
  658. WriteByte($B5);
  659. a_f32_demote_f64:
  660. WriteByte($B6);
  661. a_f64_convert_i32_s:
  662. WriteByte($B7);
  663. a_f64_convert_i32_u:
  664. WriteByte($B8);
  665. a_f64_convert_i64_s:
  666. WriteByte($B9);
  667. a_f64_convert_i64_u:
  668. WriteByte($BA);
  669. a_f64_promote_f32:
  670. WriteByte($BB);
  671. a_i32_reinterpret_f32:
  672. WriteByte($BC);
  673. a_i64_reinterpret_f64:
  674. WriteByte($BD);
  675. a_f32_reinterpret_i32:
  676. WriteByte($BE);
  677. a_f64_reinterpret_i64:
  678. WriteByte($BF);
  679. a_i32_extend8_s:
  680. WriteByte($C0);
  681. a_i32_extend16_s:
  682. WriteByte($C1);
  683. a_i64_extend8_s:
  684. WriteByte($C2);
  685. a_i64_extend16_s:
  686. WriteByte($C3);
  687. a_i64_extend32_s:
  688. WriteByte($C4);
  689. a_end_block,
  690. a_end_if,
  691. a_end_loop,
  692. a_end_try:
  693. WriteByte($0B);
  694. a_catch_all:
  695. WriteByte($19);
  696. else
  697. Writeln('Warning! Not implemented opcode, pass2: ', opcode);
  698. end;
  699. end;
  700. function spilling_create_load(const ref:treference;r:tregister):Taicpu;
  701. begin
  702. internalerror(2010122614);
  703. result:=nil;
  704. end;
  705. function spilling_create_store(r:tregister; const ref:treference):Taicpu;
  706. begin
  707. internalerror(2010122615);
  708. result:=nil;
  709. end;
  710. procedure InitAsm;
  711. begin
  712. end;
  713. procedure DoneAsm;
  714. begin
  715. end;
  716. initialization
  717. cai_cpu:=taicpu;
  718. cai_align:=tai_align;
  719. casmdata:=TAsmData;
  720. end.