Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Types from beginning to end #37

Merged
merged 98 commits into from
Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
0d41365
Initial Mess
LensPlaysGames Jan 21, 2023
fe4610d
Make it work more betterer
LensPlaysGames Jan 22, 2023
2f4d462
[Bugfix] Zero extending loads fixes *a lot*
LensPlaysGames Jan 22, 2023
9a013f3
[Bug] Identify bug with binary operator type
LensPlaysGames Jan 22, 2023
5831094
[Bugfix] Fix error in format string
LensPlaysGames Jan 23, 2023
055931c
[Codegen] Handle size of type when calculating address offset
LensPlaysGames Jan 27, 2023
08f8d36
[Codegen] Make IR_LOAD great again (arrays! (again))
LensPlaysGames Jan 27, 2023
2578acc
[x86_64/Bugfix] Missing register size parameter in femit
LensPlaysGames Jan 27, 2023
89337ae
[MSWIN/Bugfix] Handle error of `SymFromAddr()`
LensPlaysGames Jan 27, 2023
9fa9485
[Sema] Handle some basic type casting cases in typechecker
LensPlaysGames Jan 27, 2023
3457d53
[Typo] Forgetting a newline is bad, mmkay?
LensPlaysGames Jan 27, 2023
b5b3183
[Minor] Fix horribly phrased comment
LensPlaysGames Jan 29, 2023
8a94037
[Docs] Better comments regarding type helpers in `ast.h`
LensPlaysGames Jan 29, 2023
61f28a8
[Minor] Add signedness reminder to casting codegen todo
LensPlaysGames Jan 29, 2023
98ae71e
[Bugfix] Copy and paste strikes again :I
LensPlaysGames Jan 29, 2023
f06972a
[Codegen] Handle subscript operator all at once, instead of split
LensPlaysGames Jan 29, 2023
aa23eae
[Minor] Add commentary on array pointer decay codegen
LensPlaysGames Jan 29, 2023
c9be95c
[Minor] Remove unnecessary `t_void` assignments from IR helpers
LensPlaysGames Jan 29, 2023
61d343d
[Bugfix] IR type of bitwise not was incorrectly always `t_integer`
LensPlaysGames Jan 29, 2023
1ad6dbf
[Codegen/x86_64] Remove useless `r128` RegSize
LensPlaysGames Jan 29, 2023
d82cd3d
[Codegen/x86_64] Don't emit xor + mov when a 32-bit mov is usable
LensPlaysGames Jan 29, 2023
9b30942
[Codegen/IR] Make variable allocation instructions pointers to type
LensPlaysGames Jan 29, 2023
20e42a0
[Sema/Minor] Some updates to typecasting
LensPlaysGames Jan 29, 2023
3ad2392
[TODO] `as void` discard cast
LensPlaysGames Jan 29, 2023
e7d77a7
[Tests] Lines with trailing whitespace keep me up at night
LensPlaysGames Jan 29, 2023
b4af7c9
[Codegen/x86_64] Update incorrect comments regarding var. args
LensPlaysGames Jan 30, 2023
8013c43
[Codegen/x86_64] Mention `movzx` instruction where applicable
LensPlaysGames Jan 30, 2023
a836f0b
[Codegen/x86_64] Add `t_pointer` primitive type
LensPlaysGames Jan 30, 2023
9d23bd2
[Sema] Fix `t_pointer` definition
LensPlaysGames Jan 30, 2023
55e1ec0
[Sema] Disallow typecasting between arrays
LensPlaysGames Jan 31, 2023
e339100
[Minor] TODO comment in Sema
LensPlaysGames Jan 31, 2023
6c4570d
[Examples] Using a byte array as a C string
LensPlaysGames Jan 31, 2023
a94f836
[Bugfix] Lexer no longer relies on null terminator
LensPlaysGames Feb 1, 2023
933ed59
[Frontend] Basic string literal support :O
LensPlaysGames Feb 1, 2023
312d4e7
[Codegen] Very basic codegen of string literals
LensPlaysGames Feb 1, 2023
ac386a8
[Examples] Basic string literal example
LensPlaysGames Feb 1, 2023
ab4eac2
[TODO] Arrays have two kinds of loading we need to be able to emit
LensPlaysGames Feb 1, 2023
4423fee
[AST] Make `ast_print_node` publicly available
LensPlaysGames Feb 2, 2023
c57b388
[Minor] Formatting
LensPlaysGames Feb 2, 2023
ab7dcf8
[Sema] Emit error over previous todo as we now handle (some) casting
LensPlaysGames Feb 2, 2023
db2d432
[Sema] Disallow non-equal incomplete types entirely
LensPlaysGames Feb 2, 2023
1bd10b3
[Minor/AST] Add meaningful docstring to `type_is_incomplete_canon`
LensPlaysGames Feb 2, 2023
66f7289
[Minor/AST] Better formatting of docstring for `type_canonical`
LensPlaysGames Feb 2, 2023
b125c17
[Minor/TODO] Update unnecessarily narrowing statement :P
LensPlaysGames Feb 2, 2023
bee8136
[AST] Remove `id` system entirely
LensPlaysGames Feb 2, 2023
afebae2
[Tests] Two tests---one passes, one fails
LensPlaysGames Feb 2, 2023
e669db3
[Codegen/IR] Remove `cached_*` members from `IRStaticVariable`
LensPlaysGames Feb 2, 2023
c9ccbb2
[Minor/AST] Stub implementation of `type_alignof`
LensPlaysGames Feb 2, 2023
6615957
[Codegen/x86_64] Use `type_sizeof(t_pointer)` where applicable
LensPlaysGames Feb 2, 2023
9b71982
[Codegen/IR] Fix overwrite of `rhs` of subscript operator
LensPlaysGames Feb 2, 2023
dc49514
[Minor/Codegen] Update diagnostic message
LensPlaysGames Feb 2, 2023
4e3e0f8
[Tests] Add `negative-numbers.un`
LensPlaysGames Feb 2, 2023
ec7b772
[Minor] Be slightly more explicit about primitive type defined name
LensPlaysGames Feb 2, 2023
974bdff
[Minor/Codegen] Fix scuffed diagnostic message
LensPlaysGames Feb 2, 2023
32f6a44
[IR] Create `ir_static_reference()` to reference an existing static
LensPlaysGames Feb 3, 2023
b2d090d
[Codegen] Use `ir_static_reference()` to create many references
LensPlaysGames Feb 3, 2023
b14fa1c
[Bugfix/x86_64] Add missing parameter...
LensPlaysGames Feb 3, 2023
8281a44
[Minor/Codegen] Add TODO comment
LensPlaysGames Feb 3, 2023
ec35e50
[Codegen/x86_64] Begin move away from `va_list` towards typed params
LensPlaysGames Feb 3, 2023
6574a1d
[Codegen/x86_64] Move further away from variable args...
LensPlaysGames Feb 3, 2023
e830a9f
[Codegen/x86_64] Moving even further away from variable args...
LensPlaysGames Feb 3, 2023
339e07c
[Codegen/x86_64] `femit_name_to_reg()` typed parameters
LensPlaysGames Feb 3, 2023
84f1e10
[Codegen/x86_64] `femit_reg_to_mem()` typed parameters
LensPlaysGames Feb 3, 2023
80749cf
[Codegen/x86_64] Nearly completely moved away from variable args...
LensPlaysGames Feb 3, 2023
81aaf8e
[Codegen/x86_64] More comprehensive ICE error message in `femit()`
LensPlaysGames Feb 3, 2023
a400f57
[Minor/x86_64] Comments, error message
LensPlaysGames Feb 3, 2023
4a70c4c
Merge branch 'main' into ir_types_bb
LensPlaysGames Feb 3, 2023
cd2381a
[Minor/Codegen] Outline places where string literals need handled
LensPlaysGames Feb 3, 2023
f922e21
[Minor/Codegen] Yet still always more to do due soon
LensPlaysGames Feb 3, 2023
13b8210
[Bugfix] Add missing zero initialiser (needed by MSVC)
LensPlaysGames Feb 4, 2023
33c195c
[Minor] Remove accidentally tracked file
LensPlaysGames Feb 4, 2023
49c9970
[Sema] Fix copy-and-paste error
LensPlaysGames Feb 6, 2023
e594ee5
[UX] Allow `colors` as well as `colours` in CLI
LensPlaysGames Feb 7, 2023
b95d879
[TODO] String literals are parsed, now
LensPlaysGames Feb 7, 2023
b7be438
Disable IR intake as it is severely lacking in development right now
LensPlaysGames Feb 7, 2023
49f6762
[Bugfix] Fix types in wrong order in error message
LensPlaysGames Feb 7, 2023
6c49cac
[Sema] Move some `type_is_*` functions up to `ast.h` from `typechecke…
LensPlaysGames Feb 7, 2023
7253339
[Minor/Sema] Use `vector_back` instead of manual calculation
LensPlaysGames Feb 7, 2023
7b84f66
[Minor/Sema] Actually use `vector_back_or` in case of no children
LensPlaysGames Feb 7, 2023
771b9b4
[Minor/Sema] This should now work pretty much as expected
LensPlaysGames Feb 7, 2023
df8ffb0
[Minor/Sema] Very minor formatting
LensPlaysGames Feb 7, 2023
5a60f48
[Bugfix] Source spans of assignments were off; this fixes them
LensPlaysGames Feb 7, 2023
cc09b8b
[Sema] Use `type_is_*` instead of direct comparisons
LensPlaysGames Feb 7, 2023
836f99b
[Codegen] Improve codegen of subscript variable reference
LensPlaysGames Feb 7, 2023
acd725c
[AST] Update `ast_print_node` with easier to use signature
LensPlaysGames Feb 7, 2023
f3fab2d
[Codegen] Remove now-unnecessary array bodge in var. ref. codegen
LensPlaysGames Feb 7, 2023
a8241fa
[Codegen] ¡Subscript of local variable!
LensPlaysGames Feb 7, 2023
6c027c7
[Codegen] Apparently better ¡Codegen of Subscript of local variable!
LensPlaysGames Feb 7, 2023
c7f87aa
[Codegen/x86_64] Fix clobber values of `does_clobber` for shift instr…
LensPlaysGames Feb 7, 2023
88715b4
[Tests] Add bit-shifting left and right tests
LensPlaysGames Feb 7, 2023
1104d93
[AST] Rename `t_pointer` to `t_void_ptr`
LensPlaysGames Feb 7, 2023
b222c7f
[Codegen/IR] Remove use of `ir_static_reference`
LensPlaysGames Feb 7, 2023
6411d36
[Minor/IR] Simplify wording of comment
LensPlaysGames Feb 7, 2023
40b4430
[Minor/Codegen] Comments; fixed a typo
LensPlaysGames Feb 7, 2023
f1f876c
[Codegen] Rename `var` to the more correct `var_decl`
LensPlaysGames Feb 7, 2023
8282edc
[Sema] Get rid of `is_*` wrappers, where possible
LensPlaysGames Feb 7, 2023
3a9c115
[Codegen/IR] Fix assigned type of `IR_LOAD` instructions
LensPlaysGames Feb 7, 2023
79c22b1
[TODO] NODISCARD should be default for non-void return types
LensPlaysGames Feb 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@
- [ ] Disallow overloading on the return value.
- [ ] Proper checking for incomplete types in the parser.
- [ ] Types in the IR
- [ ] Byte type
- [ ] Type info in codegen/IR.
- [x] Byte type
- [x] Type info in codegen/IR.
- [ ] Backend: Handle size/alignment requirements
- [ ] Use eax, ax, al, etc.
- [x] Use eax, ax, al, etc.
- [ ] Actually implementing casts.
- [ ] During codegen, we should actually output `zext`/`sext` if needed. Otherwise truncation is automatic.
- [ ] Update IR parser
- [ ] Arrays
- [ ] Semantic analysis for static arrays.
Expand Down
4 changes: 4 additions & 0 deletions examples/byte.un
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
a : byte = 34
b : byte = 35
c : byte = a + b
c
15 changes: 7 additions & 8 deletions src/codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ static void codegen_expr(CodegenContext *ctx, Node *expr) {
case NODE_DECLARATION:
expr->ir = expr->declaration.static_
? ir_create_static(ctx, expr->type, as_span(expr->declaration.name))
: ir_stack_allocate(ctx, type_sizeof(expr->type));
: ir_stack_allocate(ctx, expr->type);

/// Emit the initialiser if there is one.
if (expr->declaration.init) {
Expand Down Expand Up @@ -215,7 +215,7 @@ static void codegen_expr(CodegenContext *ctx, Node *expr) {

/// Insert a phi node for the result of the if in the join block.
if (!type_is_void(expr->type)) {
IRInstruction *phi = ir_phi(ctx);
IRInstruction *phi = ir_phi(ctx, expr->type);
ir_phi_argument(phi, last_then_block, expr->if_.then->ir);
ir_phi_argument(phi, last_else_block, expr->if_.else_->ir);
expr->ir = phi;
Expand Down Expand Up @@ -423,7 +423,8 @@ static void codegen_expr(CodegenContext *ctx, Node *expr) {
/// Literal expression. Only integer literals are supported for now.
case NODE_LITERAL:
if (expr->literal.type != TK_NUMBER) DIAG(DIAG_SORRY, expr->source_location, "Emitting non-integer literals not supported");
expr->ir = ir_immediate(ctx, expr->literal.integer);
// TODO: SEMA should probably have already lowered integer_literal type, so we *should* have a type already available on the literal node...
expr->ir = ir_immediate(ctx, expr->type, expr->literal.integer);
return;

/// Variable reference.
Expand Down Expand Up @@ -456,13 +457,11 @@ void codegen_function(CodegenContext *ctx, Node *node) {
/// Emit the function body.
codegen_expr(ctx, node->function.body);

/// If the we can return from here, and this function doesn’t return void,
/// If we can return from here, and this function doesn’t return void,
/// then return the return value; otherwise, just return nothing.
if (!ir_is_closed(ctx->block) && !type_is_void(node->type->function.return_type)) {
if (!ir_is_closed(ctx->block) && !type_is_void(node->type->function.return_type))
ir_return(ctx, node->function.body->ir);
} else {
ir_return(ctx, NULL);
}
else ir_return(ctx, NULL);
}

/// ===========================================================================
Expand Down
55 changes: 37 additions & 18 deletions src/codegen/intermediate_representation.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,9 @@ void ir_remove(IRInstruction* instruction) {
vector_delete(instruction->users);
ir_unmark_usees(instruction);
/// Parameters / static refs should not be freed here.
if (instruction->kind != IR_PARAMETER && instruction->kind != IR_STATIC_REF) {
if (instruction->kind != IR_PARAMETER && instruction->kind != IR_STATIC_REF)
free(instruction);
} else {
vector_push(instruction->parent_block->function->context->removed_instructions, instruction);
}
else vector_push(instruction->parent_block->function->context->removed_instructions, instruction);
}

void ir_remove_and_free_block(IRBlock *block) {
Expand Down Expand Up @@ -263,6 +261,9 @@ void ir_femit_instruction
ICE("Invalid IRType %d\n", inst->kind);
}

// Print type that the value this instruction returns is of.
LensPlaysGames marked this conversation as resolved.
Show resolved Hide resolved
if (inst->type) fprint(file, " %31| %T", inst->type);

#ifdef DEBUG_USES
/// Print users
fprint(file, "%m\033[60GUsers: ");
Expand Down Expand Up @@ -359,10 +360,11 @@ IRInstruction *ir_parameter

/// Add a parameter to a function. This alters the number of
/// parameters the function takes, so use it with caution.
void ir_add_parameter_to_function(IRFunction *f) {
void ir_add_parameter_to_function(IRFunction *f, Type *type) {
INSTRUCTION(parameter, IR_PARAMETER);
parameter->imm = f->parameters.size;
parameter->id = (u32) f->parameters.size;
parameter->type = type;
ir_insert(f->context, parameter);
vector_push(f->parameters, parameter);
}
Expand All @@ -384,9 +386,7 @@ void ir_phi_argument
IRPhiArgument *arg = calloc(1, sizeof *arg);
arg->block = phi_predecessor;
arg->value = argument;

vector_push(phi->phi_args, arg);
mark_used(argument, phi);
ir_phi_add_argument(phi, arg);
}

void ir_phi_remove_argument(IRInstruction *phi, IRBlock *block) {
Expand All @@ -399,8 +399,9 @@ void ir_phi_remove_argument(IRInstruction *phi, IRBlock *block) {
}
}

IRInstruction *ir_phi(CodegenContext *context) {
IRInstruction *ir_phi(CodegenContext *context, Type *type) {
INSTRUCTION(phi, IR_PHI);
phi->type = type;
INSERT(phi);
return phi;
}
Expand Down Expand Up @@ -442,10 +443,11 @@ IRFunction *ir_function(CodegenContext *context, span name, Type *function_type)
vector_push(context->functions, function);

/// Generate param refs.
for (u64 i = 1; i <= function_type->function.parameters.size; i++) {
for (u64 i = 1; i <= function_type->function.parameters.size; ++i) {
INSTRUCTION(param, IR_PARAMETER);
param->imm = i - 1;
param->id = (u32) i;
param->type = function_type->function.parameters.data[i - 1].type;
vector_push(function->parameters, param);
INSERT(param);
}
Expand All @@ -455,17 +457,20 @@ IRFunction *ir_function(CodegenContext *context, span name, Type *function_type)
IRInstruction *ir_funcref(CodegenContext *context, IRFunction *function) {
INSTRUCTION(funcref, IR_FUNC_REF);
funcref->function_ref = function;
funcref->type = function->type;
INSERT(funcref);
return funcref;
}

IRInstruction *ir_immediate
(CodegenContext *context,
Type *type,
u64 immediate
)
{
INSTRUCTION(imm, IR_IMMEDIATE);
imm->imm = immediate;
imm->type = type;
INSERT(imm);
return imm;
}
Expand All @@ -478,6 +483,9 @@ IRInstruction *ir_load
INSTRUCTION(load, IR_LOAD);

load->operand = address;
// TODO: Is this right?
load->type = address->type;
LensPlaysGames marked this conversation as resolved.
Show resolved Hide resolved

mark_used(address, load);

INSERT(load);
Expand All @@ -490,9 +498,9 @@ IRInstruction *ir_direct_call
)
{
ASSERT(callee, "Cannot create direct call to NULL function");
(void) context;
INSTRUCTION(call, IR_CALL);
call->call.callee_function = callee;
call->type = callee->type->function.return_type;
return call;
}

Expand All @@ -501,10 +509,10 @@ IRInstruction *ir_indirect_call
IRInstruction *function
)
{
(void) context;
INSTRUCTION(call, IR_CALL);
call->call.callee_instruction = function;
call->call.is_indirect = true;
call->type = function->type->function.return_type;
mark_used(function, call);
return call;
}
Expand All @@ -518,6 +526,7 @@ IRInstruction *ir_store
INSTRUCTION(store, IR_STORE);
store->store.addr = address;
store->store.value = data;
store->type = t_void; //> A store instruction does not return anything.
LensPlaysGames marked this conversation as resolved.
Show resolved Hide resolved
mark_used(address, store);
mark_used(data, store);
INSERT(store);
Expand All @@ -538,6 +547,8 @@ IRInstruction *ir_branch_conditional

branch->cond_br.then = then_block;
branch->cond_br.else_ = otherwise_block;

branch->type = t_void;
LensPlaysGames marked this conversation as resolved.
Show resolved Hide resolved
INSERT(branch);
return branch;
}
Expand All @@ -552,6 +563,7 @@ IRInstruction *ir_branch_into_block
branch->destination_block = destination;
branch->parent_block = block;
list_push_back(block->instructions, branch);
branch->type = t_void;
LensPlaysGames marked this conversation as resolved.
Show resolved Hide resolved
return branch;
}

Expand All @@ -566,6 +578,7 @@ IRInstruction *ir_branch
IRInstruction *ir_return(CodegenContext *context, IRInstruction* return_value) {
INSTRUCTION(branch, IR_RETURN);
branch->operand = return_value;
branch->type = t_void;
LensPlaysGames marked this conversation as resolved.
Show resolved Hide resolved
INSERT(branch);
if (return_value) mark_used(return_value, branch);
return branch;
Expand All @@ -580,6 +593,7 @@ IRInstruction *ir_copy_unused
(void) context;
INSTRUCTION(copy, IR_COPY);
copy->operand = source;
copy->type = source->type;
return copy;
}

Expand All @@ -601,14 +615,17 @@ IRInstruction *ir_not
{
INSTRUCTION(x, IR_NOT);
x->operand = source;
// TODO: Is this right? Should we use source->type?
x->type = t_integer;
LensPlaysGames marked this conversation as resolved.
Show resolved Hide resolved
mark_used(source, x);
INSERT(x);
return x;
}

#define CREATE_BINARY_INSTRUCTION(enumerator, name) \
IRInstruction *ir_##name(CodegenContext *context, IRInstruction *lhs, IRInstruction *rhs) { \
INSTRUCTION(x, IR_##enumerator); \
INSTRUCTION(x, IR_##enumerator); \
x->type = t_integer; \
set_pair_and_mark(x, lhs, rhs); \
INSERT(x); \
return x; \
Expand All @@ -618,31 +635,33 @@ ALL_BINARY_INSTRUCTION_TYPES(CREATE_BINARY_INSTRUCTION)

IRInstruction *ir_create_static
(CodegenContext *context,
Type *ty,
Type *type,
span name) {
/// Create the variable.
IRStaticVariable *v = calloc(1, sizeof *v);
v->name = string_dup(name);
v->type = ty;
v->cached_size = type_sizeof(ty);
v->type = type;
v->cached_size = type_sizeof(type);
v->cached_alignment = 8; /// TODO.
vector_push(context->static_vars, v);

/// Create an instruction to reference it and return it.
INSTRUCTION(ref, IR_STATIC_REF);
ref->static_ref = v;
ref->type = v->type;
LensPlaysGames marked this conversation as resolved.
Show resolved Hide resolved
v->reference = ref;
INSERT(ref);
return ref;
}

IRInstruction *ir_stack_allocate
(CodegenContext *context,
usz size
Type *type
)
{
INSTRUCTION(alloca, IR_ALLOCA);
alloca->alloca.size = size;
alloca->alloca.size = type_sizeof(type);
alloca->type = type;
LensPlaysGames marked this conversation as resolved.
Show resolved Hide resolved
INSERT(alloca);
return alloca;
}
Expand Down
14 changes: 9 additions & 5 deletions src/codegen/intermediate_representation.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

#define INSTRUCTION(name, given_type) \
IRInstruction *(name) = calloc(1, sizeof(IRInstruction)); \
(name)->kind = (given_type)
(name)->kind = (given_type); \
(name)->type = t_void

#define FOREACH_INSTRUCTION_N(context, function, block, instruction) \
foreach_ptr (IRFunction *, function, context->functions) \
Expand Down Expand Up @@ -129,6 +130,8 @@ typedef struct IRInstruction {
enum IRType kind;
Register result;

Type *type;

/// TODO: do we really need both of these?
u32 id;
u32 index;
Expand Down Expand Up @@ -249,9 +252,9 @@ void insert_instruction_before(IRInstruction *i, IRInstruction *before);
void insert_instruction_after(IRInstruction *i, IRInstruction *after);

IRInstruction *ir_parameter(CodegenContext *context, size_t index);
void ir_add_parameter_to_function(IRFunction *);
void ir_add_parameter_to_function(IRFunction *, Type *);

IRInstruction *ir_phi(CodegenContext *context);
IRInstruction *ir_phi(CodegenContext *context, Type *type);
void ir_phi_add_argument(IRInstruction *phi, IRPhiArgument *argument);
void ir_phi_remove_argument(IRInstruction *phi, IRBlock *block);
void ir_phi_argument
Expand All @@ -271,6 +274,7 @@ IRInstruction *ir_indirect_call

IRInstruction *ir_immediate
(CodegenContext *context,
Type *type,
u64 immediate);

IRInstruction *ir_load
Expand Down Expand Up @@ -320,12 +324,12 @@ ALL_BINARY_INSTRUCTION_TYPES(DECLARE_BINARY_INSTRUCTION)
/// Create a variable with static storage duration.
IRInstruction *ir_create_static
(CodegenContext *context,
Type *ty,
Type *type,
span name);

IRInstruction *ir_stack_allocate
(CodegenContext *context,
usz size);
Type *type);

/// Check if an instruction returns a value.
bool ir_is_value(IRInstruction *instruction);
Expand Down
Loading