#include "em_flag.h"
#include "em_ptyp.h"
#include "array.h"
+#include "imap.h"
#include "pmap.h"
#include "diagnostics.h"
#include "astring.h"
#include "ir.h"
#include "mcgg.h"
#include "hop.h"
+#include "procedure.h"
extern char em_pseu[][4];
extern char em_mnem[][4];
} u;
};
-struct procedure
-{
- const char* name;
- struct basicblock* root_bb;
- size_t nlocals;
- ARRAYOF(struct basicblock) blocks;
-};
-
struct basicblock
{
const char* name;
extern void tb_filestart(void);
extern void tb_fileend(void);
extern void tb_procedure(struct procedure* proc);
-extern void tb_regvar(arith offset, int size, int type, int priority);
+extern void tb_regvar(struct procedure* proc, arith offset, int size, int type, int priority);
extern void pass_convert_stack_ops(struct procedure* proc);
extern void pass_remove_dead_blocks(struct procedure* proc);
extern void pass_promote_float_ops(struct procedure* proc);
extern void pass_group_irs(struct procedure* proc);
-extern void procedure_compile(struct procedure* proc);
-
#endif
/* vim: set sw=4 ts=4 expandtab : */
int size = mes_get_cst();
int type = mes_get_cst();
int priority = mes_get_cst();
- tb_regvar(offset, size, type, priority);
+ tb_regvar(current_proc, offset, size, type, priority);
}
break;
}
--- /dev/null
+#ifndef PROCEDURE_H
+#define PROCEDURE_H
+
+struct local
+{
+ bool is_register;
+};
+
+struct procedure
+{
+ const char* name;
+ struct basicblock* root_bb;
+ size_t nlocals;
+ ARRAYOF(struct basicblock) blocks;
+ IMAPOF(struct local) locals;
+};
+
+extern void procedure_compile(struct procedure* proc);
+
+#endif
+
+/* vim: set sw=4 ts=4 expandtab : */
{
}
-void tb_regvar(arith offset, int size, int type, int priority)
+void tb_regvar(struct procedure* procedure, arith offset, int size, int type, int priority)
{
- /* ignored */
+ struct local* local = calloc(1, sizeof(*local));
+ local->size = size;
+ local->is_register = true;
+ imap_put(&procedure->locals, offset, local);
}
static struct ir* address_of_external(const char* label, arith offset)