sparc.pat.cpp

Go to the documentation of this file.
00001 #define sign_extend(N,SIZE) (((int)((N) << (sizeof(unsigned)*8-(SIZE)))) >> (sizeof(unsigned)*8-(SIZE)))
00002 #include <assert.h>
00003 
00004 #line 2 "machine/sparc/sparc.pat.m"
00005 /*==============================================
00006  * FILE:      sparc.pat.m
00007  * OVERVIEW:  Generated file; do not edit
00008  *
00009  * (C) 1998-2000 The University of Queensland, BT group
00010  *==============================================*/
00011 
00012 #include "global.h"
00013 #include "decoder.h"
00014 #include "sparc.pat.h"
00015 #include "ss.h"
00016 #include "csr.h"
00017 
00018 #define VAR true
00019 #define VAL false
00020 int InstructionPatterns::SP = 14;
00021 int InstructionPatterns::FP = 30;
00022 int InstructionPatterns::o0 = 8;
00023 int InstructionPatterns::i0 = 24;
00024 int InstructionPatterns::i7 = 31;
00025 int InstructionPatterns::o7 = 15;
00026 int InstructionPatterns::g0 = 0;
00027 bool InstructionPatterns::ADD$imode(ADDRESS& lc, int& a, bool a_isVAR, int& b, bool b_isVAR, int& c, bool c_isVAR) {
00028     ADDRESS nextPC;
00029 
00030 
00031 #line 25 "machine/sparc/sparc.pat.m"
00032 { 
00033   dword MATCH_p = 
00034     
00035     #line 25 "machine/sparc/sparc.pat.m"
00036     lc
00037     ;
00038   unsigned MATCH_w_32_0;
00039   { 
00040     MATCH_w_32_0 = getDword(MATCH_p); 
00041     if (0 <= (MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ && 
00042       (MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ < 2 || 
00043       (MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ == 3 || 
00044       (MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ == 2 && 
00045       (1 <= (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ && 
00046       (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ < 64)) 
00047       goto MATCH_label_u0;  /*opt-block+*/
00048     else { 
00049       unsigned _a = (MATCH_w_32_0 >> 14 & 0x1f) /* rs1 at 0 */;
00050       unsigned _b = addressToPC(MATCH_p);
00051       unsigned _c = (MATCH_w_32_0 >> 25 & 0x1f) /* rd at 0 */;
00052       nextPC = 4 + MATCH_p; 
00053       
00054       #line 27 "machine/sparc/sparc.pat.m"
00055       
00056 
00057             if (!a_isVAR && (int)_a != a) return false; else a = _a;
00058 
00059             if (!imode(_b, b, b_isVAR)) return false;
00060 
00061             if (!c_isVAR && (int)_c != c) return false; else c = _c;
00062 
00063             lc = nextPC;
00064 
00065             return true;
00066 
00067       
00068       
00069       
00070     } /*opt-block*//*opt-block+*/
00071     
00072   }goto MATCH_finished_u; 
00073   
00074   MATCH_label_u0: (void)0; /*placeholder for label*/ 
00075     { 
00076       nextPC = MATCH_p; 
00077       
00078       #line 32 "machine/sparc/sparc.pat.m"
00079       
00080             return false;
00081 
00082       
00083       
00084       
00085     } 
00086     goto MATCH_finished_u; 
00087     
00088   MATCH_finished_u: (void)0; /*placeholder for label*/
00089   
00090 }
00091 
00092 #line 36 "machine/sparc/sparc.pat.m"
00093 }
00094 bool InstructionPatterns::ADD$rmode(ADDRESS& lc, int& a, bool a_isVAR, int& b, bool b_isVAR, int& c, bool c_isVAR) {
00095     ADDRESS nextPC;
00096 
00097 
00098 #line 38 "machine/sparc/sparc.pat.m"
00099 { 
00100   dword MATCH_p = 
00101     
00102     #line 38 "machine/sparc/sparc.pat.m"
00103     lc
00104     ;
00105   unsigned MATCH_w_32_0;
00106   { 
00107     MATCH_w_32_0 = getDword(MATCH_p); 
00108     if (0 <= (MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ && 
00109       (MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ < 2 || 
00110       (MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ == 3 || 
00111       (MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ == 2 && 
00112       (1 <= (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ && 
00113       (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ < 64)) 
00114       goto MATCH_label_t0;  /*opt-block+*/
00115     else { 
00116       unsigned _a = (MATCH_w_32_0 >> 14 & 0x1f) /* rs1 at 0 */;
00117       unsigned _b = addressToPC(MATCH_p);
00118       unsigned _c = (MATCH_w_32_0 >> 25 & 0x1f) /* rd at 0 */;
00119       nextPC = 4 + MATCH_p; 
00120       
00121       #line 40 "machine/sparc/sparc.pat.m"
00122       
00123 
00124             if (!a_isVAR && (int)_a != a) return false; else a = _a;
00125 
00126             if (!rmode(_b, b, b_isVAR)) return false;
00127 
00128             if (!c_isVAR && (int)_c != c) return false; else c = _c;
00129 
00130             lc = nextPC;
00131 
00132             return true;
00133 
00134       
00135       
00136       
00137     } /*opt-block*//*opt-block+*/
00138     
00139   }goto MATCH_finished_t; 
00140   
00141   MATCH_label_t0: (void)0; /*placeholder for label*/ 
00142     { 
00143       nextPC = MATCH_p; 
00144       
00145       #line 45 "machine/sparc/sparc.pat.m"
00146       
00147             return false;
00148 
00149       
00150       
00151       
00152     } 
00153     goto MATCH_finished_t; 
00154     
00155   MATCH_finished_t: (void)0; /*placeholder for label*/
00156   
00157 }
00158 
00159 #line 49 "machine/sparc/sparc.pat.m"
00160 }
00161 bool InstructionPatterns::JMPL$dispA(ADDRESS& lc, int& a, bool a_isVAR, int& b, bool b_isVAR, int& c, bool c_isVAR) {
00162     ADDRESS nextPC;
00163 
00164 
00165 #line 51 "machine/sparc/sparc.pat.m"
00166 { 
00167   dword MATCH_p = 
00168     
00169     #line 51 "machine/sparc/sparc.pat.m"
00170     lc
00171     ;
00172   unsigned MATCH_w_32_0;
00173   { 
00174     MATCH_w_32_0 = getDword(MATCH_p); 
00175     if ((MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ == 2 && 
00176       (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ == 56 && 
00177       (0 <= (MATCH_w_32_0 >> 13 & 0x1) /* i at 0 */ && 
00178       (MATCH_w_32_0 >> 13 & 0x1) /* i at 0 */ < 2)) { 
00179       unsigned _a = addressToPC(MATCH_p);
00180       unsigned _b = (MATCH_w_32_0 >> 25 & 0x1f) /* rd at 0 */;
00181       nextPC = 4 + MATCH_p; 
00182       
00183       #line 53 "machine/sparc/sparc.pat.m"
00184       
00185 
00186             if (!dispA(_a, a, a_isVAR, b, b_isVAR)) return false;
00187 
00188             if (!c_isVAR && (int)_b != c) return false; else c = _b;
00189 
00190             lc = nextPC;
00191 
00192             return true;
00193 
00194       
00195       
00196       
00197     } /*opt-block*//*opt-block+*/
00198     else 
00199       goto MATCH_label_s0;  /*opt-block+*/
00200     
00201   }goto MATCH_finished_s; 
00202   
00203   MATCH_label_s0: (void)0; /*placeholder for label*/ 
00204     { 
00205       nextPC = MATCH_p; 
00206       
00207       #line 57 "machine/sparc/sparc.pat.m"
00208       
00209             return false;
00210 
00211       
00212       
00213       
00214     } 
00215     goto MATCH_finished_s; 
00216     
00217   MATCH_finished_s: (void)0; /*placeholder for label*/
00218   
00219 }
00220 
00221 #line 61 "machine/sparc/sparc.pat.m"
00222 }
00223 bool InstructionPatterns::JMPL$indirectA(ADDRESS& lc, int& a, bool a_isVAR, int& b, bool b_isVAR) {
00224     ADDRESS nextPC;
00225 
00226 
00227 #line 63 "machine/sparc/sparc.pat.m"
00228 { 
00229   dword MATCH_p = 
00230     
00231     #line 63 "machine/sparc/sparc.pat.m"
00232     lc
00233     ;
00234   unsigned MATCH_w_32_0;
00235   { 
00236     MATCH_w_32_0 = getDword(MATCH_p); 
00237     if ((MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ == 2 && 
00238       (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ == 56 && 
00239       (0 <= (MATCH_w_32_0 >> 13 & 0x1) /* i at 0 */ && 
00240       (MATCH_w_32_0 >> 13 & 0x1) /* i at 0 */ < 2)) { 
00241       unsigned _a = addressToPC(MATCH_p);
00242       unsigned _b = (MATCH_w_32_0 >> 25 & 0x1f) /* rd at 0 */;
00243       nextPC = 4 + MATCH_p; 
00244       
00245       #line 65 "machine/sparc/sparc.pat.m"
00246       
00247 
00248             if (!indirectA(_a, a, a_isVAR)) return false;
00249 
00250             if (!b_isVAR && (int)_b != b) return false; else b = _b;
00251 
00252             lc = nextPC;
00253 
00254             return true;
00255 
00256       
00257       
00258       
00259     } /*opt-block*//*opt-block+*/
00260     else 
00261       goto MATCH_label_r0;  /*opt-block+*/
00262     
00263   }goto MATCH_finished_r; 
00264   
00265   MATCH_label_r0: (void)0; /*placeholder for label*/ 
00266     { 
00267       nextPC = MATCH_p; 
00268       
00269       #line 69 "machine/sparc/sparc.pat.m"
00270       
00271             return false;
00272 
00273       
00274       
00275       
00276     } 
00277     goto MATCH_finished_r; 
00278     
00279   MATCH_finished_r: (void)0; /*placeholder for label*/
00280   
00281 }
00282 
00283 #line 73 "machine/sparc/sparc.pat.m"
00284 }
00285 bool InstructionPatterns::OR$imode(ADDRESS& lc, int& a, bool a_isVAR, int& b, bool b_isVAR, int& c, bool c_isVAR) {
00286     ADDRESS nextPC;
00287 
00288 
00289 #line 75 "machine/sparc/sparc.pat.m"
00290 { 
00291   dword MATCH_p = 
00292     
00293     #line 75 "machine/sparc/sparc.pat.m"
00294     lc
00295     ;
00296   unsigned MATCH_w_32_0;
00297   { 
00298     MATCH_w_32_0 = getDword(MATCH_p); 
00299     if ((MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ == 2 && 
00300       (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ == 2 && 
00301       (0 <= (MATCH_w_32_0 >> 13 & 0x1) /* i at 0 */ && 
00302       (MATCH_w_32_0 >> 13 & 0x1) /* i at 0 */ < 2)) { 
00303       unsigned _a = (MATCH_w_32_0 >> 14 & 0x1f) /* rs1 at 0 */;
00304       unsigned _b = addressToPC(MATCH_p);
00305       unsigned _c = (MATCH_w_32_0 >> 25 & 0x1f) /* rd at 0 */;
00306       nextPC = 4 + MATCH_p; 
00307       
00308       #line 77 "machine/sparc/sparc.pat.m"
00309       
00310 
00311             if (!a_isVAR && (int)_a != a) return false; else a = _a;
00312 
00313             if (!imode(_b, b, b_isVAR)) return false;
00314 
00315             if (!c_isVAR && (int)_c != c) return false; else c = _c;
00316 
00317             lc = nextPC;
00318 
00319             return true;
00320 
00321       
00322       
00323       
00324     } /*opt-block*//*opt-block+*/
00325     else 
00326       goto MATCH_label_q0;  /*opt-block+*/
00327     
00328   }goto MATCH_finished_q; 
00329   
00330   MATCH_label_q0: (void)0; /*placeholder for label*/ 
00331     { 
00332       nextPC = MATCH_p; 
00333       
00334       #line 82 "machine/sparc/sparc.pat.m"
00335       
00336             return false;
00337 
00338       
00339       
00340       
00341     } 
00342     goto MATCH_finished_q; 
00343     
00344   MATCH_finished_q: (void)0; /*placeholder for label*/
00345   
00346 }
00347 
00348 #line 86 "machine/sparc/sparc.pat.m"
00349 }
00350 bool InstructionPatterns::RESTORE$imode(ADDRESS& lc, int& a, bool a_isVAR, int& b, bool b_isVAR, int& c, bool c_isVAR) {
00351     ADDRESS nextPC;
00352 
00353 
00354 #line 88 "machine/sparc/sparc.pat.m"
00355 { 
00356   dword MATCH_p = 
00357     
00358     #line 88 "machine/sparc/sparc.pat.m"
00359     lc
00360     ;
00361   unsigned MATCH_w_32_0;
00362   { 
00363     MATCH_w_32_0 = getDword(MATCH_p); 
00364     if ((MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ == 2 && 
00365       (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ == 61 && 
00366       (0 <= (MATCH_w_32_0 >> 13 & 0x1) /* i at 0 */ && 
00367       (MATCH_w_32_0 >> 13 & 0x1) /* i at 0 */ < 2)) { 
00368       unsigned _a = (MATCH_w_32_0 >> 14 & 0x1f) /* rs1 at 0 */;
00369       unsigned _b = addressToPC(MATCH_p);
00370       unsigned _c = (MATCH_w_32_0 >> 25 & 0x1f) /* rd at 0 */;
00371       nextPC = 4 + MATCH_p; 
00372       
00373       #line 90 "machine/sparc/sparc.pat.m"
00374       
00375 
00376             if (!a_isVAR && (int)_a != a) return false; else a = _a;
00377 
00378             if (!imode(_b, b, b_isVAR)) return false;
00379 
00380             if (!c_isVAR && (int)_c != c) return false; else c = _c;
00381 
00382             lc = nextPC;
00383 
00384             return true;
00385 
00386       
00387       
00388       
00389     } /*opt-block*//*opt-block+*/
00390     else 
00391       goto MATCH_label_p0;  /*opt-block+*/
00392     
00393   }goto MATCH_finished_p; 
00394   
00395   MATCH_label_p0: (void)0; /*placeholder for label*/ 
00396     { 
00397       nextPC = MATCH_p; 
00398       
00399       #line 95 "machine/sparc/sparc.pat.m"
00400       
00401             return false;
00402 
00403       
00404       
00405       
00406     } 
00407     goto MATCH_finished_p; 
00408     
00409   MATCH_finished_p: (void)0; /*placeholder for label*/
00410   
00411 }
00412 
00413 #line 99 "machine/sparc/sparc.pat.m"
00414 }
00415 bool InstructionPatterns::RESTORE$rmode(ADDRESS& lc, int& a, bool a_isVAR, int& b, bool b_isVAR, int& c, bool c_isVAR) {
00416     ADDRESS nextPC;
00417 
00418 
00419 #line 101 "machine/sparc/sparc.pat.m"
00420 { 
00421   dword MATCH_p = 
00422     
00423     #line 101 "machine/sparc/sparc.pat.m"
00424     lc
00425     ;
00426   unsigned MATCH_w_32_0;
00427   { 
00428     MATCH_w_32_0 = getDword(MATCH_p); 
00429     if ((MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ == 2 && 
00430       (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ == 61 && 
00431       (0 <= (MATCH_w_32_0 >> 13 & 0x1) /* i at 0 */ && 
00432       (MATCH_w_32_0 >> 13 & 0x1) /* i at 0 */ < 2)) { 
00433       unsigned _a = (MATCH_w_32_0 >> 14 & 0x1f) /* rs1 at 0 */;
00434       unsigned _b = addressToPC(MATCH_p);
00435       unsigned _c = (MATCH_w_32_0 >> 25 & 0x1f) /* rd at 0 */;
00436       nextPC = 4 + MATCH_p; 
00437       
00438       #line 103 "machine/sparc/sparc.pat.m"
00439       
00440 
00441             if (!a_isVAR && (int)_a != a) return false; else a = _a;
00442 
00443             if (!rmode(_b, b, b_isVAR)) return false;
00444 
00445             if (!c_isVAR && (int)_c != c) return false; else c = _c;
00446 
00447             lc = nextPC;
00448 
00449             return true;
00450 
00451       
00452       
00453       
00454     } /*opt-block*//*opt-block+*/
00455     else 
00456       goto MATCH_label_o0;  /*opt-block+*/
00457     
00458   }goto MATCH_finished_o; 
00459   
00460   MATCH_label_o0: (void)0; /*placeholder for label*/ 
00461     { 
00462       nextPC = MATCH_p; 
00463       
00464       #line 108 "machine/sparc/sparc.pat.m"
00465       
00466             return false;
00467 
00468       
00469       
00470       
00471     } 
00472     goto MATCH_finished_o; 
00473     
00474   MATCH_finished_o: (void)0; /*placeholder for label*/
00475   
00476 }
00477 
00478 #line 112 "machine/sparc/sparc.pat.m"
00479 }
00480 bool InstructionPatterns::SAVE$imode(ADDRESS& lc, int& a, bool a_isVAR, int& b, bool b_isVAR, int& c, bool c_isVAR) {
00481     ADDRESS nextPC;
00482 
00483 
00484 #line 114 "machine/sparc/sparc.pat.m"
00485 { 
00486   dword MATCH_p = 
00487     
00488     #line 114 "machine/sparc/sparc.pat.m"
00489     lc
00490     ;
00491   unsigned MATCH_w_32_0;
00492   { 
00493     MATCH_w_32_0 = getDword(MATCH_p); 
00494     if ((MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ == 2 && 
00495       (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ == 60 && 
00496       (0 <= (MATCH_w_32_0 >> 13 & 0x1) /* i at 0 */ && 
00497       (MATCH_w_32_0 >> 13 & 0x1) /* i at 0 */ < 2)) { 
00498       unsigned _a = (MATCH_w_32_0 >> 14 & 0x1f) /* rs1 at 0 */;
00499       unsigned _b = addressToPC(MATCH_p);
00500       unsigned _c = (MATCH_w_32_0 >> 25 & 0x1f) /* rd at 0 */;
00501       nextPC = 4 + MATCH_p; 
00502       
00503       #line 116 "machine/sparc/sparc.pat.m"
00504       
00505 
00506             if (!a_isVAR && (int)_a != a) return false; else a = _a;
00507 
00508             if (!imode(_b, b, b_isVAR)) return false;
00509 
00510             if (!c_isVAR && (int)_c != c) return false; else c = _c;
00511 
00512             lc = nextPC;
00513 
00514             return true;
00515 
00516       
00517       
00518       
00519     } /*opt-block*//*opt-block+*/
00520     else 
00521       goto MATCH_label_n0;  /*opt-block+*/
00522     
00523   }goto MATCH_finished_n; 
00524   
00525   MATCH_label_n0: (void)0; /*placeholder for label*/ 
00526     { 
00527       nextPC = MATCH_p; 
00528       
00529       #line 121 "machine/sparc/sparc.pat.m"
00530       
00531             return false;
00532 
00533       
00534       
00535       
00536     } 
00537     goto MATCH_finished_n; 
00538     
00539   MATCH_finished_n: (void)0; /*placeholder for label*/
00540   
00541 }
00542 
00543 #line 125 "machine/sparc/sparc.pat.m"
00544 }
00545 bool InstructionPatterns::SAVE$rmode(ADDRESS& lc, int& a, bool a_isVAR, int& b, bool b_isVAR, int& c, bool c_isVAR) {
00546     ADDRESS nextPC;
00547 
00548 
00549 #line 127 "machine/sparc/sparc.pat.m"
00550 { 
00551   dword MATCH_p = 
00552     
00553     #line 127 "machine/sparc/sparc.pat.m"
00554     lc
00555     ;
00556   unsigned MATCH_w_32_0;
00557   { 
00558     MATCH_w_32_0 = getDword(MATCH_p); 
00559     if ((MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ == 2 && 
00560       (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ == 60 && 
00561       (0 <= (MATCH_w_32_0 >> 13 & 0x1) /* i at 0 */ && 
00562       (MATCH_w_32_0 >> 13 & 0x1) /* i at 0 */ < 2)) { 
00563       unsigned _a = (MATCH_w_32_0 >> 14 & 0x1f) /* rs1 at 0 */;
00564       unsigned _b = addressToPC(MATCH_p);
00565       unsigned _c = (MATCH_w_32_0 >> 25 & 0x1f) /* rd at 0 */;
00566       nextPC = 4 + MATCH_p; 
00567       
00568       #line 129 "machine/sparc/sparc.pat.m"
00569       
00570 
00571             if (!a_isVAR && (int)_a != a) return false; else a = _a;
00572 
00573             if (!rmode(_b, b, b_isVAR)) return false;
00574 
00575             if (!c_isVAR && (int)_c != c) return false; else c = _c;
00576 
00577             lc = nextPC;
00578 
00579             return true;
00580 
00581       
00582       
00583       
00584     } /*opt-block*//*opt-block+*/
00585     else 
00586       goto MATCH_label_m0;  /*opt-block+*/
00587     
00588   }goto MATCH_finished_m; 
00589   
00590   MATCH_label_m0: (void)0; /*placeholder for label*/ 
00591     { 
00592       nextPC = MATCH_p; 
00593       
00594       #line 134 "machine/sparc/sparc.pat.m"
00595       
00596             return false;
00597 
00598       
00599       
00600       
00601     } 
00602     goto MATCH_finished_m; 
00603     
00604   MATCH_finished_m: (void)0; /*placeholder for label*/
00605   
00606 }
00607 
00608 #line 138 "machine/sparc/sparc.pat.m"
00609 }
00610 bool InstructionPatterns::SUB$imode(ADDRESS& lc, int& a, bool a_isVAR, int& b, bool b_isVAR, int& c, bool c_isVAR) {
00611     ADDRESS nextPC;
00612 
00613 
00614 #line 140 "machine/sparc/sparc.pat.m"
00615 { 
00616   dword MATCH_p = 
00617     
00618     #line 140 "machine/sparc/sparc.pat.m"
00619     lc
00620     ;
00621   unsigned MATCH_w_32_0;
00622   { 
00623     MATCH_w_32_0 = getDword(MATCH_p); 
00624     if ((MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ == 2 && 
00625       (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ == 4 && 
00626       (0 <= (MATCH_w_32_0 >> 13 & 0x1) /* i at 0 */ && 
00627       (MATCH_w_32_0 >> 13 & 0x1) /* i at 0 */ < 2)) { 
00628       unsigned _a = (MATCH_w_32_0 >> 14 & 0x1f) /* rs1 at 0 */;
00629       unsigned _b = addressToPC(MATCH_p);
00630       unsigned _c = (MATCH_w_32_0 >> 25 & 0x1f) /* rd at 0 */;
00631       nextPC = 4 + MATCH_p; 
00632       
00633       #line 142 "machine/sparc/sparc.pat.m"
00634       
00635 
00636             if (!a_isVAR && (int)_a != a) return false; else a = _a;
00637 
00638             if (!imode(_b, b, b_isVAR)) return false;
00639 
00640             if (!c_isVAR && (int)_c != c) return false; else c = _c;
00641 
00642             lc = nextPC;
00643 
00644             return true;
00645 
00646       
00647       
00648       
00649     } /*opt-block*//*opt-block+*/
00650     else 
00651       goto MATCH_label_l0;  /*opt-block+*/
00652     
00653   }goto MATCH_finished_l; 
00654   
00655   MATCH_label_l0: (void)0; /*placeholder for label*/ 
00656     { 
00657       nextPC = MATCH_p; 
00658       
00659       #line 147 "machine/sparc/sparc.pat.m"
00660       
00661             return false;
00662 
00663       
00664       
00665       
00666     } 
00667     goto MATCH_finished_l; 
00668     
00669   MATCH_finished_l: (void)0; /*placeholder for label*/
00670   
00671 }
00672 
00673 #line 151 "machine/sparc/sparc.pat.m"
00674 }
00675 bool InstructionPatterns::UNIMP(ADDRESS& lc, int& a, bool a_isVAR) {
00676     ADDRESS nextPC;
00677 
00678 
00679 #line 153 "machine/sparc/sparc.pat.m"
00680 { 
00681   dword MATCH_p = 
00682     
00683     #line 153 "machine/sparc/sparc.pat.m"
00684     lc
00685     ;
00686   unsigned MATCH_w_32_0;
00687   { 
00688     MATCH_w_32_0 = getDword(MATCH_p); 
00689     if ((MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ == 0 && 
00690       (MATCH_w_32_0 >> 22 & 0x7) /* op2 at 0 */ == 0) { 
00691       unsigned _a = (MATCH_w_32_0 & 0x3fffff) /* imm22 at 0 */;
00692       nextPC = 4 + MATCH_p; 
00693       
00694       #line 155 "machine/sparc/sparc.pat.m"
00695       
00696 
00697             if (!a_isVAR && (int)_a != a) return false; else a = _a;
00698 
00699             lc = nextPC;
00700 
00701             return true;
00702 
00703       
00704       
00705       
00706     } /*opt-block*//*opt-block+*/
00707     else 
00708       goto MATCH_label_k0;  /*opt-block+*/
00709     
00710   }goto MATCH_finished_k; 
00711   
00712   MATCH_label_k0: (void)0; /*placeholder for label*/ 
00713     { 
00714       nextPC = MATCH_p; 
00715       
00716       #line 158 "machine/sparc/sparc.pat.m"
00717       
00718             return false;
00719 
00720       
00721       
00722       
00723     } 
00724     goto MATCH_finished_k; 
00725     
00726   MATCH_finished_k: (void)0; /*placeholder for label*/
00727   
00728 }
00729 
00730 #line 162 "machine/sparc/sparc.pat.m"
00731 }
00732 bool InstructionPatterns::call__(ADDRESS& lc, int& a, bool a_isVAR) {
00733     ADDRESS nextPC;
00734 
00735 
00736 #line 164 "machine/sparc/sparc.pat.m"
00737 { 
00738   dword MATCH_p = 
00739     
00740     #line 164 "machine/sparc/sparc.pat.m"
00741     lc
00742     ;
00743   unsigned MATCH_w_32_0;
00744   { 
00745     MATCH_w_32_0 = getDword(MATCH_p); 
00746     if ((MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ == 1) { 
00747       unsigned _a = 
00748         4 * sign_extend((MATCH_w_32_0 & 0x3fffffff) /* disp30 at 0 */, 30) + 
00749         addressToPC(MATCH_p);
00750       nextPC = 4 + MATCH_p; 
00751       
00752       #line 166 "machine/sparc/sparc.pat.m"
00753       
00754 
00755             if (!a_isVAR && (int)_a != a) return false; else a = _a;
00756 
00757             lc = nextPC;
00758 
00759             return true;
00760 
00761       
00762       
00763       
00764     } /*opt-block*//*opt-block+*/
00765     else { 
00766       nextPC = MATCH_p; 
00767       
00768       #line 169 "machine/sparc/sparc.pat.m"
00769       
00770             return false;
00771 
00772       
00773       
00774       
00775     } /*opt-block*//*opt-block+*/
00776     
00777   }goto MATCH_finished_j; 
00778   
00779   MATCH_finished_j: (void)0; /*placeholder for label*/
00780   
00781 }
00782 
00783 #line 172 "machine/sparc/sparc.pat.m"
00784 }
00785 bool InstructionPatterns::dispA(ADDRESS& lc, int& a, bool a_isVAR, int& b, bool b_isVAR) {
00786 
00787 
00788 #line 174 "machine/sparc/sparc.pat.m"
00789 { 
00790   dword MATCH_p = 
00791     
00792     #line 174 "machine/sparc/sparc.pat.m"
00793     lc
00794     ;
00795   unsigned MATCH_w_32_0;
00796   { 
00797     MATCH_w_32_0 = getDword(MATCH_p); 
00798     if ((MATCH_w_32_0 >> 13 & 0x1) /* i at 0 */ == 1) { 
00799       unsigned _a = (MATCH_w_32_0 >> 14 & 0x1f) /* rs1 at 0 */;
00800       int /* [~4096..4095] */ _b = 
00801         sign_extend((MATCH_w_32_0 & 0x1fff) /* simm13 at 0 */, 13);
00802       
00803       #line 176 "machine/sparc/sparc.pat.m"
00804       
00805 
00806             if (!a_isVAR && (int)_a != a) return false; else a = _a;
00807 
00808             if (!b_isVAR && (int)_b != b) return false; else b = _b;
00809 
00810             return true;
00811 
00812       
00813       
00814       
00815     } /*opt-block*//*opt-block+*/
00816     else 
00817       
00818       #line 179 "machine/sparc/sparc.pat.m"
00819       
00820             return false;
00821 
00822       
00823        /*opt-block+*/
00824     
00825   }goto MATCH_finished_i; 
00826   
00827   MATCH_finished_i: (void)0; /*placeholder for label*/
00828   
00829 }
00830 
00831 #line 182 "machine/sparc/sparc.pat.m"
00832 }
00833 bool InstructionPatterns::imode(ADDRESS& lc, int& a, bool a_isVAR) {
00834 
00835 
00836 #line 184 "machine/sparc/sparc.pat.m"
00837 { 
00838   dword MATCH_p = 
00839     
00840     #line 184 "machine/sparc/sparc.pat.m"
00841     lc
00842     ;
00843   unsigned MATCH_w_32_0;
00844   { 
00845     MATCH_w_32_0 = getDword(MATCH_p); 
00846     if ((MATCH_w_32_0 >> 13 & 0x1) /* i at 0 */ == 1) { 
00847       int /* [~4096..4095] */ _a = 
00848         sign_extend((MATCH_w_32_0 & 0x1fff) /* simm13 at 0 */, 13);
00849       
00850       #line 186 "machine/sparc/sparc.pat.m"
00851       
00852 
00853             if (!a_isVAR && (int)_a != a) return false; else a = _a;
00854 
00855             return true;
00856 
00857       
00858       
00859       
00860     } /*opt-block*//*opt-block+*/
00861     else 
00862       
00863       #line 188 "machine/sparc/sparc.pat.m"
00864       
00865             return false;
00866 
00867       
00868        /*opt-block+*/
00869     
00870   }goto MATCH_finished_h; 
00871   
00872   MATCH_finished_h: (void)0; /*placeholder for label*/
00873   
00874 }
00875 
00876 #line 191 "machine/sparc/sparc.pat.m"
00877 }
00878 bool InstructionPatterns::indirectA(ADDRESS& lc, int& a, bool a_isVAR) {
00879 
00880 
00881 #line 193 "machine/sparc/sparc.pat.m"
00882 { 
00883   dword MATCH_p = 
00884     
00885     #line 193 "machine/sparc/sparc.pat.m"
00886     lc
00887     ;
00888   unsigned MATCH_w_32_0;
00889   { 
00890     MATCH_w_32_0 = getDword(MATCH_p); 
00891     if ((MATCH_w_32_0 >> 13 & 0x1) /* i at 0 */ == 0 && 
00892       (1 <= (MATCH_w_32_0 & 0x1f) /* rs2 at 0 */ && 
00893       (MATCH_w_32_0 & 0x1f) /* rs2 at 0 */ < 32) || 
00894       (MATCH_w_32_0 >> 13 & 0x1) /* i at 0 */ == 1) 
00895       goto MATCH_label_g0;  /*opt-block+*/
00896     else { 
00897       unsigned _a = (MATCH_w_32_0 >> 14 & 0x1f) /* rs1 at 0 */;
00898       
00899       #line 195 "machine/sparc/sparc.pat.m"
00900       
00901 
00902             if (!a_isVAR && (int)_a != a) return false; else a = _a;
00903 
00904             return true;
00905 
00906       
00907       
00908       
00909     } /*opt-block*//*opt-block+*/
00910     
00911   }goto MATCH_finished_g; 
00912   
00913   MATCH_label_g0: (void)0; /*placeholder for label*/ 
00914     
00915     #line 197 "machine/sparc/sparc.pat.m"
00916     
00917             return false;
00918 
00919     
00920      
00921     goto MATCH_finished_g; 
00922     
00923   MATCH_finished_g: (void)0; /*placeholder for label*/
00924   
00925 }
00926 
00927 #line 201 "machine/sparc/sparc.pat.m"
00928 }
00929 bool InstructionPatterns::mov_(ADDRESS& lc, int& a, bool a_isVAR, int& b, bool b_isVAR) {
00930     ADDRESS nextPC;
00931 
00932 
00933 #line 203 "machine/sparc/sparc.pat.m"
00934 { 
00935   dword MATCH_p = 
00936     
00937     #line 203 "machine/sparc/sparc.pat.m"
00938     lc
00939     ;
00940   unsigned MATCH_w_32_0;
00941   { 
00942     MATCH_w_32_0 = getDword(MATCH_p); 
00943     if ((MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ == 2 && 
00944       (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ == 2 && 
00945       (MATCH_w_32_0 >> 13 & 0x1) /* i at 0 */ == 0 && 
00946       (MATCH_w_32_0 >> 14 & 0x1f) /* rs1 at 0 */ == 0) { 
00947       unsigned _a = (MATCH_w_32_0 & 0x1f) /* rs2 at 0 */;
00948       unsigned _b = (MATCH_w_32_0 >> 25 & 0x1f) /* rd at 0 */;
00949       nextPC = 4 + MATCH_p; 
00950       
00951       #line 205 "machine/sparc/sparc.pat.m"
00952       
00953 
00954             if (!a_isVAR && (int)_a != a) return false; else a = _a;
00955 
00956             if (!b_isVAR && (int)_b != b) return false; else b = _b;
00957 
00958             lc = nextPC;
00959 
00960             return true;
00961 
00962       
00963       
00964       
00965     } /*opt-block*//*opt-block+*/
00966     else 
00967       goto MATCH_label_f0;  /*opt-block+*/
00968     
00969   }goto MATCH_finished_f; 
00970   
00971   MATCH_label_f0: (void)0; /*placeholder for label*/ 
00972     { 
00973       nextPC = MATCH_p; 
00974       
00975       #line 209 "machine/sparc/sparc.pat.m"
00976       
00977             return false;
00978 
00979       
00980       
00981       
00982     } 
00983     goto MATCH_finished_f; 
00984     
00985   MATCH_finished_f: (void)0; /*placeholder for label*/
00986   
00987 }
00988 
00989 #line 213 "machine/sparc/sparc.pat.m"
00990 }
00991 bool InstructionPatterns::restore_(ADDRESS& lc) {
00992     ADDRESS nextPC;
00993 
00994 
00995 #line 215 "machine/sparc/sparc.pat.m"
00996 { 
00997   dword MATCH_p = 
00998     
00999     #line 215 "machine/sparc/sparc.pat.m"
01000     lc
01001     ;
01002   unsigned MATCH_w_32_0;
01003   { 
01004     MATCH_w_32_0 = getDword(MATCH_p); 
01005     if (0 <= (MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ && 
01006       (MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ < 2 || 
01007       (MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ == 3 || 
01008       (MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ == 2 && 
01009       (0 <= (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ && 
01010       (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ < 61 || 
01011       62 <= (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ && 
01012       (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ < 64) || 
01013       (MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ == 2 && 
01014       (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ == 61 && 
01015       (MATCH_w_32_0 >> 13 & 0x1) /* i at 0 */ == 0 && 
01016       (MATCH_w_32_0 >> 25 & 0x1f) /* rd at 0 */ == 0 && 
01017       (MATCH_w_32_0 >> 14 & 0x1f) /* rs1 at 0 */ == 0 && 
01018       (1 <= (MATCH_w_32_0 & 0x1f) /* rs2 at 0 */ && 
01019       (MATCH_w_32_0 & 0x1f) /* rs2 at 0 */ < 32) || 
01020       (MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ == 2 && 
01021       (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ == 61 && 
01022       (MATCH_w_32_0 >> 13 & 0x1) /* i at 0 */ == 0 && 
01023       (MATCH_w_32_0 >> 25 & 0x1f) /* rd at 0 */ == 0 && 
01024       (1 <= (MATCH_w_32_0 >> 14 & 0x1f) /* rs1 at 0 */ && 
01025       (MATCH_w_32_0 >> 14 & 0x1f) /* rs1 at 0 */ < 32) || 
01026       (MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ == 2 && 
01027       (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ == 61 && 
01028       (MATCH_w_32_0 >> 13 & 0x1) /* i at 0 */ == 0 && 
01029       (1 <= (MATCH_w_32_0 >> 25 & 0x1f) /* rd at 0 */ && 
01030       (MATCH_w_32_0 >> 25 & 0x1f) /* rd at 0 */ < 32) || 
01031       (MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ == 2 && 
01032       (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ == 61 && 
01033       (MATCH_w_32_0 >> 13 & 0x1) /* i at 0 */ == 1) 
01034       goto MATCH_label_e0;  /*opt-block+*/
01035     else { 
01036       nextPC = 4 + MATCH_p; 
01037       
01038       #line 217 "machine/sparc/sparc.pat.m"
01039       
01040 
01041             lc = nextPC;
01042 
01043             return true;
01044 
01045       
01046       
01047       
01048     } /*opt-block*//*opt-block+*/
01049     
01050   }goto MATCH_finished_e; 
01051   
01052   MATCH_label_e0: (void)0; /*placeholder for label*/ 
01053     { 
01054       nextPC = MATCH_p; 
01055       
01056       #line 219 "machine/sparc/sparc.pat.m"
01057       
01058             return false;
01059 
01060       
01061       
01062       
01063     } 
01064     goto MATCH_finished_e; 
01065     
01066   MATCH_finished_e: (void)0; /*placeholder for label*/
01067   
01068 }
01069 
01070 #line 223 "machine/sparc/sparc.pat.m"
01071 }
01072 bool InstructionPatterns::ret(ADDRESS& lc) {
01073     ADDRESS nextPC;
01074 
01075 
01076 #line 225 "machine/sparc/sparc.pat.m"
01077 { 
01078   dword MATCH_p = 
01079     
01080     #line 225 "machine/sparc/sparc.pat.m"
01081     lc
01082     ;
01083   unsigned MATCH_w_32_0;
01084   { 
01085     MATCH_w_32_0 = getDword(MATCH_p); 
01086     if (0 <= (MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ && 
01087       (MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ < 2 || 
01088       (MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ == 3 || 
01089       (MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ == 2 && 
01090       (0 <= (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ && 
01091       (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ < 56 || 
01092       57 <= (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ && 
01093       (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ < 64) || 
01094       (MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ == 2 && 
01095       (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ == 56 && 
01096       (0 <= (MATCH_w_32_0 & 0x1fff) /* simm13 at 0 */ && 
01097       (MATCH_w_32_0 & 0x1fff) /* simm13 at 0 */ < 8 || 
01098       9 <= (MATCH_w_32_0 & 0x1fff) /* simm13 at 0 */ && 
01099       (MATCH_w_32_0 & 0x1fff) /* simm13 at 0 */ < 8192) || 
01100       (MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ == 2 && 
01101       (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ == 56 && 
01102       (MATCH_w_32_0 & 0x1fff) /* simm13 at 0 */ == 8 && 
01103       (MATCH_w_32_0 >> 13 & 0x1) /* i at 0 */ == 0 || 
01104       (MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ == 2 && 
01105       (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ == 56 && 
01106       (MATCH_w_32_0 & 0x1fff) /* simm13 at 0 */ == 8 && 
01107       (MATCH_w_32_0 >> 13 & 0x1) /* i at 0 */ == 1 && 
01108       (MATCH_w_32_0 >> 25 & 0x1f) /* rd at 0 */ == 0 && 
01109       (0 <= (MATCH_w_32_0 >> 14 & 0x1f) /* rs1 at 0 */ && 
01110       (MATCH_w_32_0 >> 14 & 0x1f) /* rs1 at 0 */ < 31) || 
01111       (MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ == 2 && 
01112       (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ == 56 && 
01113       (MATCH_w_32_0 & 0x1fff) /* simm13 at 0 */ == 8 && 
01114       (MATCH_w_32_0 >> 13 & 0x1) /* i at 0 */ == 1 && 
01115       (1 <= (MATCH_w_32_0 >> 25 & 0x1f) /* rd at 0 */ && 
01116       (MATCH_w_32_0 >> 25 & 0x1f) /* rd at 0 */ < 32)) 
01117       goto MATCH_label_d0;  /*opt-block+*/
01118     else { 
01119       nextPC = 4 + MATCH_p; 
01120       
01121       #line 227 "machine/sparc/sparc.pat.m"
01122       
01123 
01124             lc = nextPC;
01125 
01126             return true;
01127 
01128       
01129       
01130       
01131     } /*opt-block*//*opt-block+*/
01132     
01133   }goto MATCH_finished_d; 
01134   
01135   MATCH_label_d0: (void)0; /*placeholder for label*/ 
01136     { 
01137       nextPC = MATCH_p; 
01138       
01139       #line 229 "machine/sparc/sparc.pat.m"
01140       
01141             return false;
01142 
01143       
01144       
01145       
01146     } 
01147     goto MATCH_finished_d; 
01148     
01149   MATCH_finished_d: (void)0; /*placeholder for label*/
01150   
01151 }
01152 
01153 #line 233 "machine/sparc/sparc.pat.m"
01154 }
01155 bool InstructionPatterns::retl(ADDRESS& lc) {
01156     ADDRESS nextPC;
01157 
01158 
01159 #line 235 "machine/sparc/sparc.pat.m"
01160 { 
01161   dword MATCH_p = 
01162     
01163     #line 235 "machine/sparc/sparc.pat.m"
01164     lc
01165     ;
01166   unsigned MATCH_w_32_0;
01167   { 
01168     MATCH_w_32_0 = getDword(MATCH_p); 
01169     if (0 <= (MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ && 
01170       (MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ < 2 || 
01171       (MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ == 3 || 
01172       (MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ == 2 && 
01173       (0 <= (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ && 
01174       (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ < 56 || 
01175       57 <= (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ && 
01176       (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ < 64) || 
01177       (MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ == 2 && 
01178       (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ == 56 && 
01179       (0 <= (MATCH_w_32_0 >> 14 & 0x1f) /* rs1 at 0 */ && 
01180       (MATCH_w_32_0 >> 14 & 0x1f) /* rs1 at 0 */ < 15 || 
01181       16 <= (MATCH_w_32_0 >> 14 & 0x1f) /* rs1 at 0 */ && 
01182       (MATCH_w_32_0 >> 14 & 0x1f) /* rs1 at 0 */ < 32) || 
01183       (MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ == 2 && 
01184       (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ == 56 && 
01185       (MATCH_w_32_0 >> 14 & 0x1f) /* rs1 at 0 */ == 15 && 
01186       (0 <= (MATCH_w_32_0 & 0x1fff) /* simm13 at 0 */ && 
01187       (MATCH_w_32_0 & 0x1fff) /* simm13 at 0 */ < 8 || 
01188       9 <= (MATCH_w_32_0 & 0x1fff) /* simm13 at 0 */ && 
01189       (MATCH_w_32_0 & 0x1fff) /* simm13 at 0 */ < 8192) || 
01190       (MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ == 2 && 
01191       (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ == 56 && 
01192       (MATCH_w_32_0 >> 14 & 0x1f) /* rs1 at 0 */ == 15 && 
01193       (MATCH_w_32_0 & 0x1fff) /* simm13 at 0 */ == 8 && 
01194       (MATCH_w_32_0 >> 13 & 0x1) /* i at 0 */ == 0 || 
01195       (MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ == 2 && 
01196       (MATCH_w_32_0 >> 19 & 0x3f) /* op3 at 0 */ == 56 && 
01197       (MATCH_w_32_0 >> 14 & 0x1f) /* rs1 at 0 */ == 15 && 
01198       (MATCH_w_32_0 & 0x1fff) /* simm13 at 0 */ == 8 && 
01199       (MATCH_w_32_0 >> 13 & 0x1) /* i at 0 */ == 1 && 
01200       (1 <= (MATCH_w_32_0 >> 25 & 0x1f) /* rd at 0 */ && 
01201       (MATCH_w_32_0 >> 25 & 0x1f) /* rd at 0 */ < 32)) 
01202       goto MATCH_label_c0;  /*opt-block+*/
01203     else { 
01204       nextPC = 4 + MATCH_p; 
01205       
01206       #line 237 "machine/sparc/sparc.pat.m"
01207       
01208 
01209             lc = nextPC;
01210 
01211             return true;
01212 
01213       
01214       
01215       
01216     } /*opt-block*//*opt-block+*/
01217     
01218   }goto MATCH_finished_c; 
01219   
01220   MATCH_label_c0: (void)0; /*placeholder for label*/ 
01221     { 
01222       nextPC = MATCH_p; 
01223       
01224       #line 239 "machine/sparc/sparc.pat.m"
01225       
01226             return false;
01227 
01228       
01229       
01230       
01231     } 
01232     goto MATCH_finished_c; 
01233     
01234   MATCH_finished_c: (void)0; /*placeholder for label*/
01235   
01236 }
01237 
01238 #line 242 "machine/sparc/sparc.pat.m"
01239 }
01240 bool InstructionPatterns::rmode(ADDRESS& lc, int& a, bool a_isVAR) {
01241 
01242 
01243 #line 244 "machine/sparc/sparc.pat.m"
01244 { 
01245   dword MATCH_p = 
01246     
01247     #line 244 "machine/sparc/sparc.pat.m"
01248     lc
01249     ;
01250   unsigned MATCH_w_32_0;
01251   { 
01252     MATCH_w_32_0 = getDword(MATCH_p); 
01253     if ((MATCH_w_32_0 >> 13 & 0x1) /* i at 0 */ == 1) 
01254       
01255       #line 248 "machine/sparc/sparc.pat.m"
01256       
01257             return false;
01258 
01259       
01260        /*opt-block+*/
01261     else { 
01262       unsigned _a = (MATCH_w_32_0 & 0x1f) /* rs2 at 0 */;
01263       
01264       #line 246 "machine/sparc/sparc.pat.m"
01265       
01266 
01267             if (!a_isVAR && (int)_a != a) return false; else a = _a;
01268 
01269             return true;
01270 
01271       
01272       
01273       
01274     } /*opt-block*//*opt-block+*/
01275     
01276   }goto MATCH_finished_b; 
01277   
01278   MATCH_finished_b: (void)0; /*placeholder for label*/
01279   
01280 }
01281 
01282 #line 252 "machine/sparc/sparc.pat.m"
01283 }
01284 bool InstructionPatterns::sethi(ADDRESS& lc, int& a, bool a_isVAR, int& b, bool b_isVAR) {
01285     ADDRESS nextPC;
01286 
01287 
01288 #line 254 "machine/sparc/sparc.pat.m"
01289 { 
01290   dword MATCH_p = 
01291     
01292     #line 254 "machine/sparc/sparc.pat.m"
01293     lc
01294     ;
01295   unsigned MATCH_w_32_0;
01296   { 
01297     MATCH_w_32_0 = getDword(MATCH_p); 
01298     if ((MATCH_w_32_0 >> 22 & 0x7) /* op2 at 0 */ == 4 && 
01299       (MATCH_w_32_0 >> 30 & 0x3) /* op at 0 */ == 0) { 
01300       unsigned _a = (MATCH_w_32_0 & 0x3fffff) /* imm22 at 0 */ << 10;
01301       unsigned _b = (MATCH_w_32_0 >> 25 & 0x1f) /* rd at 0 */;
01302       nextPC = 4 + MATCH_p; 
01303       
01304       #line 256 "machine/sparc/sparc.pat.m"
01305       
01306 
01307             if (!a_isVAR && (int)_a != a) return false; else a = _a;
01308 
01309             if (!b_isVAR && (int)_b != b) return false; else b = _b;
01310 
01311             lc = nextPC;
01312 
01313             return true;
01314 
01315       
01316       
01317       
01318     } /*opt-block*//*opt-block+*/
01319     else 
01320       goto MATCH_label_a0;  /*opt-block+*/
01321     
01322   }goto MATCH_finished_a; 
01323   
01324   MATCH_label_a0: (void)0; /*placeholder for label*/ 
01325     { 
01326       nextPC = MATCH_p; 
01327       
01328       #line 260 "machine/sparc/sparc.pat.m"
01329       
01330             return false;
01331 
01332       
01333       
01334       
01335     } 
01336     goto MATCH_finished_a; 
01337     
01338   MATCH_finished_a: (void)0; /*placeholder for label*/
01339   
01340 }
01341 
01342 #line 264 "machine/sparc/sparc.pat.m"
01343 }
01344 Logue* InstructionPatterns::std_call(CSR& csr, ADDRESS& lc, int& addr)
01345 {
01346     ADDRESS __save = lc;
01347     if (
01348     call__(lc, addr, VAR)) {
01349         vector<int> params(1); params[0] = addr; 
01350         if (__save == lc) return NULL;
01351         return csr.instantiateLogue("std_call",params);
01352     } else {
01353         lc = __save;
01354         return NULL;
01355     }
01356 }
01357 Logue* InstructionPatterns::struct_call(CSR& csr, ADDRESS& lc, int& addr, int& imm22)
01358 {
01359     ADDRESS __save = lc;
01360     if (
01361     call__(lc, addr, VAR) && 
01362     (lc += 4, true) && 
01363     UNIMP(lc, imm22, VAR)) {
01364         vector<int> params(2); params[0] = addr; params[1] = imm22; 
01365         if (__save == lc) return NULL;
01366         return csr.instantiateLogue("struct_call",params);
01367     } else {
01368         lc = __save;
01369         return NULL;
01370     }
01371 }
01372 Logue* InstructionPatterns::call_rst_ui_reg(CSR& csr, ADDRESS& lc, int& addr, int& imm22, int& rs1, int& rs2, int& rd)
01373 {
01374     ADDRESS __save = lc;
01375     if (
01376     call__(lc, addr, VAR) && 
01377     RESTORE$rmode(lc, rs1, VAR, rs2, VAR, rd, VAR) && 
01378     UNIMP(lc, imm22, VAR)) {
01379         vector<int> params(5); params[0] = addr; params[1] = imm22; params[2] = rs1; params[3] = rs2; params[4] = rd; 
01380         if (__save == lc) return NULL;
01381         return csr.instantiateLogue("call_rst_ui_reg",params);
01382     } else {
01383         lc = __save;
01384         return NULL;
01385     }
01386 }
01387 Logue* InstructionPatterns::call_rst_ui_imm(CSR& csr, ADDRESS& lc, int& addr, int& imm22, int& rs1, int& imm, int& rd)
01388 {
01389     ADDRESS __save = lc;
01390     if (
01391     call__(lc, addr, VAR) && 
01392     RESTORE$imode(lc, rs1, VAR, imm, VAR, rd, VAR) && 
01393     UNIMP(lc, imm22, VAR)) {
01394         vector<int> params(5); params[0] = addr; params[1] = imm22; params[2] = rs1; params[3] = imm; params[4] = rd; 
01395         if (__save == lc) return NULL;
01396         return csr.instantiateLogue("call_rst_ui_imm",params);
01397     } else {
01398         lc = __save;
01399         return NULL;
01400     }
01401 }
01402 Logue* InstructionPatterns::call_restore_reg(CSR& csr, ADDRESS& lc, int& addr, int& rs1, int& rs2, int& rd)
01403 {
01404     ADDRESS __save = lc;
01405     if (
01406     call__(lc, addr, VAR) && 
01407     RESTORE$rmode(lc, rs1, VAR, rs2, VAR, rd, VAR)) {
01408         vector<int> params(4); params[0] = addr; params[1] = rs1; params[2] = rs2; params[3] = rd; 
01409         if (__save == lc) return NULL;
01410         return csr.instantiateLogue("call_restore_reg",params);
01411     } else {
01412         lc = __save;
01413         return NULL;
01414     }
01415 }
01416 Logue* InstructionPatterns::call_restore_imm(CSR& csr, ADDRESS& lc, int& addr, int& rs1, int& imm, int& rd)
01417 {
01418     ADDRESS __save = lc;
01419     if (
01420     call__(lc, addr, VAR) && 
01421     RESTORE$imode(lc, rs1, VAR, imm, VAR, rd, VAR)) {
01422         vector<int> params(4); params[0] = addr; params[1] = rs1; params[2] = imm; params[3] = rd; 
01423         if (__save == lc) return NULL;
01424         return csr.instantiateLogue("call_restore_imm",params);
01425     } else {
01426         lc = __save;
01427         return NULL;
01428     }
01429 }
01430 Logue* InstructionPatterns::move_call_move(CSR& csr, ADDRESS& lc, int& addr, int& rd)
01431 {
01432     ADDRESS __save = lc;
01433     if (
01434     mov_(lc, o7, VAL, rd, VAR) && 
01435     call__(lc, addr, VAR) && 
01436     mov_(lc, rd, VAR, o7, VAL)) {
01437         vector<int> params(2); params[0] = addr; params[1] = rd; 
01438         if (__save == lc) return NULL;
01439         return csr.instantiateLogue("move_call_move",params);
01440     } else {
01441         lc = __save;
01442         return NULL;
01443     }
01444 }
01445 Logue* InstructionPatterns::move_x_call_move(CSR& csr, ADDRESS& lc, int& addr, int& rd)
01446 {
01447     ADDRESS __save = lc;
01448     if (
01449     mov_(lc, o7, VAL, rd, VAR) && 
01450     (lc += 4, true) && 
01451     call__(lc, addr, VAR) && 
01452     mov_(lc, rd, VAR, o7, VAL)) {
01453         vector<int> params(2); params[0] = addr; params[1] = rd; 
01454         if (__save == lc) return NULL;
01455         return csr.instantiateLogue("move_x_call_move",params);
01456     } else {
01457         lc = __save;
01458         return NULL;
01459     }
01460 }
01461 Logue* InstructionPatterns::call_add(CSR& csr, ADDRESS& lc, int& addr, int& imm)
01462 {
01463     ADDRESS __save = lc;
01464     if (
01465     call__(lc, addr, VAR) && 
01466     ADD$imode(lc, o7, VAL, imm, VAR, o7, VAL)) {
01467         vector<int> params(2); params[0] = addr; params[1] = imm; 
01468         if (__save == lc) return NULL;
01469         return csr.instantiateLogue("call_add",params);
01470     } else {
01471         lc = __save;
01472         return NULL;
01473     }
01474 }
01475 Logue* InstructionPatterns::jmp_restore_reg(CSR& csr, ADDRESS& lc, int& rs1j, int& rdj, int& rs1, int& rs2, int& rd)
01476 {
01477     ADDRESS __save = lc;
01478     if (
01479     JMPL$indirectA(lc, rs1j, VAR, rdj, VAR) && 
01480     RESTORE$rmode(lc, rs1, VAR, rs2, VAR, rd, VAR)) {
01481         vector<int> params(5); params[0] = rs1j; params[1] = rdj; params[2] = rs1; params[3] = rs2; params[4] = rd; 
01482         if (__save == lc) return NULL;
01483         return csr.instantiateLogue("jmp_restore_reg",params);
01484     } else {
01485         lc = __save;
01486         return NULL;
01487     }
01488 }
01489 Logue* InstructionPatterns::jmp_restore_imm(CSR& csr, ADDRESS& lc, int& rs1j, int& rdj, int& rs1, int& imm, int& rd)
01490 {
01491     ADDRESS __save = lc;
01492     if (
01493     JMPL$indirectA(lc, rs1j, VAR, rdj, VAR) && 
01494     RESTORE$imode(lc, rs1, VAR, imm, VAR, rd, VAR)) {
01495         vector<int> params(5); params[0] = rs1j; params[1] = rdj; params[2] = rs1; params[3] = imm; params[4] = rd; 
01496         if (__save == lc) return NULL;
01497         return csr.instantiateLogue("jmp_restore_imm",params);
01498     } else {
01499         lc = __save;
01500         return NULL;
01501     }
01502 }
01503 Logue* InstructionPatterns::new_reg_win(CSR& csr, ADDRESS& lc, int& locals)
01504 {
01505     ADDRESS __save = lc;
01506     if (
01507     SAVE$imode(lc, SP, VAL, locals, VAR, SP, VAL)) {
01508         vector<int> params(1); params[0] = locals; 
01509         if (__save == lc) return NULL;
01510         return csr.instantiateLogue("new_reg_win",params);
01511     } else {
01512         lc = __save;
01513         return NULL;
01514     }
01515 }
01516 Logue* InstructionPatterns::same_reg_win(CSR& csr, ADDRESS& lc, int& locals)
01517 {
01518     ADDRESS __save = lc;
01519     if (
01520     ADD$imode(lc, SP, VAL, locals, VAR, SP, VAL)) {
01521         vector<int> params(1); params[0] = locals; 
01522         if (__save == lc) return NULL;
01523         return csr.instantiateLogue("same_reg_win",params);
01524     } else {
01525         lc = __save;
01526         return NULL;
01527     }
01528 }
01529 Logue* InstructionPatterns::new_reg_win_large(CSR& csr, ADDRESS& lc, int& hiVal, int& loVal, int& reg)
01530 {
01531     ADDRESS __save = lc;
01532     if (
01533     sethi(lc, hiVal, VAR, reg, VAR) && 
01534     (ADD$imode(lc, reg, VAR, loVal, VAR, reg, VAR) || 
01535     OR$imode(lc, reg, VAR, loVal, VAR, reg, VAR)) && 
01536     SAVE$rmode(lc, SP, VAL, reg, VAR, SP, VAL)) {
01537         vector<int> params(3); params[0] = hiVal; params[1] = loVal; params[2] = reg; 
01538         if (__save == lc) return NULL;
01539         return csr.instantiateLogue("new_reg_win_large",params);
01540     } else {
01541         lc = __save;
01542         return NULL;
01543     }
01544 }
01545 Logue* InstructionPatterns::same_reg_win_large(CSR& csr, ADDRESS& lc, int& hiVal, int& loVal, int& reg)
01546 {
01547     ADDRESS __save = lc;
01548     if (
01549     sethi(lc, hiVal, VAR, reg, VAR) && 
01550     (ADD$imode(lc, reg, VAR, loVal, VAR, reg, VAR) || 
01551     OR$imode(lc, reg, VAR, loVal, VAR, reg, VAR)) && 
01552     ADD$rmode(lc, SP, VAL, reg, VAR, SP, VAL)) {
01553         vector<int> params(3); params[0] = hiVal; params[1] = loVal; params[2] = reg; 
01554         if (__save == lc) return NULL;
01555         return csr.instantiateLogue("same_reg_win_large",params);
01556     } else {
01557         lc = __save;
01558         return NULL;
01559     }
01560 }
01561 Logue* InstructionPatterns::none(CSR& csr, ADDRESS& lc)
01562 {
01563     ADDRESS __save = lc;
01564     if (
01565     (lc += 0, true)) {
01566         vector<int> params(0); 
01567         if (__save == lc) return NULL;
01568         return csr.instantiateLogue("none",params);
01569     } else {
01570         lc = __save;
01571         return NULL;
01572     }
01573 }
01574 Logue* InstructionPatterns::std_ret(CSR& csr, ADDRESS& lc)
01575 {
01576     ADDRESS __save = lc;
01577     int __loc0;
01578     if (
01579     (ret(lc) || 
01580     JMPL$dispA(lc, i7, VAL, __loc0 = 12, VAL, g0, VAL)) && 
01581     restore_(lc)) {
01582         vector<int> params(0); 
01583         if (__save == lc) return NULL;
01584         return csr.instantiateLogue("std_ret",params);
01585     } else {
01586         lc = __save;
01587         return NULL;
01588     }
01589 }
01590 Logue* InstructionPatterns::ret_reg_val(CSR& csr, ADDRESS& lc, int& rs1, int& rs2)
01591 {
01592     ADDRESS __save = lc;
01593     int __loc0;
01594     if (
01595     (ret(lc) || 
01596     JMPL$dispA(lc, i7, VAL, __loc0 = 12, VAL, g0, VAL)) && 
01597     RESTORE$rmode(lc, rs1, VAR, rs2, VAR, o0, VAL)) {
01598         vector<int> params(2); params[0] = rs1; params[1] = rs2; 
01599         if (__save == lc) return NULL;
01600         return csr.instantiateLogue("ret_reg_val",params);
01601     } else {
01602         lc = __save;
01603         return NULL;
01604     }
01605 }
01606 Logue* InstructionPatterns::ret_imm_val(CSR& csr, ADDRESS& lc, int& rs1, int& imm)
01607 {
01608     ADDRESS __save = lc;
01609     int __loc0;
01610     if (
01611     (ret(lc) || 
01612     JMPL$dispA(lc, i7, VAL, __loc0 = 12, VAL, g0, VAL)) && 
01613     RESTORE$imode(lc, rs1, VAR, imm, VAR, o0, VAL)) {
01614         vector<int> params(2); params[0] = rs1; params[1] = imm; 
01615         if (__save == lc) return NULL;
01616         return csr.instantiateLogue("ret_imm_val",params);
01617     } else {
01618         lc = __save;
01619         return NULL;
01620     }
01621 }
01622 Logue* InstructionPatterns::leaf_ret(CSR& csr, ADDRESS& lc)
01623 {
01624     ADDRESS __save = lc;
01625     int __loc0;
01626     if (
01627     (retl(lc) || 
01628     JMPL$dispA(lc, o7, VAL, __loc0 = 12, VAL, g0, VAL)) && 
01629     ((SUB$imode(lc, SP, VAL, __loc0, VAR, SP, VAL)) || true)) {
01630         vector<int> params(0); 
01631         if (__save == lc) return NULL;
01632         return csr.instantiateLogue("leaf_ret",params);
01633     } else {
01634         lc = __save;
01635         return NULL;
01636     }
01637 }
01638 Logue* InstructionPatterns::ret_struct4(CSR& csr, ADDRESS& lc)
01639 {
01640     ADDRESS __save = lc;
01641     if (
01642 false) {
01643         vector<int> params(0); 
01644         if (__save == lc) return NULL;
01645         return csr.instantiateLogue("ret_struct4",params);
01646     } else {
01647         lc = __save;
01648         return NULL;
01649     }
01650 }
01651 LogueDict::LogueDict()
01652 {
01653     {
01654         list<string> params;
01655         params.push_back("addr");
01656         theSemTable.addItem("addr");
01657         this->newLogue("std_call","CALLER_PROLOGUE",params);
01658     }
01659     {
01660         list<string> params;
01661         params.push_back("addr");
01662         theSemTable.addItem("addr");
01663         params.push_back("imm22");
01664         theSemTable.addItem("imm22");
01665         this->newLogue("struct_call","CALLER_PROLOGUE",params);
01666     }
01667     {
01668         list<string> params;
01669         params.push_back("addr");
01670         theSemTable.addItem("addr");
01671         params.push_back("imm22");
01672         theSemTable.addItem("imm22");
01673         params.push_back("rs1");
01674         theSemTable.addItem("rs1");
01675         params.push_back("rs2");
01676         theSemTable.addItem("rs2");
01677         params.push_back("rd");
01678         theSemTable.addItem("rd");
01679         this->newLogue("call_rst_ui_reg","CALLER_PROLOGUE",params);
01680     }
01681     {
01682         list<string> params;
01683         params.push_back("addr");
01684         theSemTable.addItem("addr");
01685         params.push_back("imm22");
01686         theSemTable.addItem("imm22");
01687         params.push_back("rs1");
01688         theSemTable.addItem("rs1");
01689         params.push_back("imm");
01690         theSemTable.addItem("imm");
01691         params.push_back("rd");
01692         theSemTable.addItem("rd");
01693         this->newLogue("call_rst_ui_imm","CALLER_PROLOGUE",params);
01694     }
01695     {
01696         list<string> params;
01697         params.push_back("addr");
01698         theSemTable.addItem("addr");
01699         params.push_back("rs1");
01700         theSemTable.addItem("rs1");
01701         params.push_back("rs2");
01702         theSemTable.addItem("rs2");
01703         params.push_back("rd");
01704         theSemTable.addItem("rd");
01705         this->newLogue("call_restore_reg","CALLER_PROLOGUE",params);
01706     }
01707     {
01708         list<string> params;
01709         params.push_back("addr");
01710         theSemTable.addItem("addr");
01711         params.push_back("rs1");
01712         theSemTable.addItem("rs1");
01713         params.push_back("imm");
01714         theSemTable.addItem("imm");
01715         params.push_back("rd");
01716         theSemTable.addItem("rd");
01717         this->newLogue("call_restore_imm","CALLER_PROLOGUE",params);
01718     }
01719     {
01720         list<string> params;
01721         params.push_back("addr");
01722         theSemTable.addItem("addr");
01723         params.push_back("rd");
01724         theSemTable.addItem("rd");
01725         this->newLogue("move_call_move","CALLER_PROLOGUE",params);
01726     }
01727     {
01728         list<string> params;
01729         params.push_back("addr");
01730         theSemTable.addItem("addr");
01731         params.push_back("rd");
01732         theSemTable.addItem("rd");
01733         this->newLogue("move_x_call_move","CALLER_PROLOGUE",params);
01734     }
01735     {
01736         list<string> params;
01737         params.push_back("addr");
01738         theSemTable.addItem("addr");
01739         params.push_back("imm");
01740         theSemTable.addItem("imm");
01741         this->newLogue("call_add","CALLER_PROLOGUE",params);
01742     }
01743     {
01744         list<string> params;
01745         params.push_back("rs1j");
01746         theSemTable.addItem("rs1j");
01747         params.push_back("rdj");
01748         theSemTable.addItem("rdj");
01749         params.push_back("rs1");
01750         theSemTable.addItem("rs1");
01751         params.push_back("rs2");
01752         theSemTable.addItem("rs2");
01753         params.push_back("rd");
01754         theSemTable.addItem("rd");
01755         this->newLogue("jmp_restore_reg","CALLER_PROLOGUE",params);
01756     }
01757     {
01758         list<string> params;
01759         params.push_back("rs1j");
01760         theSemTable.addItem("rs1j");
01761         params.push_back("rdj");
01762         theSemTable.addItem("rdj");
01763         params.push_back("rs1");
01764         theSemTable.addItem("rs1");
01765         params.push_back("imm");
01766         theSemTable.addItem("imm");
01767         params.push_back("rd");
01768         theSemTable.addItem("rd");
01769         this->newLogue("jmp_restore_imm","CALLER_PROLOGUE",params);
01770     }
01771     {
01772         list<string> params;
01773         params.push_back("locals");
01774         theSemTable.addItem("locals");
01775         this->newLogue("new_reg_win","CALLEE_PROLOGUE",params);
01776     }
01777     {
01778         list<string> params;
01779         params.push_back("locals");
01780         theSemTable.addItem("locals");
01781         this->newLogue("same_reg_win","CALLEE_PROLOGUE",params);
01782     }
01783     {
01784         list<string> params;
01785         params.push_back("hiVal");
01786         theSemTable.addItem("hiVal");
01787         params.push_back("loVal");
01788         theSemTable.addItem("loVal");
01789         params.push_back("reg");
01790         theSemTable.addItem("reg");
01791         this->newLogue("new_reg_win_large","CALLEE_PROLOGUE",params);
01792     }
01793     {
01794         list<string> params;
01795         params.push_back("hiVal");
01796         theSemTable.addItem("hiVal");
01797         params.push_back("loVal");
01798         theSemTable.addItem("loVal");
01799         params.push_back("reg");
01800         theSemTable.addItem("reg");
01801         this->newLogue("same_reg_win_large","CALLEE_PROLOGUE",params);
01802     }
01803     {
01804         list<string> params;
01805         this->newLogue("none","CALLEE_PROLOGUE",params);
01806     }
01807     {
01808         list<string> params;
01809         this->newLogue("std_ret","CALLEE_EPILOGUE",params);
01810     }
01811     {
01812         list<string> params;
01813         params.push_back("rs1");
01814         theSemTable.addItem("rs1");
01815         params.push_back("rs2");
01816         theSemTable.addItem("rs2");
01817         this->newLogue("ret_reg_val","CALLEE_EPILOGUE",params);
01818     }
01819     {
01820         list<string> params;
01821         params.push_back("rs1");
01822         theSemTable.addItem("rs1");
01823         params.push_back("imm");
01824         theSemTable.addItem("imm");
01825         this->newLogue("ret_imm_val","CALLEE_EPILOGUE",params);
01826     }
01827     {
01828         list<string> params;
01829         this->newLogue("leaf_ret","CALLEE_EPILOGUE",params);
01830     }
01831     {
01832         list<string> params;
01833         this->newLogue("ret_struct4","CALLEE_EPILOGUE",params);
01834     }
01835 }
01836 
01837 

Generated on Tue Sep 19 21:18:32 2006 for Boomerang by  doxygen 1.4.6