Support calls through function temps.

I had forgotten function vars stored in ents and objects would use a temp
when calling the function.
This commit is contained in:
Bill Currie 2012-12-01 11:10:47 +09:00
parent 5e9d7d3567
commit 848493379d
3 changed files with 9 additions and 0 deletions

View file

@ -43,6 +43,7 @@ typedef enum {
typedef struct { typedef struct {
struct def_s *def; struct def_s *def;
struct type_s *type;
struct flowvar_s *flowvar; struct flowvar_s *flowvar;
struct daglabel_s *daglabel; struct daglabel_s *daglabel;
int users; int users;

View file

@ -575,6 +575,13 @@ get_function_type (operand_t *op)
if (op->o.value->type != ev_func) if (op->o.value->type != ev_func)
internal_error (0, "not a function value"); internal_error (0, "not a function value");
type = op->o.value->v.func_val.type; type = op->o.value->v.func_val.type;
} else if (op->op_type == op_temp) {
type = op->o.tempop.type;
if (type->type != ev_func)
internal_error (0, "not a function temp");
type = type->t.func.type;
} else {
internal_error (0, "don't know how to extract function type");
} }
// fixme temps? // fixme temps?
return low_level_type (type); return low_level_type (type);

View file

@ -301,6 +301,7 @@ temp_operand (type_t *type)
{ {
operand_t *op = new_operand (op_temp); operand_t *op = new_operand (op_temp);
op->o.tempop.type = type;
op->type = low_level_type (type); op->type = low_level_type (type);
op->size = type_size (type); op->size = type_size (type);
return op; return op;