• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisión89b2e37e6506d92b00ac478e7953be6ddd7a86a9 (tree)
Tiempo2017-09-17 22:52:19
AutorRichard Henderson <richard.henderson@lina...>
CommiterRichard Henderson

Log Message

tcg/mips: Fully convert tcg_target_op_def

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Cambiar Resumen

Diferencia incremental

--- a/tcg/mips/tcg-target.inc.c
+++ b/tcg/mips/tcg-target.inc.c
@@ -2163,166 +2163,182 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
21632163 }
21642164 }
21652165
2166-static const TCGTargetOpDef mips_op_defs[] = {
2167- { INDEX_op_exit_tb, { } },
2168- { INDEX_op_goto_tb, { } },
2169- { INDEX_op_br, { } },
2170- { INDEX_op_goto_ptr, { "r" } },
2171-
2172- { INDEX_op_ld8u_i32, { "r", "r" } },
2173- { INDEX_op_ld8s_i32, { "r", "r" } },
2174- { INDEX_op_ld16u_i32, { "r", "r" } },
2175- { INDEX_op_ld16s_i32, { "r", "r" } },
2176- { INDEX_op_ld_i32, { "r", "r" } },
2177- { INDEX_op_st8_i32, { "rZ", "r" } },
2178- { INDEX_op_st16_i32, { "rZ", "r" } },
2179- { INDEX_op_st_i32, { "rZ", "r" } },
2180-
2181- { INDEX_op_add_i32, { "r", "rZ", "rJ" } },
2182- { INDEX_op_mul_i32, { "r", "rZ", "rZ" } },
2183-#if !use_mips32r6_instructions
2184- { INDEX_op_muls2_i32, { "r", "r", "rZ", "rZ" } },
2185- { INDEX_op_mulu2_i32, { "r", "r", "rZ", "rZ" } },
2186-#endif
2187- { INDEX_op_mulsh_i32, { "r", "rZ", "rZ" } },
2188- { INDEX_op_muluh_i32, { "r", "rZ", "rZ" } },
2189- { INDEX_op_div_i32, { "r", "rZ", "rZ" } },
2190- { INDEX_op_divu_i32, { "r", "rZ", "rZ" } },
2191- { INDEX_op_rem_i32, { "r", "rZ", "rZ" } },
2192- { INDEX_op_remu_i32, { "r", "rZ", "rZ" } },
2193- { INDEX_op_sub_i32, { "r", "rZ", "rN" } },
2194-
2195- { INDEX_op_and_i32, { "r", "rZ", "rIK" } },
2196- { INDEX_op_nor_i32, { "r", "rZ", "rZ" } },
2197- { INDEX_op_not_i32, { "r", "rZ" } },
2198- { INDEX_op_or_i32, { "r", "rZ", "rIZ" } },
2199- { INDEX_op_xor_i32, { "r", "rZ", "rIZ" } },
2200-
2201- { INDEX_op_shl_i32, { "r", "rZ", "ri" } },
2202- { INDEX_op_shr_i32, { "r", "rZ", "ri" } },
2203- { INDEX_op_sar_i32, { "r", "rZ", "ri" } },
2204- { INDEX_op_rotr_i32, { "r", "rZ", "ri" } },
2205- { INDEX_op_rotl_i32, { "r", "rZ", "ri" } },
2206- { INDEX_op_clz_i32, { "r", "r", "rWZ" } },
2207-
2208- { INDEX_op_bswap16_i32, { "r", "r" } },
2209- { INDEX_op_bswap32_i32, { "r", "r" } },
2210-
2211- { INDEX_op_ext8s_i32, { "r", "rZ" } },
2212- { INDEX_op_ext16s_i32, { "r", "rZ" } },
2213-
2214- { INDEX_op_deposit_i32, { "r", "0", "rZ" } },
2215- { INDEX_op_extract_i32, { "r", "r" } },
2216-
2217- { INDEX_op_brcond_i32, { "rZ", "rZ" } },
2218-#if use_mips32r6_instructions
2219- { INDEX_op_movcond_i32, { "r", "rZ", "rZ", "rZ", "rZ" } },
2220-#else
2221- { INDEX_op_movcond_i32, { "r", "rZ", "rZ", "rZ", "0" } },
2222-#endif
2223- { INDEX_op_setcond_i32, { "r", "rZ", "rZ" } },
2166+static const TCGTargetOpDef *tcg_target_op_def(TCGOpcode op)
2167+{
2168+ static const TCGTargetOpDef r = { .args_ct_str = { "r" } };
2169+ static const TCGTargetOpDef r_r = { .args_ct_str = { "r", "r" } };
2170+ static const TCGTargetOpDef r_L = { .args_ct_str = { "r", "L" } };
2171+ static const TCGTargetOpDef rZ_r = { .args_ct_str = { "rZ", "r" } };
2172+ static const TCGTargetOpDef SZ_S = { .args_ct_str = { "SZ", "S" } };
2173+ static const TCGTargetOpDef rZ_rZ = { .args_ct_str = { "rZ", "rZ" } };
2174+ static const TCGTargetOpDef r_r_L = { .args_ct_str = { "r", "r", "L" } };
2175+ static const TCGTargetOpDef r_L_L = { .args_ct_str = { "r", "L", "L" } };
2176+ static const TCGTargetOpDef r_r_ri = { .args_ct_str = { "r", "r", "ri" } };
2177+ static const TCGTargetOpDef r_r_rI = { .args_ct_str = { "r", "r", "rI" } };
2178+ static const TCGTargetOpDef r_r_rJ = { .args_ct_str = { "r", "r", "rJ" } };
2179+ static const TCGTargetOpDef SZ_S_S = { .args_ct_str = { "SZ", "S", "S" } };
2180+ static const TCGTargetOpDef SZ_SZ_S
2181+ = { .args_ct_str = { "SZ", "SZ", "S" } };
2182+ static const TCGTargetOpDef SZ_SZ_S_S
2183+ = { .args_ct_str = { "SZ", "SZ", "S", "S" } };
2184+ static const TCGTargetOpDef r_rZ_rN
2185+ = { .args_ct_str = { "r", "rZ", "rN" } };
2186+ static const TCGTargetOpDef r_rZ_rZ
2187+ = { .args_ct_str = { "r", "rZ", "rZ" } };
2188+ static const TCGTargetOpDef r_r_rIK
2189+ = { .args_ct_str = { "r", "r", "rIK" } };
2190+ static const TCGTargetOpDef r_r_rWZ
2191+ = { .args_ct_str = { "r", "r", "rWZ" } };
2192+ static const TCGTargetOpDef r_r_r_r
2193+ = { .args_ct_str = { "r", "r", "r", "r" } };
2194+ static const TCGTargetOpDef r_r_L_L
2195+ = { .args_ct_str = { "r", "r", "L", "L" } };
2196+ static const TCGTargetOpDef dep
2197+ = { .args_ct_str = { "r", "0", "rZ" } };
2198+ static const TCGTargetOpDef movc
2199+ = { .args_ct_str = { "r", "rZ", "rZ", "rZ", "0" } };
2200+ static const TCGTargetOpDef movc_r6
2201+ = { .args_ct_str = { "r", "rZ", "rZ", "rZ", "rZ" } };
2202+ static const TCGTargetOpDef add2
2203+ = { .args_ct_str = { "r", "r", "rZ", "rZ", "rN", "rN" } };
2204+ static const TCGTargetOpDef br2
2205+ = { .args_ct_str = { "rZ", "rZ", "rZ", "rZ" } };
2206+ static const TCGTargetOpDef setc2
2207+ = { .args_ct_str = { "r", "rZ", "rZ", "rZ", "rZ" } };
2208+
2209+ switch (op) {
2210+ case INDEX_op_goto_ptr:
2211+ return &r;
22242212
2225-#if TCG_TARGET_REG_BITS == 32
2226- { INDEX_op_add2_i32, { "r", "r", "rZ", "rZ", "rN", "rN" } },
2227- { INDEX_op_sub2_i32, { "r", "r", "rZ", "rZ", "rN", "rN" } },
2228- { INDEX_op_setcond2_i32, { "r", "rZ", "rZ", "rZ", "rZ" } },
2229- { INDEX_op_brcond2_i32, { "rZ", "rZ", "rZ", "rZ" } },
2230-#endif
2213+ case INDEX_op_ld8u_i32:
2214+ case INDEX_op_ld8s_i32:
2215+ case INDEX_op_ld16u_i32:
2216+ case INDEX_op_ld16s_i32:
2217+ case INDEX_op_ld_i32:
2218+ case INDEX_op_not_i32:
2219+ case INDEX_op_bswap16_i32:
2220+ case INDEX_op_bswap32_i32:
2221+ case INDEX_op_ext8s_i32:
2222+ case INDEX_op_ext16s_i32:
2223+ case INDEX_op_extract_i32:
2224+ case INDEX_op_ld8u_i64:
2225+ case INDEX_op_ld8s_i64:
2226+ case INDEX_op_ld16u_i64:
2227+ case INDEX_op_ld16s_i64:
2228+ case INDEX_op_ld32s_i64:
2229+ case INDEX_op_ld32u_i64:
2230+ case INDEX_op_ld_i64:
2231+ case INDEX_op_not_i64:
2232+ case INDEX_op_bswap16_i64:
2233+ case INDEX_op_bswap32_i64:
2234+ case INDEX_op_bswap64_i64:
2235+ case INDEX_op_ext8s_i64:
2236+ case INDEX_op_ext16s_i64:
2237+ case INDEX_op_ext32s_i64:
2238+ case INDEX_op_ext32u_i64:
2239+ case INDEX_op_ext_i32_i64:
2240+ case INDEX_op_extu_i32_i64:
2241+ case INDEX_op_extrl_i64_i32:
2242+ case INDEX_op_extrh_i64_i32:
2243+ case INDEX_op_extract_i64:
2244+ return &r_r;
22312245
2232-#if TCG_TARGET_REG_BITS == 64
2233- { INDEX_op_ld8u_i64, { "r", "r" } },
2234- { INDEX_op_ld8s_i64, { "r", "r" } },
2235- { INDEX_op_ld16u_i64, { "r", "r" } },
2236- { INDEX_op_ld16s_i64, { "r", "r" } },
2237- { INDEX_op_ld32s_i64, { "r", "r" } },
2238- { INDEX_op_ld32u_i64, { "r", "r" } },
2239- { INDEX_op_ld_i64, { "r", "r" } },
2240- { INDEX_op_st8_i64, { "rZ", "r" } },
2241- { INDEX_op_st16_i64, { "rZ", "r" } },
2242- { INDEX_op_st32_i64, { "rZ", "r" } },
2243- { INDEX_op_st_i64, { "rZ", "r" } },
2244-
2245- { INDEX_op_add_i64, { "r", "rZ", "rJ" } },
2246- { INDEX_op_mul_i64, { "r", "rZ", "rZ" } },
2247-#if !use_mips32r6_instructions
2248- { INDEX_op_muls2_i64, { "r", "r", "rZ", "rZ" } },
2249- { INDEX_op_mulu2_i64, { "r", "r", "rZ", "rZ" } },
2250-#endif
2251- { INDEX_op_mulsh_i64, { "r", "rZ", "rZ" } },
2252- { INDEX_op_muluh_i64, { "r", "rZ", "rZ" } },
2253- { INDEX_op_div_i64, { "r", "rZ", "rZ" } },
2254- { INDEX_op_divu_i64, { "r", "rZ", "rZ" } },
2255- { INDEX_op_rem_i64, { "r", "rZ", "rZ" } },
2256- { INDEX_op_remu_i64, { "r", "rZ", "rZ" } },
2257- { INDEX_op_sub_i64, { "r", "rZ", "rN" } },
2258-
2259- { INDEX_op_and_i64, { "r", "rZ", "rIK" } },
2260- { INDEX_op_nor_i64, { "r", "rZ", "rZ" } },
2261- { INDEX_op_not_i64, { "r", "rZ" } },
2262- { INDEX_op_or_i64, { "r", "rZ", "rI" } },
2263- { INDEX_op_xor_i64, { "r", "rZ", "rI" } },
2264-
2265- { INDEX_op_shl_i64, { "r", "rZ", "ri" } },
2266- { INDEX_op_shr_i64, { "r", "rZ", "ri" } },
2267- { INDEX_op_sar_i64, { "r", "rZ", "ri" } },
2268- { INDEX_op_rotr_i64, { "r", "rZ", "ri" } },
2269- { INDEX_op_rotl_i64, { "r", "rZ", "ri" } },
2270- { INDEX_op_clz_i64, { "r", "r", "rWZ" } },
2271-
2272- { INDEX_op_bswap16_i64, { "r", "r" } },
2273- { INDEX_op_bswap32_i64, { "r", "r" } },
2274- { INDEX_op_bswap64_i64, { "r", "r" } },
2275-
2276- { INDEX_op_ext8s_i64, { "r", "rZ" } },
2277- { INDEX_op_ext16s_i64, { "r", "rZ" } },
2278- { INDEX_op_ext32s_i64, { "r", "rZ" } },
2279- { INDEX_op_ext32u_i64, { "r", "rZ" } },
2280- { INDEX_op_ext_i32_i64, { "r", "rZ" } },
2281- { INDEX_op_extu_i32_i64, { "r", "rZ" } },
2282- { INDEX_op_extrl_i64_i32, { "r", "rZ" } },
2283- { INDEX_op_extrh_i64_i32, { "r", "rZ" } },
2284-
2285- { INDEX_op_deposit_i64, { "r", "0", "rZ" } },
2286- { INDEX_op_extract_i64, { "r", "r" } },
2287-
2288- { INDEX_op_brcond_i64, { "rZ", "rZ" } },
2289-#if use_mips32r6_instructions
2290- { INDEX_op_movcond_i64, { "r", "rZ", "rZ", "rZ", "rZ" } },
2291-#else
2292- { INDEX_op_movcond_i64, { "r", "rZ", "rZ", "rZ", "0" } },
2293-#endif
2294- { INDEX_op_setcond_i64, { "r", "rZ", "rZ" } },
2295-
2296- { INDEX_op_qemu_ld_i32, { "r", "LZ" } },
2297- { INDEX_op_qemu_st_i32, { "SZ", "SZ" } },
2298- { INDEX_op_qemu_ld_i64, { "r", "LZ" } },
2299- { INDEX_op_qemu_st_i64, { "SZ", "SZ" } },
2300-#elif TARGET_LONG_BITS == 32
2301- { INDEX_op_qemu_ld_i32, { "r", "LZ" } },
2302- { INDEX_op_qemu_st_i32, { "SZ", "SZ" } },
2303- { INDEX_op_qemu_ld_i64, { "r", "r", "LZ" } },
2304- { INDEX_op_qemu_st_i64, { "SZ", "SZ", "SZ" } },
2305-#else
2306- { INDEX_op_qemu_ld_i32, { "r", "LZ", "LZ" } },
2307- { INDEX_op_qemu_st_i32, { "SZ", "SZ", "SZ" } },
2308- { INDEX_op_qemu_ld_i64, { "r", "r", "LZ", "LZ" } },
2309- { INDEX_op_qemu_st_i64, { "SZ", "SZ", "SZ", "SZ" } },
2310-#endif
2246+ case INDEX_op_st8_i32:
2247+ case INDEX_op_st16_i32:
2248+ case INDEX_op_st_i32:
2249+ case INDEX_op_st8_i64:
2250+ case INDEX_op_st16_i64:
2251+ case INDEX_op_st32_i64:
2252+ case INDEX_op_st_i64:
2253+ return &rZ_r;
23112254
2312- { INDEX_op_mb, { } },
2313- { -1 },
2314-};
2255+ case INDEX_op_add_i32:
2256+ case INDEX_op_add_i64:
2257+ return &r_r_rJ;
2258+ case INDEX_op_sub_i32:
2259+ case INDEX_op_sub_i64:
2260+ return &r_rZ_rN;
2261+ case INDEX_op_mul_i32:
2262+ case INDEX_op_mulsh_i32:
2263+ case INDEX_op_muluh_i32:
2264+ case INDEX_op_div_i32:
2265+ case INDEX_op_divu_i32:
2266+ case INDEX_op_rem_i32:
2267+ case INDEX_op_remu_i32:
2268+ case INDEX_op_nor_i32:
2269+ case INDEX_op_setcond_i32:
2270+ case INDEX_op_mul_i64:
2271+ case INDEX_op_mulsh_i64:
2272+ case INDEX_op_muluh_i64:
2273+ case INDEX_op_div_i64:
2274+ case INDEX_op_divu_i64:
2275+ case INDEX_op_rem_i64:
2276+ case INDEX_op_remu_i64:
2277+ case INDEX_op_nor_i64:
2278+ case INDEX_op_setcond_i64:
2279+ return &r_rZ_rZ;
2280+ case INDEX_op_muls2_i32:
2281+ case INDEX_op_mulu2_i32:
2282+ case INDEX_op_muls2_i64:
2283+ case INDEX_op_mulu2_i64:
2284+ return &r_r_r_r;
2285+ case INDEX_op_and_i32:
2286+ case INDEX_op_and_i64:
2287+ return &r_r_rIK;
2288+ case INDEX_op_or_i32:
2289+ case INDEX_op_xor_i32:
2290+ case INDEX_op_or_i64:
2291+ case INDEX_op_xor_i64:
2292+ return &r_r_rI;
2293+ case INDEX_op_shl_i32:
2294+ case INDEX_op_shr_i32:
2295+ case INDEX_op_sar_i32:
2296+ case INDEX_op_rotr_i32:
2297+ case INDEX_op_rotl_i32:
2298+ case INDEX_op_shl_i64:
2299+ case INDEX_op_shr_i64:
2300+ case INDEX_op_sar_i64:
2301+ case INDEX_op_rotr_i64:
2302+ case INDEX_op_rotl_i64:
2303+ return &r_r_ri;
2304+ case INDEX_op_clz_i32:
2305+ case INDEX_op_clz_i64:
2306+ return &r_r_rWZ;
23152307
2316-static const TCGTargetOpDef *tcg_target_op_def(TCGOpcode op)
2317-{
2318- int i, n = ARRAY_SIZE(mips_op_defs);
2308+ case INDEX_op_deposit_i32:
2309+ case INDEX_op_deposit_i64:
2310+ return &dep;
2311+ case INDEX_op_brcond_i32:
2312+ case INDEX_op_brcond_i64:
2313+ return &rZ_rZ;
2314+ case INDEX_op_movcond_i32:
2315+ case INDEX_op_movcond_i64:
2316+ return use_mips32r6_instructions ? &movc_r6 : &movc;
23192317
2320- for (i = 0; i < n; ++i) {
2321- if (mips_op_defs[i].op == op) {
2322- return &mips_op_defs[i];
2323- }
2318+ case INDEX_op_add2_i32:
2319+ case INDEX_op_sub2_i32:
2320+ return &add2;
2321+ case INDEX_op_setcond2_i32:
2322+ return &setc2;
2323+ case INDEX_op_brcond2_i32:
2324+ return &br2;
2325+
2326+ case INDEX_op_qemu_ld_i32:
2327+ return (TCG_TARGET_REG_BITS == 64 || TARGET_LONG_BITS == 32
2328+ ? &r_L : &r_L_L);
2329+ case INDEX_op_qemu_st_i32:
2330+ return (TCG_TARGET_REG_BITS == 64 || TARGET_LONG_BITS == 32
2331+ ? &SZ_S : &SZ_S_S);
2332+ case INDEX_op_qemu_ld_i64:
2333+ return (TCG_TARGET_REG_BITS == 64 ? &r_L
2334+ : TARGET_LONG_BITS == 32 ? &r_r_L : &r_r_L_L);
2335+ case INDEX_op_qemu_st_i64:
2336+ return (TCG_TARGET_REG_BITS == 64 ? &SZ_S
2337+ : TARGET_LONG_BITS == 32 ? &SZ_SZ_S : &SZ_SZ_S_S);
2338+
2339+ default:
2340+ return NULL;
23242341 }
2325- return NULL;
23262342 }
23272343
23282344 static int tcg_target_callee_save_regs[] = {