Commit b8dddab9 authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig

midgard: Drop suffixes

parent ed11a5e9
......@@ -35,7 +35,7 @@
#define DEFINE_CASE(define, str) case define: { printf(str); break; }
midgard_word_type_e midgard_word_type[16] = {
midgard_word_type midgard_word_types[16] = {
midgard_word_type_unknown, /* 0x0 */
midgard_word_type_unknown, /* 0x1 */
midgard_word_type_unknown, /* 0x2 */
......@@ -132,7 +132,7 @@ static void ogt_asm_print_tabs(int tabs)
/* TODO STUB FIXME */
}
static void print_alu_opcode(midgard_alu_op_e op)
static void print_alu_opcode(midgard_alu_op op)
{
bool int_op = false;
......@@ -147,7 +147,7 @@ static void print_alu_opcode(midgard_alu_op_e op)
is_instruction_int = int_op;
}
static void print_ld_st_opcode(midgard_load_store_op_e op)
static void print_ld_st_opcode(midgard_load_store_op op)
{
if (load_store_opcode_names[op])
printf("%s", load_store_opcode_names[op]);
......@@ -181,7 +181,7 @@ static char* outmod_names[4] = {
".sat"
};
static void print_outmod(midgard_outmod_e outmod)
static void print_outmod(midgard_outmod outmod)
{
printf("%s", outmod_names[outmod]);
}
......@@ -211,7 +211,7 @@ static void print_16bit_words(uint16_t* words, unsigned num_words)
static void print_vector_src(unsigned src_binary, bool out_high,
bool out_half, unsigned reg)
{
midgard_vector_alu_src_t* src = (midgard_vector_alu_src_t*)&src_binary;
midgard_vector_alu_src* src = (midgard_vector_alu_src*)&src_binary;
if (src->negate)
printf("-");
......@@ -276,8 +276,8 @@ static uint16_t decode_vector_imm(unsigned src2_reg, unsigned imm)
static void print_vector_field(const char *name, uint16_t* words, uint16_t reg_word,
unsigned tabs)
{
midgard_reg_info_t* reg_info = (midgard_reg_info_t*)&reg_word;
midgard_vector_alu_t* alu_field = (midgard_vector_alu_t*) words;
midgard_reg_info* reg_info = (midgard_reg_info*)&reg_word;
midgard_vector_alu* alu_field = (midgard_vector_alu*) words;
if (alu_field->reg_mode != midgard_reg_mode_half &&
alu_field->reg_mode != midgard_reg_mode_full)
......@@ -380,7 +380,7 @@ static void print_vector_field(const char *name, uint16_t* words, uint16_t reg_w
static void print_scalar_src(unsigned src_binary, unsigned reg)
{
midgard_scalar_alu_src_t* src = (midgard_scalar_alu_src_t*)&src_binary;
midgard_scalar_alu_src* src = (midgard_scalar_alu_src*)&src_binary;
if (src->negate)
printf("-");
......@@ -414,8 +414,8 @@ static uint16_t decode_scalar_imm(unsigned src2_reg, unsigned imm)
static void print_scalar_field(const char *name, uint16_t* words, uint16_t reg_word,
unsigned tabs)
{
midgard_reg_info_t* reg_info = (midgard_reg_info_t*)&reg_word;
midgard_scalar_alu_t* alu_field = (midgard_scalar_alu_t*) words;
midgard_reg_info* reg_info = (midgard_reg_info*)&reg_word;
midgard_scalar_alu* alu_field = (midgard_scalar_alu*) words;
if (alu_field->unknown)
{
......@@ -458,13 +458,13 @@ static void print_scalar_field(const char *name, uint16_t* words, uint16_t reg_w
static void print_compact_branch_writeout_field(uint16_t word)
{
midgard_jmp_writeout_op_e op = word & 0x7;
midgard_jmp_writeout_op op = word & 0x7;
switch (op)
{
case midgard_jmp_writeout_op_branch_uncond:
{
midgard_branch_uncond_t br_uncond;
midgard_branch_uncond br_uncond;
memcpy((char*) &br_uncond, (char*) &word, sizeof(br_uncond));
printf("br.uncond ");
if (br_uncond.unknown != 1)
......@@ -478,7 +478,7 @@ static void print_compact_branch_writeout_field(uint16_t word)
case midgard_jmp_writeout_op_writeout:
case midgard_jmp_writeout_op_discard:
{
midgard_branch_cond_t br_cond;
midgard_branch_cond br_cond;
memcpy((char*) &br_cond, (char*) &word, sizeof(br_cond));
printf("br.");
......@@ -732,7 +732,7 @@ static void print_mask(uint32_t mask)
static void print_load_store_instr(uint64_t data,
unsigned tabs)
{
midgard_load_store_word_t* word = (midgard_load_store_word_t *) &data;
midgard_load_store_word* word = (midgard_load_store_word *) &data;
ogt_asm_print_tabs(tabs);
print_ld_st_opcode(word->op);
printf(" r%d", word->reg);
......@@ -746,7 +746,7 @@ static void print_load_store_instr(uint64_t data,
static void print_load_store_word(uint32_t* word, unsigned tabs)
{
midgard_load_store_t* load_store = (midgard_load_store_t *) word;
midgard_load_store* load_store = (midgard_load_store *) word;
if (load_store->word1 != 3)
{
......@@ -804,7 +804,7 @@ static void print_texture_op(int format)
static void print_texture_word(uint32_t* word, unsigned tabs)
{
midgard_texture_word_t* texture = (midgard_texture_word_t *) word;
midgard_texture_word* texture = (midgard_texture_word *) word;
ogt_asm_print_tabs(tabs);
......@@ -925,7 +925,7 @@ void DisassembleMidgard(uint8_t* code, size_t size)
while (i < num_words)
{
unsigned num_quad_words = midgard_word_size[words[i] & 0xF];
switch (midgard_word_type[words[i] & 0xF])
switch (midgard_word_types[words[i] & 0xF])
{
case midgard_word_type_texture:
print_texture_word(&words[i], tabs);
......@@ -966,7 +966,7 @@ void DisassembleMidgard(uint8_t* code, size_t size)
if (next == 1) {
prefetch_flag = true;
if (midgard_word_type[words[i] & 0xF] != midgard_word_type_alu)
if (midgard_word_types[words[i] & 0xF] != midgard_word_type_alu)
return;
}
}
......
......@@ -36,12 +36,7 @@ typedef enum
midgard_word_type_load_store,
midgard_word_type_texture,
midgard_word_type_unknown
} midgard_word_type_e;
extern midgard_word_type_e midgard_word_type[];
//size in quadwords, i.e. multiples of 128 bits
extern unsigned midgard_word_size[];
} midgard_word_type;
typedef enum
{
......@@ -50,7 +45,7 @@ typedef enum
midgard_alu_smul,
midgard_alu_vadd,
midgard_alu_lut
} midgard_alu_e;
} midgard_alu;
/*
* ALU words
......@@ -95,7 +90,7 @@ typedef enum
midgard_alu_op_fsin = 0xF6,
midgard_alu_op_fcos = 0xF7,
midgard_alu_op_fatan2_pt1 = 0xF9,
} midgard_alu_op_e;
} midgard_alu_op;
typedef enum
{
......@@ -103,20 +98,20 @@ typedef enum
midgard_outmod_pos = 1,
midgard_outmod_int = 2,
midgard_outmod_sat = 3
} midgard_outmod_e;
} midgard_outmod;
typedef enum
{
midgard_reg_mode_half = 1,
midgard_reg_mode_full = 2
} midgard_reg_mode_e;
} midgard_reg_mode;
typedef enum
{
midgard_dest_override_lower = 0,
midgard_dest_override_upper = 1,
midgard_dest_override_none = 2
} midgard_dest_override_e;
} midgard_dest_override;
typedef struct
__attribute__((__packed__))
......@@ -131,19 +126,19 @@ __attribute__((__packed__))
bool rep_high : 1; /* unused if dest = full */
bool half : 1; /* only matters if dest = full */
unsigned swizzle : 8;
} midgard_vector_alu_src_t;
} midgard_vector_alu_src;
typedef struct
__attribute__((__packed__))
{
midgard_alu_op_e op : 8;
midgard_reg_mode_e reg_mode : 2;
midgard_alu_op op : 8;
midgard_reg_mode reg_mode : 2;
unsigned src1 : 13;
unsigned src2 : 13;
midgard_dest_override_e dest_override : 2;
midgard_outmod_e outmod : 2;
midgard_dest_override dest_override : 2;
midgard_outmod outmod : 2;
unsigned mask : 8;
} midgard_vector_alu_t;
} midgard_vector_alu;
typedef struct
__attribute__((__packed__))
......@@ -152,19 +147,19 @@ __attribute__((__packed__))
bool negate : 1;
bool full : 1; /* 0 = half, 1 = full */
unsigned component : 3;
} midgard_scalar_alu_src_t;
} midgard_scalar_alu_src;
typedef struct
__attribute__((__packed__))
{
midgard_alu_op_e op : 8;
midgard_alu_op op : 8;
unsigned src1 : 6;
unsigned src2 : 11;
unsigned unknown : 1;
midgard_outmod_e outmod : 2;
midgard_outmod outmod : 2;
bool output_full : 1;
unsigned output_component : 3;
} midgard_scalar_alu_t;
} midgard_scalar_alu;
typedef struct
__attribute__((__packed__))
......@@ -173,7 +168,7 @@ __attribute__((__packed__))
unsigned src2_reg : 5;
unsigned out_reg : 5;
bool src2_imm : 1;
} midgard_reg_info_t;
} midgard_reg_info;
typedef enum
{
......@@ -181,32 +176,32 @@ typedef enum
midgard_jmp_writeout_op_branch_cond = 2,
midgard_jmp_writeout_op_discard = 4,
midgard_jmp_writeout_op_writeout = 7,
} midgard_jmp_writeout_op_e;
} midgard_jmp_writeout_op;
typedef struct
__attribute__((__packed__))
{
midgard_jmp_writeout_op_e op : 3; /* == branch_uncond */
midgard_jmp_writeout_op op : 3; /* == branch_uncond */
unsigned dest_tag : 4; /* tag of branch destination */
unsigned unknown : 2;
int offset : 7;
} midgard_branch_uncond_t;
} midgard_branch_uncond;
typedef struct
__attribute__((__packed__))
{
midgard_jmp_writeout_op_e op : 3; /* == branch_cond */
midgard_jmp_writeout_op op : 3; /* == branch_cond */
unsigned dest_tag : 4; /* tag of branch destination */
int offset : 7;
unsigned cond : 2;
} midgard_branch_cond_t;
} midgard_branch_cond;
typedef struct
__attribute__((__packed__))
{
midgard_jmp_writeout_op_e op : 3; /* == writeout */
midgard_jmp_writeout_op op : 3; /* == writeout */
unsigned unknown : 13;
} midgard_writeout_t;
} midgard_writeout;
/*
* Load/store words
......@@ -223,18 +218,18 @@ typedef enum
midgard_op_load_uniform_32 = 0xB0,
midgard_op_store_vary_16 = 0xD5,
midgard_op_store_vary_32 = 0xD4
} midgard_load_store_op_e;
} midgard_load_store_op;
typedef struct
__attribute__((__packed__))
{
midgard_load_store_op_e op : 8;
midgard_load_store_op op : 8;
unsigned reg : 5;
unsigned mask : 4;
unsigned swizzle : 8;
unsigned unknown : 26;
unsigned address : 9;
} midgard_load_store_word_t;
} midgard_load_store_word;
typedef struct
__attribute__((__packed__))
......@@ -243,7 +238,7 @@ __attribute__((__packed__))
unsigned next_type : 4;
uint64_t word1 : 60;
uint64_t word2 : 60;
} midgard_load_store_t;
} midgard_load_store;
/* Texture pipeline results are in r28-r29 */
#define REG_TEX_BASE 28
......@@ -329,6 +324,6 @@ __attribute__((__packed__))
unsigned texture_handle : 16;
unsigned sampler_handle : 16;
} midgard_texture_word_t;
} midgard_texture_word;
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment