Commit 31c18d87614063316b66faa6d7c05a876846488a
1 parent
780e264f
CRIS: Remove cpu_T.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5552 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
155 additions
and
102 deletions
target-cris/exec.h
... | ... | @@ -20,17 +20,8 @@ |
20 | 20 | */ |
21 | 21 | #include "dyngen-exec.h" |
22 | 22 | |
23 | -#if 1 | |
24 | 23 | register struct CPUCRISState *env asm(AREG0); |
25 | -/* This is only used for tb lookup. */ | |
26 | -register uint32_t T0 asm(AREG1); | |
27 | -register uint32_t T1 asm(AREG2); | |
28 | -#else | |
29 | -struct CPUCRISState *env; | |
30 | -/* This is only used for tb lookup. */ | |
31 | -uint32_t T0; | |
32 | -uint32_t T1; | |
33 | -#endif | |
24 | + | |
34 | 25 | #include "cpu.h" |
35 | 26 | #include "exec-all.h" |
36 | 27 | ... | ... |
target-cris/translate.c
... | ... | @@ -62,7 +62,6 @@ |
62 | 62 | #define CC_MASK_RNZV 0x10e |
63 | 63 | |
64 | 64 | static TCGv cpu_env; |
65 | -static TCGv cpu_T[2]; | |
66 | 65 | static TCGv cpu_R[16]; |
67 | 66 | static TCGv cpu_PR[16]; |
68 | 67 | static TCGv cc_x; |
... | ... | @@ -927,10 +926,15 @@ static void cris_alu(DisasContext *dc, int op, |
927 | 926 | int writeback; |
928 | 927 | |
929 | 928 | writeback = 1; |
930 | - tmp = cpu_T[0]; | |
931 | - if (op == CC_OP_CMP) | |
929 | + | |
930 | + if (op == CC_OP_BOUND || op == CC_OP_BTST) | |
931 | + tmp = tcg_temp_local_new(TCG_TYPE_TL); | |
932 | + else | |
933 | + tmp = tcg_temp_new(TCG_TYPE_TL); | |
934 | + | |
935 | + if (op == CC_OP_CMP) { | |
932 | 936 | writeback = 0; |
933 | - else if (size == 4) { | |
937 | + } else if (size == 4) { | |
934 | 938 | tmp = d; |
935 | 939 | writeback = 0; |
936 | 940 | } |
... | ... | @@ -947,6 +951,8 @@ static void cris_alu(DisasContext *dc, int op, |
947 | 951 | tcg_gen_andi_tl(d, d, ~0xffff); |
948 | 952 | tcg_gen_or_tl(d, d, tmp); |
949 | 953 | } |
954 | + if (tmp != d) | |
955 | + tcg_temp_free(tmp); | |
950 | 956 | } |
951 | 957 | |
952 | 958 | static int arith_cc(DisasContext *dc) |
... | ... | @@ -1401,14 +1407,13 @@ static int dec_prep_move_m(DisasContext *dc, int s_ext, int memsize, |
1401 | 1407 | /* Prepare T0 and T1 for a memory + alu operation. |
1402 | 1408 | s_ext decides if the operand1 should be sign-extended or zero-extended when |
1403 | 1409 | needed. */ |
1404 | -static int dec_prep_alu_m(DisasContext *dc, int s_ext, int memsize) | |
1410 | +static int dec_prep_alu_m(DisasContext *dc, int s_ext, int memsize, | |
1411 | + TCGv dst, TCGv src) | |
1405 | 1412 | { |
1406 | 1413 | int insn_len; |
1407 | 1414 | |
1408 | - insn_len = dec_prep_move_m(dc, s_ext, memsize, cpu_T[1]); | |
1409 | - | |
1410 | - /* put dest in T0. */ | |
1411 | - tcg_gen_mov_tl(cpu_T[0], cpu_R[dc->op2]); | |
1415 | + insn_len = dec_prep_move_m(dc, s_ext, memsize, src); | |
1416 | + tcg_gen_mov_tl(dst, cpu_R[dc->op2]); | |
1412 | 1417 | return insn_len; |
1413 | 1418 | } |
1414 | 1419 | |
... | ... | @@ -1536,16 +1541,18 @@ static unsigned int dec_orq(DisasContext *dc) |
1536 | 1541 | } |
1537 | 1542 | static unsigned int dec_btstq(DisasContext *dc) |
1538 | 1543 | { |
1544 | + TCGv l0; | |
1539 | 1545 | dc->op1 = EXTRACT_FIELD(dc->ir, 0, 4); |
1540 | 1546 | DIS(fprintf (logfile, "btstq %u, $r%d\n", dc->op1, dc->op2)); |
1541 | 1547 | |
1542 | 1548 | cris_cc_mask(dc, CC_MASK_NZ); |
1543 | - | |
1549 | + l0 = tcg_temp_local_new(TCG_TYPE_TL); | |
1544 | 1550 | cris_alu(dc, CC_OP_BTST, |
1545 | - cpu_T[0], cpu_R[dc->op2], tcg_const_tl(dc->op1), 4); | |
1551 | + l0, cpu_R[dc->op2], tcg_const_tl(dc->op1), 4); | |
1546 | 1552 | cris_update_cc_op(dc, CC_OP_FLAGS, 4); |
1547 | - t_gen_mov_preg_TN(dc, PR_CCS, cpu_T[0]); | |
1553 | + t_gen_mov_preg_TN(dc, PR_CCS, l0); | |
1548 | 1554 | dc->flags_uptodate = 1; |
1555 | + tcg_temp_free(l0); | |
1549 | 1556 | return 2; |
1550 | 1557 | } |
1551 | 1558 | static unsigned int dec_asrq(DisasContext *dc) |
... | ... | @@ -1807,8 +1814,8 @@ static unsigned int dec_bound_r(DisasContext *dc) |
1807 | 1814 | cris_cc_mask(dc, CC_MASK_NZ); |
1808 | 1815 | l0 = tcg_temp_local_new(TCG_TYPE_TL); |
1809 | 1816 | dec_prep_move_r(dc, dc->op1, dc->op2, size, 0, l0); |
1810 | - cris_alu(dc, CC_OP_BOUND, | |
1811 | - cpu_R[dc->op2], cpu_R[dc->op2], l0, 4); | |
1817 | + cris_alu(dc, CC_OP_BOUND, cpu_R[dc->op2], cpu_R[dc->op2], l0, 4); | |
1818 | + tcg_temp_free(l0); | |
1812 | 1819 | return 2; |
1813 | 1820 | } |
1814 | 1821 | |
... | ... | @@ -1980,16 +1987,17 @@ static unsigned int dec_neg_r(DisasContext *dc) |
1980 | 1987 | |
1981 | 1988 | static unsigned int dec_btst_r(DisasContext *dc) |
1982 | 1989 | { |
1990 | + TCGv l0; | |
1983 | 1991 | DIS(fprintf (logfile, "btst $r%u, $r%u\n", |
1984 | 1992 | dc->op1, dc->op2)); |
1985 | 1993 | cris_cc_mask(dc, CC_MASK_NZ); |
1986 | - dec_prep_alu_r(dc, dc->op1, dc->op2, 4, 0, cpu_T[0], cpu_T[1]); | |
1987 | 1994 | |
1988 | - cris_alu(dc, CC_OP_BTST, | |
1989 | - cpu_T[0], cpu_T[0], cpu_T[1], 4); | |
1995 | + l0 = tcg_temp_local_new(TCG_TYPE_TL); | |
1996 | + cris_alu(dc, CC_OP_BTST, l0, cpu_R[dc->op2], cpu_R[dc->op1], 4); | |
1990 | 1997 | cris_update_cc_op(dc, CC_OP_FLAGS, 4); |
1991 | - t_gen_mov_preg_TN(dc, PR_CCS, cpu_T[0]); | |
1998 | + t_gen_mov_preg_TN(dc, PR_CCS, l0); | |
1992 | 1999 | dc->flags_uptodate = 1; |
2000 | + tcg_temp_free(l0); | |
1993 | 2001 | return 2; |
1994 | 2002 | } |
1995 | 2003 | |
... | ... | @@ -2283,8 +2291,21 @@ static unsigned int dec_move_mr(DisasContext *dc) |
2283 | 2291 | return insn_len; |
2284 | 2292 | } |
2285 | 2293 | |
2294 | +static inline void cris_alu_m_alloc_temps(TCGv *t) | |
2295 | +{ | |
2296 | + t[0] = tcg_temp_new(TCG_TYPE_TL); | |
2297 | + t[1] = tcg_temp_new(TCG_TYPE_TL); | |
2298 | +} | |
2299 | + | |
2300 | +static inline void cris_alu_m_free_temps(TCGv *t) | |
2301 | +{ | |
2302 | + tcg_temp_free(t[0]); | |
2303 | + tcg_temp_free(t[1]); | |
2304 | +} | |
2305 | + | |
2286 | 2306 | static unsigned int dec_movs_m(DisasContext *dc) |
2287 | 2307 | { |
2308 | + TCGv t[2]; | |
2288 | 2309 | int memsize = memsize_z(dc); |
2289 | 2310 | int insn_len; |
2290 | 2311 | DIS(fprintf (logfile, "movs.%c [$r%u%s, $r%u\n", |
... | ... | @@ -2292,17 +2313,20 @@ static unsigned int dec_movs_m(DisasContext *dc) |
2292 | 2313 | dc->op1, dc->postinc ? "+]" : "]", |
2293 | 2314 | dc->op2)); |
2294 | 2315 | |
2316 | + cris_alu_m_alloc_temps(t); | |
2295 | 2317 | /* sign extend. */ |
2296 | - insn_len = dec_prep_alu_m(dc, 1, memsize); | |
2318 | + insn_len = dec_prep_alu_m(dc, 1, memsize, t[0], t[1]); | |
2297 | 2319 | cris_cc_mask(dc, CC_MASK_NZ); |
2298 | 2320 | cris_alu(dc, CC_OP_MOVE, |
2299 | - cpu_R[dc->op2], cpu_R[dc->op2], cpu_T[1], 4); | |
2321 | + cpu_R[dc->op2], cpu_R[dc->op2], t[1], 4); | |
2300 | 2322 | do_postinc(dc, memsize); |
2323 | + cris_alu_m_free_temps(t); | |
2301 | 2324 | return insn_len; |
2302 | 2325 | } |
2303 | 2326 | |
2304 | 2327 | static unsigned int dec_addu_m(DisasContext *dc) |
2305 | 2328 | { |
2329 | + TCGv t[2]; | |
2306 | 2330 | int memsize = memsize_z(dc); |
2307 | 2331 | int insn_len; |
2308 | 2332 | DIS(fprintf (logfile, "addu.%c [$r%u%s, $r%u\n", |
... | ... | @@ -2310,17 +2334,20 @@ static unsigned int dec_addu_m(DisasContext *dc) |
2310 | 2334 | dc->op1, dc->postinc ? "+]" : "]", |
2311 | 2335 | dc->op2)); |
2312 | 2336 | |
2337 | + cris_alu_m_alloc_temps(t); | |
2313 | 2338 | /* sign extend. */ |
2314 | - insn_len = dec_prep_alu_m(dc, 0, memsize); | |
2339 | + insn_len = dec_prep_alu_m(dc, 0, memsize, t[0], t[1]); | |
2315 | 2340 | cris_cc_mask(dc, CC_MASK_NZVC); |
2316 | 2341 | cris_alu(dc, CC_OP_ADD, |
2317 | - cpu_R[dc->op2], cpu_R[dc->op2], cpu_T[1], 4); | |
2342 | + cpu_R[dc->op2], cpu_R[dc->op2], t[1], 4); | |
2318 | 2343 | do_postinc(dc, memsize); |
2344 | + cris_alu_m_free_temps(t); | |
2319 | 2345 | return insn_len; |
2320 | 2346 | } |
2321 | 2347 | |
2322 | 2348 | static unsigned int dec_adds_m(DisasContext *dc) |
2323 | 2349 | { |
2350 | + TCGv t[2]; | |
2324 | 2351 | int memsize = memsize_z(dc); |
2325 | 2352 | int insn_len; |
2326 | 2353 | DIS(fprintf (logfile, "adds.%c [$r%u%s, $r%u\n", |
... | ... | @@ -2328,17 +2355,19 @@ static unsigned int dec_adds_m(DisasContext *dc) |
2328 | 2355 | dc->op1, dc->postinc ? "+]" : "]", |
2329 | 2356 | dc->op2)); |
2330 | 2357 | |
2358 | + cris_alu_m_alloc_temps(t); | |
2331 | 2359 | /* sign extend. */ |
2332 | - insn_len = dec_prep_alu_m(dc, 1, memsize); | |
2360 | + insn_len = dec_prep_alu_m(dc, 1, memsize, t[0], t[1]); | |
2333 | 2361 | cris_cc_mask(dc, CC_MASK_NZVC); |
2334 | - cris_alu(dc, CC_OP_ADD, | |
2335 | - cpu_R[dc->op2], cpu_R[dc->op2], cpu_T[1], 4); | |
2362 | + cris_alu(dc, CC_OP_ADD, cpu_R[dc->op2], cpu_R[dc->op2], t[1], 4); | |
2336 | 2363 | do_postinc(dc, memsize); |
2364 | + cris_alu_m_free_temps(t); | |
2337 | 2365 | return insn_len; |
2338 | 2366 | } |
2339 | 2367 | |
2340 | 2368 | static unsigned int dec_subu_m(DisasContext *dc) |
2341 | 2369 | { |
2370 | + TCGv t[2]; | |
2342 | 2371 | int memsize = memsize_z(dc); |
2343 | 2372 | int insn_len; |
2344 | 2373 | DIS(fprintf (logfile, "subu.%c [$r%u%s, $r%u\n", |
... | ... | @@ -2346,17 +2375,19 @@ static unsigned int dec_subu_m(DisasContext *dc) |
2346 | 2375 | dc->op1, dc->postinc ? "+]" : "]", |
2347 | 2376 | dc->op2)); |
2348 | 2377 | |
2378 | + cris_alu_m_alloc_temps(t); | |
2349 | 2379 | /* sign extend. */ |
2350 | - insn_len = dec_prep_alu_m(dc, 0, memsize); | |
2380 | + insn_len = dec_prep_alu_m(dc, 0, memsize, t[0], t[1]); | |
2351 | 2381 | cris_cc_mask(dc, CC_MASK_NZVC); |
2352 | - cris_alu(dc, CC_OP_SUB, | |
2353 | - cpu_R[dc->op2], cpu_R[dc->op2], cpu_T[1], 4); | |
2382 | + cris_alu(dc, CC_OP_SUB, cpu_R[dc->op2], cpu_R[dc->op2], t[1], 4); | |
2354 | 2383 | do_postinc(dc, memsize); |
2384 | + cris_alu_m_free_temps(t); | |
2355 | 2385 | return insn_len; |
2356 | 2386 | } |
2357 | 2387 | |
2358 | 2388 | static unsigned int dec_subs_m(DisasContext *dc) |
2359 | 2389 | { |
2390 | + TCGv t[2]; | |
2360 | 2391 | int memsize = memsize_z(dc); |
2361 | 2392 | int insn_len; |
2362 | 2393 | DIS(fprintf (logfile, "subs.%c [$r%u%s, $r%u\n", |
... | ... | @@ -2364,17 +2395,19 @@ static unsigned int dec_subs_m(DisasContext *dc) |
2364 | 2395 | dc->op1, dc->postinc ? "+]" : "]", |
2365 | 2396 | dc->op2)); |
2366 | 2397 | |
2398 | + cris_alu_m_alloc_temps(t); | |
2367 | 2399 | /* sign extend. */ |
2368 | - insn_len = dec_prep_alu_m(dc, 1, memsize); | |
2400 | + insn_len = dec_prep_alu_m(dc, 1, memsize, t[0], t[1]); | |
2369 | 2401 | cris_cc_mask(dc, CC_MASK_NZVC); |
2370 | - cris_alu(dc, CC_OP_SUB, | |
2371 | - cpu_R[dc->op2], cpu_R[dc->op2], cpu_T[1], 4); | |
2402 | + cris_alu(dc, CC_OP_SUB, cpu_R[dc->op2], cpu_R[dc->op2], t[1], 4); | |
2372 | 2403 | do_postinc(dc, memsize); |
2404 | + cris_alu_m_free_temps(t); | |
2373 | 2405 | return insn_len; |
2374 | 2406 | } |
2375 | 2407 | |
2376 | 2408 | static unsigned int dec_movu_m(DisasContext *dc) |
2377 | 2409 | { |
2410 | + TCGv t[2]; | |
2378 | 2411 | int memsize = memsize_z(dc); |
2379 | 2412 | int insn_len; |
2380 | 2413 | |
... | ... | @@ -2383,16 +2416,18 @@ static unsigned int dec_movu_m(DisasContext *dc) |
2383 | 2416 | dc->op1, dc->postinc ? "+]" : "]", |
2384 | 2417 | dc->op2)); |
2385 | 2418 | |
2386 | - insn_len = dec_prep_alu_m(dc, 0, memsize); | |
2419 | + cris_alu_m_alloc_temps(t); | |
2420 | + insn_len = dec_prep_alu_m(dc, 0, memsize, t[0], t[1]); | |
2387 | 2421 | cris_cc_mask(dc, CC_MASK_NZ); |
2388 | - cris_alu(dc, CC_OP_MOVE, | |
2389 | - cpu_R[dc->op2], cpu_R[dc->op2], cpu_T[1], 4); | |
2422 | + cris_alu(dc, CC_OP_MOVE, cpu_R[dc->op2], cpu_R[dc->op2], t[1], 4); | |
2390 | 2423 | do_postinc(dc, memsize); |
2424 | + cris_alu_m_free_temps(t); | |
2391 | 2425 | return insn_len; |
2392 | 2426 | } |
2393 | 2427 | |
2394 | 2428 | static unsigned int dec_cmpu_m(DisasContext *dc) |
2395 | 2429 | { |
2430 | + TCGv t[2]; | |
2396 | 2431 | int memsize = memsize_z(dc); |
2397 | 2432 | int insn_len; |
2398 | 2433 | DIS(fprintf (logfile, "cmpu.%c [$r%u%s, $r%u\n", |
... | ... | @@ -2400,16 +2435,18 @@ static unsigned int dec_cmpu_m(DisasContext *dc) |
2400 | 2435 | dc->op1, dc->postinc ? "+]" : "]", |
2401 | 2436 | dc->op2)); |
2402 | 2437 | |
2403 | - insn_len = dec_prep_alu_m(dc, 0, memsize); | |
2438 | + cris_alu_m_alloc_temps(t); | |
2439 | + insn_len = dec_prep_alu_m(dc, 0, memsize, t[0], t[1]); | |
2404 | 2440 | cris_cc_mask(dc, CC_MASK_NZVC); |
2405 | - cris_alu(dc, CC_OP_CMP, | |
2406 | - cpu_R[dc->op2], cpu_R[dc->op2], cpu_T[1], 4); | |
2441 | + cris_alu(dc, CC_OP_CMP, cpu_R[dc->op2], cpu_R[dc->op2], t[1], 4); | |
2407 | 2442 | do_postinc(dc, memsize); |
2443 | + cris_alu_m_free_temps(t); | |
2408 | 2444 | return insn_len; |
2409 | 2445 | } |
2410 | 2446 | |
2411 | 2447 | static unsigned int dec_cmps_m(DisasContext *dc) |
2412 | 2448 | { |
2449 | + TCGv t[2]; | |
2413 | 2450 | int memsize = memsize_z(dc); |
2414 | 2451 | int insn_len; |
2415 | 2452 | DIS(fprintf (logfile, "cmps.%c [$r%u%s, $r%u\n", |
... | ... | @@ -2417,17 +2454,20 @@ static unsigned int dec_cmps_m(DisasContext *dc) |
2417 | 2454 | dc->op1, dc->postinc ? "+]" : "]", |
2418 | 2455 | dc->op2)); |
2419 | 2456 | |
2420 | - insn_len = dec_prep_alu_m(dc, 1, memsize); | |
2457 | + cris_alu_m_alloc_temps(t); | |
2458 | + insn_len = dec_prep_alu_m(dc, 1, memsize, t[0], t[1]); | |
2421 | 2459 | cris_cc_mask(dc, CC_MASK_NZVC); |
2422 | 2460 | cris_alu(dc, CC_OP_CMP, |
2423 | - cpu_R[dc->op2], cpu_R[dc->op2], cpu_T[1], | |
2461 | + cpu_R[dc->op2], cpu_R[dc->op2], t[1], | |
2424 | 2462 | memsize_zz(dc)); |
2425 | 2463 | do_postinc(dc, memsize); |
2464 | + cris_alu_m_free_temps(t); | |
2426 | 2465 | return insn_len; |
2427 | 2466 | } |
2428 | 2467 | |
2429 | 2468 | static unsigned int dec_cmp_m(DisasContext *dc) |
2430 | 2469 | { |
2470 | + TCGv t[2]; | |
2431 | 2471 | int memsize = memsize_zz(dc); |
2432 | 2472 | int insn_len; |
2433 | 2473 | DIS(fprintf (logfile, "cmp.%c [$r%u%s, $r%u\n", |
... | ... | @@ -2435,17 +2475,20 @@ static unsigned int dec_cmp_m(DisasContext *dc) |
2435 | 2475 | dc->op1, dc->postinc ? "+]" : "]", |
2436 | 2476 | dc->op2)); |
2437 | 2477 | |
2438 | - insn_len = dec_prep_alu_m(dc, 0, memsize); | |
2478 | + cris_alu_m_alloc_temps(t); | |
2479 | + insn_len = dec_prep_alu_m(dc, 0, memsize, t[0], t[1]); | |
2439 | 2480 | cris_cc_mask(dc, CC_MASK_NZVC); |
2440 | 2481 | cris_alu(dc, CC_OP_CMP, |
2441 | - cpu_R[dc->op2], cpu_R[dc->op2], cpu_T[1], | |
2482 | + cpu_R[dc->op2], cpu_R[dc->op2], t[1], | |
2442 | 2483 | memsize_zz(dc)); |
2443 | 2484 | do_postinc(dc, memsize); |
2485 | + cris_alu_m_free_temps(t); | |
2444 | 2486 | return insn_len; |
2445 | 2487 | } |
2446 | 2488 | |
2447 | 2489 | static unsigned int dec_test_m(DisasContext *dc) |
2448 | 2490 | { |
2491 | + TCGv t[2]; | |
2449 | 2492 | int memsize = memsize_zz(dc); |
2450 | 2493 | int insn_len; |
2451 | 2494 | DIS(fprintf (logfile, "test.%d [$r%u%s] op2=%x\n", |
... | ... | @@ -2455,19 +2498,21 @@ static unsigned int dec_test_m(DisasContext *dc) |
2455 | 2498 | |
2456 | 2499 | cris_evaluate_flags(dc); |
2457 | 2500 | |
2458 | - insn_len = dec_prep_alu_m(dc, 0, memsize); | |
2501 | + cris_alu_m_alloc_temps(t); | |
2502 | + insn_len = dec_prep_alu_m(dc, 0, memsize, t[0], t[1]); | |
2459 | 2503 | cris_cc_mask(dc, CC_MASK_NZ); |
2460 | 2504 | tcg_gen_andi_tl(cpu_PR[PR_CCS], cpu_PR[PR_CCS], ~3); |
2461 | 2505 | |
2462 | 2506 | cris_alu(dc, CC_OP_CMP, |
2463 | - cpu_R[dc->op2], cpu_T[1], tcg_const_tl(0), | |
2464 | - memsize_zz(dc)); | |
2507 | + cpu_R[dc->op2], t[1], tcg_const_tl(0), memsize_zz(dc)); | |
2465 | 2508 | do_postinc(dc, memsize); |
2509 | + cris_alu_m_free_temps(t); | |
2466 | 2510 | return insn_len; |
2467 | 2511 | } |
2468 | 2512 | |
2469 | 2513 | static unsigned int dec_and_m(DisasContext *dc) |
2470 | 2514 | { |
2515 | + TCGv t[2]; | |
2471 | 2516 | int memsize = memsize_zz(dc); |
2472 | 2517 | int insn_len; |
2473 | 2518 | DIS(fprintf (logfile, "and.%d [$r%u%s, $r%u\n", |
... | ... | @@ -2475,17 +2520,18 @@ static unsigned int dec_and_m(DisasContext *dc) |
2475 | 2520 | dc->op1, dc->postinc ? "+]" : "]", |
2476 | 2521 | dc->op2)); |
2477 | 2522 | |
2478 | - insn_len = dec_prep_alu_m(dc, 0, memsize); | |
2523 | + cris_alu_m_alloc_temps(t); | |
2524 | + insn_len = dec_prep_alu_m(dc, 0, memsize, t[0], t[1]); | |
2479 | 2525 | cris_cc_mask(dc, CC_MASK_NZ); |
2480 | - cris_alu(dc, CC_OP_AND, | |
2481 | - cpu_R[dc->op2], cpu_T[0], cpu_T[1], | |
2482 | - memsize_zz(dc)); | |
2526 | + cris_alu(dc, CC_OP_AND, cpu_R[dc->op2], t[0], t[1], memsize_zz(dc)); | |
2483 | 2527 | do_postinc(dc, memsize); |
2528 | + cris_alu_m_free_temps(t); | |
2484 | 2529 | return insn_len; |
2485 | 2530 | } |
2486 | 2531 | |
2487 | 2532 | static unsigned int dec_add_m(DisasContext *dc) |
2488 | 2533 | { |
2534 | + TCGv t[2]; | |
2489 | 2535 | int memsize = memsize_zz(dc); |
2490 | 2536 | int insn_len; |
2491 | 2537 | DIS(fprintf (logfile, "add.%d [$r%u%s, $r%u\n", |
... | ... | @@ -2493,17 +2539,19 @@ static unsigned int dec_add_m(DisasContext *dc) |
2493 | 2539 | dc->op1, dc->postinc ? "+]" : "]", |
2494 | 2540 | dc->op2)); |
2495 | 2541 | |
2496 | - insn_len = dec_prep_alu_m(dc, 0, memsize); | |
2542 | + cris_alu_m_alloc_temps(t); | |
2543 | + insn_len = dec_prep_alu_m(dc, 0, memsize, t[0], t[1]); | |
2497 | 2544 | cris_cc_mask(dc, CC_MASK_NZVC); |
2498 | 2545 | cris_alu(dc, CC_OP_ADD, |
2499 | - cpu_R[dc->op2], cpu_T[0], cpu_T[1], | |
2500 | - memsize_zz(dc)); | |
2546 | + cpu_R[dc->op2], t[0], t[1], memsize_zz(dc)); | |
2501 | 2547 | do_postinc(dc, memsize); |
2548 | + cris_alu_m_free_temps(t); | |
2502 | 2549 | return insn_len; |
2503 | 2550 | } |
2504 | 2551 | |
2505 | 2552 | static unsigned int dec_addo_m(DisasContext *dc) |
2506 | 2553 | { |
2554 | + TCGv t[2]; | |
2507 | 2555 | int memsize = memsize_zz(dc); |
2508 | 2556 | int insn_len; |
2509 | 2557 | DIS(fprintf (logfile, "add.%d [$r%u%s, $r%u\n", |
... | ... | @@ -2511,16 +2559,18 @@ static unsigned int dec_addo_m(DisasContext *dc) |
2511 | 2559 | dc->op1, dc->postinc ? "+]" : "]", |
2512 | 2560 | dc->op2)); |
2513 | 2561 | |
2514 | - insn_len = dec_prep_alu_m(dc, 1, memsize); | |
2562 | + cris_alu_m_alloc_temps(t); | |
2563 | + insn_len = dec_prep_alu_m(dc, 1, memsize, t[0], t[1]); | |
2515 | 2564 | cris_cc_mask(dc, 0); |
2516 | - cris_alu(dc, CC_OP_ADD, | |
2517 | - cpu_R[R_ACR], cpu_T[0], cpu_T[1], 4); | |
2565 | + cris_alu(dc, CC_OP_ADD, cpu_R[R_ACR], t[0], t[1], 4); | |
2518 | 2566 | do_postinc(dc, memsize); |
2567 | + cris_alu_m_free_temps(t); | |
2519 | 2568 | return insn_len; |
2520 | 2569 | } |
2521 | 2570 | |
2522 | 2571 | static unsigned int dec_bound_m(DisasContext *dc) |
2523 | 2572 | { |
2573 | + TCGv l[2]; | |
2524 | 2574 | int memsize = memsize_zz(dc); |
2525 | 2575 | int insn_len; |
2526 | 2576 | DIS(fprintf (logfile, "bound.%d [$r%u%s, $r%u\n", |
... | ... | @@ -2528,32 +2578,38 @@ static unsigned int dec_bound_m(DisasContext *dc) |
2528 | 2578 | dc->op1, dc->postinc ? "+]" : "]", |
2529 | 2579 | dc->op2)); |
2530 | 2580 | |
2531 | - insn_len = dec_prep_alu_m(dc, 0, memsize); | |
2581 | + l[0] = tcg_temp_local_new(TCG_TYPE_TL); | |
2582 | + l[1] = tcg_temp_local_new(TCG_TYPE_TL); | |
2583 | + insn_len = dec_prep_alu_m(dc, 0, memsize, l[0], l[1]); | |
2532 | 2584 | cris_cc_mask(dc, CC_MASK_NZ); |
2533 | - cris_alu(dc, CC_OP_BOUND, | |
2534 | - cpu_R[dc->op2], cpu_T[0], cpu_T[1], 4); | |
2585 | + cris_alu(dc, CC_OP_BOUND, cpu_R[dc->op2], l[0], l[1], 4); | |
2535 | 2586 | do_postinc(dc, memsize); |
2587 | + tcg_temp_free(l[0]); | |
2588 | + tcg_temp_free(l[1]); | |
2536 | 2589 | return insn_len; |
2537 | 2590 | } |
2538 | 2591 | |
2539 | 2592 | static unsigned int dec_addc_mr(DisasContext *dc) |
2540 | 2593 | { |
2594 | + TCGv t[2]; | |
2541 | 2595 | int insn_len = 2; |
2542 | 2596 | DIS(fprintf (logfile, "addc [$r%u%s, $r%u\n", |
2543 | 2597 | dc->op1, dc->postinc ? "+]" : "]", |
2544 | 2598 | dc->op2)); |
2545 | 2599 | |
2546 | 2600 | cris_evaluate_flags(dc); |
2547 | - insn_len = dec_prep_alu_m(dc, 0, 4); | |
2601 | + cris_alu_m_alloc_temps(t); | |
2602 | + insn_len = dec_prep_alu_m(dc, 0, 4, t[0], t[1]); | |
2548 | 2603 | cris_cc_mask(dc, CC_MASK_NZVC); |
2549 | - cris_alu(dc, CC_OP_ADDC, | |
2550 | - cpu_R[dc->op2], cpu_T[0], cpu_T[1], 4); | |
2604 | + cris_alu(dc, CC_OP_ADDC, cpu_R[dc->op2], t[0], t[1], 4); | |
2551 | 2605 | do_postinc(dc, 4); |
2606 | + cris_alu_m_free_temps(t); | |
2552 | 2607 | return insn_len; |
2553 | 2608 | } |
2554 | 2609 | |
2555 | 2610 | static unsigned int dec_sub_m(DisasContext *dc) |
2556 | 2611 | { |
2612 | + TCGv t[2]; | |
2557 | 2613 | int memsize = memsize_zz(dc); |
2558 | 2614 | int insn_len; |
2559 | 2615 | DIS(fprintf (logfile, "sub.%c [$r%u%s, $r%u ir=%x zz=%x\n", |
... | ... | @@ -2561,16 +2617,18 @@ static unsigned int dec_sub_m(DisasContext *dc) |
2561 | 2617 | dc->op1, dc->postinc ? "+]" : "]", |
2562 | 2618 | dc->op2, dc->ir, dc->zzsize)); |
2563 | 2619 | |
2564 | - insn_len = dec_prep_alu_m(dc, 0, memsize); | |
2620 | + cris_alu_m_alloc_temps(t); | |
2621 | + insn_len = dec_prep_alu_m(dc, 0, memsize, t[0], t[1]); | |
2565 | 2622 | cris_cc_mask(dc, CC_MASK_NZVC); |
2566 | - cris_alu(dc, CC_OP_SUB, | |
2567 | - cpu_R[dc->op2], cpu_T[0], cpu_T[1], memsize); | |
2623 | + cris_alu(dc, CC_OP_SUB, cpu_R[dc->op2], t[0], t[1], memsize); | |
2568 | 2624 | do_postinc(dc, memsize); |
2625 | + cris_alu_m_free_temps(t); | |
2569 | 2626 | return insn_len; |
2570 | 2627 | } |
2571 | 2628 | |
2572 | 2629 | static unsigned int dec_or_m(DisasContext *dc) |
2573 | 2630 | { |
2631 | + TCGv t[2]; | |
2574 | 2632 | int memsize = memsize_zz(dc); |
2575 | 2633 | int insn_len; |
2576 | 2634 | DIS(fprintf (logfile, "or.%d [$r%u%s, $r%u pc=%x\n", |
... | ... | @@ -2578,16 +2636,19 @@ static unsigned int dec_or_m(DisasContext *dc) |
2578 | 2636 | dc->op1, dc->postinc ? "+]" : "]", |
2579 | 2637 | dc->op2, dc->pc)); |
2580 | 2638 | |
2581 | - insn_len = dec_prep_alu_m(dc, 0, memsize); | |
2639 | + cris_alu_m_alloc_temps(t); | |
2640 | + insn_len = dec_prep_alu_m(dc, 0, memsize, t[0], t[1]); | |
2582 | 2641 | cris_cc_mask(dc, CC_MASK_NZ); |
2583 | 2642 | cris_alu(dc, CC_OP_OR, |
2584 | - cpu_R[dc->op2], cpu_T[0], cpu_T[1], memsize_zz(dc)); | |
2643 | + cpu_R[dc->op2], t[0], t[1], memsize_zz(dc)); | |
2585 | 2644 | do_postinc(dc, memsize); |
2645 | + cris_alu_m_free_temps(t); | |
2586 | 2646 | return insn_len; |
2587 | 2647 | } |
2588 | 2648 | |
2589 | 2649 | static unsigned int dec_move_mp(DisasContext *dc) |
2590 | 2650 | { |
2651 | + TCGv t[2]; | |
2591 | 2652 | int memsize = memsize_zz(dc); |
2592 | 2653 | int insn_len = 2; |
2593 | 2654 | |
... | ... | @@ -2597,26 +2658,29 @@ static unsigned int dec_move_mp(DisasContext *dc) |
2597 | 2658 | dc->postinc ? "+]" : "]", |
2598 | 2659 | dc->op2)); |
2599 | 2660 | |
2600 | - insn_len = dec_prep_alu_m(dc, 0, memsize); | |
2661 | + cris_alu_m_alloc_temps(t); | |
2662 | + insn_len = dec_prep_alu_m(dc, 0, memsize, t[0], t[1]); | |
2601 | 2663 | cris_cc_mask(dc, 0); |
2602 | 2664 | if (dc->op2 == PR_CCS) { |
2603 | 2665 | cris_evaluate_flags(dc); |
2604 | 2666 | if (dc->tb_flags & U_FLAG) { |
2605 | 2667 | /* User space is not allowed to touch all flags. */ |
2606 | - tcg_gen_andi_tl(cpu_T[1], cpu_T[1], 0x39f); | |
2607 | - tcg_gen_andi_tl(cpu_T[0], cpu_PR[PR_CCS], ~0x39f); | |
2608 | - tcg_gen_or_tl(cpu_T[1], cpu_T[0], cpu_T[1]); | |
2668 | + tcg_gen_andi_tl(t[1], t[1], 0x39f); | |
2669 | + tcg_gen_andi_tl(t[0], cpu_PR[PR_CCS], ~0x39f); | |
2670 | + tcg_gen_or_tl(t[1], t[0], t[1]); | |
2609 | 2671 | } |
2610 | 2672 | } |
2611 | 2673 | |
2612 | - t_gen_mov_preg_TN(dc, dc->op2, cpu_T[1]); | |
2674 | + t_gen_mov_preg_TN(dc, dc->op2, t[1]); | |
2613 | 2675 | |
2614 | 2676 | do_postinc(dc, memsize); |
2677 | + cris_alu_m_free_temps(t); | |
2615 | 2678 | return insn_len; |
2616 | 2679 | } |
2617 | 2680 | |
2618 | 2681 | static unsigned int dec_move_pm(DisasContext *dc) |
2619 | 2682 | { |
2683 | + TCGv t0; | |
2620 | 2684 | int memsize; |
2621 | 2685 | |
2622 | 2686 | memsize = preg_sizes[dc->op2]; |
... | ... | @@ -2628,9 +2692,11 @@ static unsigned int dec_move_pm(DisasContext *dc) |
2628 | 2692 | /* prepare store. Address in T0, value in T1. */ |
2629 | 2693 | if (dc->op2 == PR_CCS) |
2630 | 2694 | cris_evaluate_flags(dc); |
2631 | - t_gen_mov_TN_preg(cpu_T[1], dc->op2); | |
2695 | + t0 = tcg_temp_new(TCG_TYPE_TL); | |
2696 | + t_gen_mov_TN_preg(t0, dc->op2); | |
2632 | 2697 | cris_flush_cc_state(dc); |
2633 | - gen_store(dc, cpu_R[dc->op1], cpu_T[1], memsize); | |
2698 | + gen_store(dc, cpu_R[dc->op1], t0, memsize); | |
2699 | + tcg_temp_free(t0); | |
2634 | 2700 | |
2635 | 2701 | cris_cc_mask(dc, 0); |
2636 | 2702 | if (dc->postinc) |
... | ... | @@ -2641,24 +2707,27 @@ static unsigned int dec_move_pm(DisasContext *dc) |
2641 | 2707 | static unsigned int dec_movem_mr(DisasContext *dc) |
2642 | 2708 | { |
2643 | 2709 | TCGv tmp[16]; |
2710 | + TCGv addr; | |
2644 | 2711 | int i; |
2645 | 2712 | int nr = dc->op2 + 1; |
2646 | 2713 | |
2647 | 2714 | DIS(fprintf (logfile, "movem [$r%u%s, $r%u\n", dc->op1, |
2648 | 2715 | dc->postinc ? "+]" : "]", dc->op2)); |
2649 | 2716 | |
2717 | + addr = tcg_temp_new(TCG_TYPE_TL); | |
2650 | 2718 | /* There are probably better ways of doing this. */ |
2651 | 2719 | cris_flush_cc_state(dc); |
2652 | 2720 | for (i = 0; i < (nr >> 1); i++) { |
2653 | 2721 | tmp[i] = tcg_temp_new(TCG_TYPE_I64); |
2654 | - tcg_gen_addi_tl(cpu_T[0], cpu_R[dc->op1], i * 8); | |
2655 | - gen_load(dc, tmp[i], cpu_T[0], 8, 0); | |
2722 | + tcg_gen_addi_tl(addr, cpu_R[dc->op1], i * 8); | |
2723 | + gen_load(dc, tmp[i], addr, 8, 0); | |
2656 | 2724 | } |
2657 | 2725 | if (nr & 1) { |
2658 | 2726 | tmp[i] = tcg_temp_new(TCG_TYPE_I32); |
2659 | - tcg_gen_addi_tl(cpu_T[0], cpu_R[dc->op1], i * 8); | |
2660 | - gen_load(dc, tmp[i], cpu_T[0], 4, 0); | |
2727 | + tcg_gen_addi_tl(addr, cpu_R[dc->op1], i * 8); | |
2728 | + gen_load(dc, tmp[i], addr, 4, 0); | |
2661 | 2729 | } |
2730 | + tcg_temp_free(addr); | |
2662 | 2731 | |
2663 | 2732 | for (i = 0; i < (nr >> 1); i++) { |
2664 | 2733 | tcg_gen_trunc_i64_i32(cpu_R[i * 2], tmp[i]); |
... | ... | @@ -2683,6 +2752,7 @@ static unsigned int dec_movem_mr(DisasContext *dc) |
2683 | 2752 | static unsigned int dec_movem_rm(DisasContext *dc) |
2684 | 2753 | { |
2685 | 2754 | TCGv tmp; |
2755 | + TCGv addr; | |
2686 | 2756 | int i; |
2687 | 2757 | |
2688 | 2758 | DIS(fprintf (logfile, "movem $r%u, [$r%u%s\n", dc->op2, dc->op1, |
... | ... | @@ -2691,18 +2761,20 @@ static unsigned int dec_movem_rm(DisasContext *dc) |
2691 | 2761 | cris_flush_cc_state(dc); |
2692 | 2762 | |
2693 | 2763 | tmp = tcg_temp_new(TCG_TYPE_TL); |
2764 | + addr = tcg_temp_new(TCG_TYPE_TL); | |
2694 | 2765 | tcg_gen_movi_tl(tmp, 4); |
2695 | - tcg_gen_mov_tl(cpu_T[0], cpu_R[dc->op1]); | |
2766 | + tcg_gen_mov_tl(addr, cpu_R[dc->op1]); | |
2696 | 2767 | for (i = 0; i <= dc->op2; i++) { |
2697 | 2768 | /* Displace addr. */ |
2698 | 2769 | /* Perform the store. */ |
2699 | - gen_store(dc, cpu_T[0], cpu_R[i], 4); | |
2700 | - tcg_gen_add_tl(cpu_T[0], cpu_T[0], tmp); | |
2770 | + gen_store(dc, addr, cpu_R[i], 4); | |
2771 | + tcg_gen_add_tl(addr, addr, tmp); | |
2701 | 2772 | } |
2702 | 2773 | if (dc->postinc) |
2703 | - tcg_gen_mov_tl(cpu_R[dc->op1], cpu_T[0]); | |
2774 | + tcg_gen_mov_tl(cpu_R[dc->op1], addr); | |
2704 | 2775 | cris_cc_mask(dc, 0); |
2705 | 2776 | tcg_temp_free(tmp); |
2777 | + tcg_temp_free(addr); | |
2706 | 2778 | return 2; |
2707 | 2779 | } |
2708 | 2780 | |
... | ... | @@ -2759,9 +2831,9 @@ static unsigned int dec_jump_p(DisasContext *dc) |
2759 | 2831 | |
2760 | 2832 | if (dc->op2 == PR_CCS) |
2761 | 2833 | cris_evaluate_flags(dc); |
2762 | - t_gen_mov_TN_preg(cpu_T[0], dc->op2); | |
2834 | + t_gen_mov_TN_preg(env_btarget, dc->op2); | |
2763 | 2835 | /* rete will often have low bit set to indicate delayslot. */ |
2764 | - tcg_gen_andi_tl(env_btarget, cpu_T[0], ~1); | |
2836 | + tcg_gen_andi_tl(env_btarget, env_btarget, ~1); | |
2765 | 2837 | cris_cc_mask(dc, 0); |
2766 | 2838 | cris_prepare_jmp(dc, JMP_INDIRECT); |
2767 | 2839 | return 2; |
... | ... | @@ -3429,16 +3501,6 @@ CPUCRISState *cpu_cris_init (const char *cpu_model) |
3429 | 3501 | tcg_initialized = 1; |
3430 | 3502 | |
3431 | 3503 | cpu_env = tcg_global_reg_new(TCG_TYPE_PTR, TCG_AREG0, "env"); |
3432 | -#if TARGET_LONG_BITS > HOST_LONG_BITS | |
3433 | - cpu_T[0] = tcg_global_mem_new(TCG_TYPE_TL, | |
3434 | - TCG_AREG0, offsetof(CPUState, t0), "T0"); | |
3435 | - cpu_T[1] = tcg_global_mem_new(TCG_TYPE_TL, | |
3436 | - TCG_AREG0, offsetof(CPUState, t1), "T1"); | |
3437 | -#else | |
3438 | - cpu_T[0] = tcg_global_reg_new(TCG_TYPE_TL, TCG_AREG1, "T0"); | |
3439 | - cpu_T[1] = tcg_global_reg_new(TCG_TYPE_TL, TCG_AREG2, "T1"); | |
3440 | -#endif | |
3441 | - | |
3442 | 3504 | cc_x = tcg_global_mem_new(TCG_TYPE_TL, TCG_AREG0, |
3443 | 3505 | offsetof(CPUState, cc_x), "cc_x"); |
3444 | 3506 | cc_src = tcg_global_mem_new(TCG_TYPE_TL, TCG_AREG0, | ... | ... |