Line 24... |
Line 24... |
char *insn_string;
|
char *insn_string;
|
int insn_index;
|
int insn_index;
|
|
|
};
|
};
|
|
|
|
|
|
// Structs for internal statistics keeping
|
|
|
|
struct or1k_value_list
|
|
{
|
|
|
|
#define OR1K_VALUE_MAX_ENTRIES 64
|
|
int count;
|
|
// [value][occurances_of_value]
|
|
int32_t values[OR1K_VALUE_MAX_ENTRIES][2];
|
|
|
|
};
|
|
|
|
struct or1k_insn_info
|
|
{
|
|
char* insn_string;
|
|
|
|
int count;
|
|
|
|
int has_branchtarg;
|
|
struct or1k_value_list branch_info;
|
|
|
|
int has_imm;
|
|
struct or1k_value_list imm_info;
|
|
|
|
int has_rD;
|
|
int rD_use_freq[32];
|
|
int has_rA;
|
|
int rA_use_freq[32];
|
|
int has_rB;
|
|
int rB_use_freq[32];
|
|
|
|
// Set maximum instructions in a row we'll keep track of, starting at pairs
|
|
#define OR1K_MAX_GROUPINGS_ANALYSIS 4
|
|
#define OR1K_MAX_ENTRIES_PER_GROUP 1000
|
|
// Format of grouping data:
|
|
//
|
|
// 1st dimension: A list for each n-tuple group we're keeping track of
|
|
// (starting at pairs of instructions)
|
|
//
|
|
// 2nd dimension: Stores the list entries for the 1st dimension-tuple
|
|
// grouping. The number in [x][0][0] is the number of entries in the list so
|
|
// far, beginning at 0. The actual entries with data for grouping x start at
|
|
// [x][1][], where that entry holds the 1st x+2-tuple grouping information
|
|
// (eg. at x=0, [0][1][] is the first entry for/ pair instruction
|
|
// information, x=1, is for triples, x=2 quadruples, etc)
|
|
//
|
|
// 3rd dimension: Store up to x+2 instruction indexes (where x is the first
|
|
// dimension index, meaning this particular data is for a (x+2)-tuple set)
|
|
// and then a frequency count for this set (in index (x+2) of the third
|
|
// dimension array). Note we will have the index for the instruction this
|
|
// struct corresponds to in [x][n][(x+2)-1], which seems redundant, but can
|
|
// help processing later on. The final entry after the instruction indexes
|
|
// is the occurance count for this particular set (at [x][n][x+2])
|
|
//
|
|
// Note that we will have empty entries in the third dimension arrays for all
|
|
// but the last in the list of n-tuples. This is to save doing tricky naming
|
|
// defines and, in the future, if we would like to analyse sets that are
|
|
// bigger or smaller, hopefully all we need to do is change a single define.
|
|
//
|
|
int groupings[OR1K_MAX_GROUPINGS_ANALYSIS][OR1K_MAX_ENTRIES_PER_GROUP+1][OR1K_MAX_GROUPINGS_ANALYSIS+1];
|
|
|
|
};
|
|
|
|
// This number should correspond to the maximum insn_index we assign in the
|
|
// analyse function
|
|
#define OR1K_32_MAX_INSNS 117
|
|
extern struct or1k_insn_info * or1k_32_insns[OR1K_32_MAX_INSNS];
|
|
|
|
|
// OpenRISC 1000 32-bit instruction defines, helping us
|
// OpenRISC 1000 32-bit instruction defines, helping us
|
// extract fields of the instructions
|
// extract fields of the instructions
|
|
|
// Instruction decode/set its options
|
// Instruction decode/set its options
|
int or1k_32_analyse_insn(uint32_t insn,
|
int or1k_32_analyse_insn(uint32_t insn,
|
Line 45... |
Line 115... |
|
|
// Add the stats for this one
|
// Add the stats for this one
|
void or1k_32_insn_lists_add(uint32_t insn,
|
void or1k_32_insn_lists_add(uint32_t insn,
|
struct or1k_32_instruction_properties *insn_props);
|
struct or1k_32_instruction_properties *insn_props);
|
|
|
|
// Record the occurance of a group of instructions
|
|
void or1k_32_ntuple_add(int n,
|
|
struct or1k_32_instruction_properties *insn_props);
|
|
|
// Print out some useful information
|
// Print out some useful information
|
void or1k_32_generate_stats(FILE * stream);
|
void or1k_32_generate_stats(FILE * stream);
|
|
|
// Free lists
|
// Free lists
|
void or1k_32_insn_lists_free(void);
|
void or1k_32_insn_lists_free(void);
|