mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-23 10:50:58 +00:00
Use operand types rather than def types to select opcodes.
With temp types changing and temps being reused within the one instruction, the def type is no longer usable for selecting the opcode. However, the operand types are stable and more correct.
This commit is contained in:
parent
60321061d2
commit
5018f5147c
3 changed files with 10 additions and 9 deletions
|
@ -46,10 +46,10 @@ extern struct opcode_s *op_goto;
|
|||
extern struct opcode_s *op_jump;
|
||||
extern struct opcode_s *op_jumpb;
|
||||
|
||||
struct def_s;
|
||||
struct operand_s;
|
||||
|
||||
struct opcode_s *opcode_find (const char *name, struct def_s *def_a,
|
||||
struct def_s *def_b, struct def_s *def_c);
|
||||
struct opcode_s *opcode_find (const char *name, struct operand_s *op_a,
|
||||
struct operand_s *op_b, struct operand_s *op_c);
|
||||
void opcode_init (void);
|
||||
|
||||
#endif//__opcodes_h
|
||||
|
|
|
@ -198,7 +198,7 @@ emit_statement (statement_t *statement)
|
|||
use_tempop (statement->opb, statement->expr);
|
||||
def_c = get_operand_def (statement->expr, statement->opc);
|
||||
use_tempop (statement->opc, statement->expr);
|
||||
op = opcode_find (opcode, def_a, def_b, def_c);
|
||||
op = opcode_find (opcode, statement->opa, statement->opb, statement->opc);
|
||||
|
||||
if (!op) {
|
||||
print_expr (statement->expr);
|
||||
|
|
|
@ -41,10 +41,10 @@
|
|||
|
||||
#include <QF/hash.h>
|
||||
|
||||
#include "def.h"
|
||||
#include "opcodes.h"
|
||||
#include "options.h"
|
||||
#include "qfcc.h"
|
||||
#include "statements.h"
|
||||
#include "type.h"
|
||||
|
||||
hashtab_t *opcode_type_table;
|
||||
|
@ -92,7 +92,8 @@ check_operand_type (etype_t ot1, etype_t ot2)
|
|||
}
|
||||
|
||||
opcode_t *
|
||||
opcode_find (const char *name, def_t *def_a, def_t *def_b, def_t *def_c)
|
||||
opcode_find (const char *name, operand_t *op_a, operand_t *op_b,
|
||||
operand_t *op_c)
|
||||
{
|
||||
opcode_t search_op;
|
||||
opcode_t *op;
|
||||
|
@ -101,9 +102,9 @@ opcode_find (const char *name, def_t *def_a, def_t *def_b, def_t *def_c)
|
|||
int i;
|
||||
|
||||
search_op.name = name;
|
||||
search_op.type_a = def_a ? def_a->type->type : ev_invalid;
|
||||
search_op.type_b = def_b ? def_b->type->type : ev_invalid;
|
||||
search_op.type_c = def_c ? def_c->type->type : ev_invalid;
|
||||
search_op.type_a = op_a ? op_a->type : ev_invalid;
|
||||
search_op.type_b = op_b ? op_b->type : ev_invalid;
|
||||
search_op.type_c = op_c ? op_c->type : ev_invalid;
|
||||
op = Hash_FindElement (opcode_type_table, &search_op);
|
||||
if (op)
|
||||
return op;
|
||||
|
|
Loading…
Reference in a new issue