summaryrefslogtreecommitdiff
path: root/codegen.c
diff options
context:
space:
mode:
Diffstat (limited to 'codegen.c')
-rw-r--r--codegen.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/codegen.c b/codegen.c
index a32046b..019baf0 100644
--- a/codegen.c
+++ b/codegen.c
@@ -34,12 +34,12 @@ static const struct storage_location MULDIV_OVERFLOW_LOC = {
static struct scope* scope;
static const struct fn_decl_node* active_fn;
-static unsigned long long branch_counter = 0;
-static unsigned long long loop_counter = 0;
+static integral_t branch_counter = 0;
+static integral_t loop_counter = 0;
static void enter_scope(
struct scope* child_scope,
- unsigned long long bp_offset
+ integral_t bp_offset
) {
if (child_scope == NULL ||
child_scope->next_out != scope)
@@ -99,7 +99,7 @@ static void deallocate_temporary(FILE* outfile, const struct lval_def* tmp) {
static void emit_storage_loc(
FILE* outfile,
const struct storage_location* loc,
- unsigned long long sz
+ integral_t sz
) {
switch (loc->type) {
case STO_LABEL:
@@ -153,7 +153,7 @@ static bool locs_equal(
CGEN_PANIC("unhandled storage type case");
}
-static void emit_size_const(FILE* outfile, unsigned long long sz) {
+static void emit_size_const(FILE* outfile, integral_t sz) {
if (sz > 4) fprintf(outfile, "qword ");
else if (sz > 2) fprintf(outfile, "dword ");
else if (sz > 1) fprintf(outfile, "word ");
@@ -273,7 +273,7 @@ static void emit_char_lit(
dst,
&(struct storage_location) {
.type = STO_IMM,
- .value = (unsigned long long) node->val
+ .value = (integral_t) node->val
});
}
}
@@ -342,8 +342,8 @@ static void emit_call(
const struct call_node* node,
const struct lval_def* dst
) {
- unsigned long long orig_bp_offset = scope->bp_offset;
- unsigned long long arg_bp_offset = orig_bp_offset;
+ integral_t orig_bp_offset = scope->bp_offset;
+ integral_t arg_bp_offset = orig_bp_offset;
struct decl_list_node* arg_decl = node->called_fn_ref->args;
struct expr_list_node* arg_eval = node->args;
@@ -574,7 +574,7 @@ static void emit_if(FILE* outfile, const struct if_node* node) {
emit_expr(outfile, node->cond, &cond_result);
emit_cmp_zero(outfile, &cond_result);
- unsigned long long branch_num = ++branch_counter;
+ integral_t branch_num = ++branch_counter;
fprintf(outfile, "\tjz branch_false@%lld\n", branch_num);
emit_stmt(outfile, node->true_branch);
@@ -611,7 +611,7 @@ static void emit_loop(FILE* outfile, const struct loop_node* node) {
if (node->init != NULL) emit_loop_init(outfile, node->init);
- unsigned long long loop_num = ++loop_counter;
+ integral_t loop_num = ++loop_counter;
if (node->cond != NULL) {
struct lval_def cond_dst =
allocate_temporary(outfile, node->cond->resolved_type);