| 1 | /* |
| 2 | * ========== Copyright Header Begin ========================================== |
| 3 | * |
| 4 | * OpenSPARC T2 Processor File: reguse.h |
| 5 | * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. |
| 6 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. |
| 7 | * |
| 8 | * The above named program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public |
| 10 | * License version 2 as published by the Free Software Foundation. |
| 11 | * |
| 12 | * The above named program is distributed in the hope that it will be |
| 13 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public |
| 18 | * License along with this work; if not, write to the Free Software |
| 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. |
| 20 | * |
| 21 | * ========== Copyright Header End ============================================ |
| 22 | */ |
| 23 | #ifndef _REGUSE_H |
| 24 | #define _REGUSE_H |
| 25 | |
| 26 | #include <sys/types.h> |
| 27 | |
| 28 | #include "IHASH.h" |
| 29 | |
| 30 | #ifdef __cplusplus |
| 31 | extern "C" { |
| 32 | #endif |
| 33 | |
| 34 | enum { |
| 35 | RUS_NRUS = 5, |
| 36 | |
| 37 | /* ru_reg values */ |
| 38 | RU_RD = 0, |
| 39 | RU_RS1 = 1, |
| 40 | RU_RS2 = 2, |
| 41 | RU_RS3 = 3, |
| 42 | |
| 43 | RU_Q = 4, |
| 44 | RU_SR = 5, |
| 45 | RU_PSR = 6, |
| 46 | RU_TBR = 7, |
| 47 | RU_WIM = 8, |
| 48 | RU_Y = 9, |
| 49 | |
| 50 | RU_REG = 0x40, |
| 51 | |
| 52 | /* ru_type values */ |
| 53 | RU_INT = 0, |
| 54 | RU_FP = 1, |
| 55 | RU_CP = 2 |
| 56 | }; |
| 57 | |
| 58 | typedef struct { |
| 59 | char ru_reg; /* RU_RS1, etc., or RU_REG|reg# */ |
| 60 | char ru_type; /* register set, q.v. */ |
| 61 | char ru_nregs; /* 0 single, 1 double, 3 quadruple */ |
| 62 | char ru_io; /* 0 src, 1 dest */ |
| 63 | char ru_imm; /* i_i==0 */ |
| 64 | } RegUse; |
| 65 | |
| 66 | typedef struct { |
| 67 | char rus_nrus; |
| 68 | RegUse rus_rus[RUS_NRUS]; |
| 69 | } RegUses; |
| 70 | |
| 71 | extern RegUses ihash_reguses[NIHASH]; |
| 72 | |
| 73 | RegUses* getRegUses(int ih); |
| 74 | int getRegFieldUse(int ih, int rupos); |
| 75 | |
| 76 | int decodeFreg(int reg); |
| 77 | int encodeFreg(int reg); |
| 78 | |
| 79 | uint64_t getDefs(unsigned instr, int ih); |
| 80 | uint64_t getUses(unsigned instr, int ih); |
| 81 | |
| 82 | uint64_t getFloatDefs(unsigned instr, int ih); |
| 83 | uint64_t getFloatUses(unsigned instr, int ih); |
| 84 | |
| 85 | #ifdef __cplusplus |
| 86 | } |
| 87 | #endif |
| 88 | |
| 89 | #endif /* _REGUSE_H */ |