174bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt/* 274bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt * Tiny Code Generator for QEMU 374bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt * 474bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt * Copyright (c) 2008 Fabrice Bellard 574bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt * 674bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt * Permission is hereby granted, free of charge, to any person obtaining a copy 774bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt * of this software and associated documentation files (the "Software"), to deal 874bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt * in the Software without restriction, including without limitation the rights 974bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 1074bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt * copies of the Software, and to permit persons to whom the Software is 1174bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt * furnished to do so, subject to the following conditions: 1274bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt * 1374bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt * The above copyright notice and this permission notice shall be included in 1474bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt * all copies or substantial portions of the Software. 1574bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt * 1674bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1774bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1874bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 1974bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 2074bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 2174bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 2274bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt * THE SOFTWARE. 2374bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt */ 2474bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt#define TCG_TARGET_PPC 1 2574bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt 2674bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt#define TCG_TARGET_REG_BITS 32 2774bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt#define TCG_TARGET_WORDS_BIGENDIAN 2874bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt#define TCG_TARGET_NB_REGS 32 2974bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt 3074bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedtenum { 3174bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt TCG_REG_R0 = 0, 3274bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt TCG_REG_R1, 3374bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt TCG_REG_R2, 3474bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt TCG_REG_R3, 3574bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt TCG_REG_R4, 3674bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt TCG_REG_R5, 3774bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt TCG_REG_R6, 3874bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt TCG_REG_R7, 3974bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt TCG_REG_R8, 4074bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt TCG_REG_R9, 4174bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt TCG_REG_R10, 4274bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt TCG_REG_R11, 4374bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt TCG_REG_R12, 4474bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt TCG_REG_R13, 4574bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt TCG_REG_R14, 4674bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt TCG_REG_R15, 4774bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt TCG_REG_R16, 4874bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt TCG_REG_R17, 4974bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt TCG_REG_R18, 5074bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt TCG_REG_R19, 5174bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt TCG_REG_R20, 5274bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt TCG_REG_R21, 5374bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt TCG_REG_R22, 5474bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt TCG_REG_R23, 5574bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt TCG_REG_R24, 5674bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt TCG_REG_R25, 5774bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt TCG_REG_R26, 5874bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt TCG_REG_R27, 5974bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt TCG_REG_R28, 6074bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt TCG_REG_R29, 6174bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt TCG_REG_R30, 6274bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt TCG_REG_R31 6374bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt}; 6474bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt 6574bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt/* used for function call generation */ 6674bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt#define TCG_REG_CALL_STACK TCG_REG_R1 6774bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt#define TCG_TARGET_STACK_ALIGN 16 68f1d9bf153726533acf659efd796aa484dfd0b412David 'Digit' Turner#if defined _CALL_DARWIN || defined __APPLE__ 6974bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt#define TCG_TARGET_CALL_STACK_OFFSET 24 7074bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt#elif defined _CALL_AIX 7174bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt#define TCG_TARGET_CALL_STACK_OFFSET 52 7274bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt#elif defined _CALL_SYSV 7374bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt#define TCG_TARGET_CALL_ALIGN_ARGS 1 7474bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt#define TCG_TARGET_CALL_STACK_OFFSET 8 7574bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt#else 7674bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt#error Unsupported system 7774bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt#endif 7874bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt 7974bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt/* optional instructions */ 8074bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt#define TCG_TARGET_HAS_div_i32 8174bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt#define TCG_TARGET_HAS_rot_i32 8274bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt#define TCG_TARGET_HAS_ext8s_i32 8374bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt#define TCG_TARGET_HAS_ext16s_i32 8474bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt#define TCG_TARGET_HAS_ext8u_i32 8574bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt#define TCG_TARGET_HAS_ext16u_i32 86f1d9bf153726533acf659efd796aa484dfd0b412David 'Digit' Turner#define TCG_TARGET_HAS_bswap16_i32 87f1d9bf153726533acf659efd796aa484dfd0b412David 'Digit' Turner#define TCG_TARGET_HAS_bswap32_i32 8874bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt#define TCG_TARGET_HAS_not_i32 8974bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt#define TCG_TARGET_HAS_neg_i32 9074bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt#define TCG_TARGET_HAS_andc_i32 9174bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt#define TCG_TARGET_HAS_orc_i32 92f1d9bf153726533acf659efd796aa484dfd0b412David 'Digit' Turner#define TCG_TARGET_HAS_eqv_i32 93f1d9bf153726533acf659efd796aa484dfd0b412David 'Digit' Turner#define TCG_TARGET_HAS_nand_i32 94f1d9bf153726533acf659efd796aa484dfd0b412David 'Digit' Turner#define TCG_TARGET_HAS_nor_i32 9574bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt 9674bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt#define TCG_AREG0 TCG_REG_R27 9774bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt 9874bdaadb718584b216e29c13b9e1226c9f77205eMarcus Comstedt#define TCG_TARGET_HAS_GUEST_BASE 99