Skip to content

Commit

Permalink
CI work.
Browse files Browse the repository at this point in the history
  • Loading branch information
Goubermouche committed Feb 1, 2024
1 parent 80f3703 commit ab7e2e4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
11 changes: 3 additions & 8 deletions source/compiler/test/main.s
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,15 @@
// - cleanup ir gen alignment sizes (u64 vs u32 vs u16)
// - set crashes with more than 4(?) parameters
// - implicit returns for non-void functions should be a thing

i32 main() {
bool a = true;
// printf("%d\n", a);
printf("%d\n", !a);

// bool b = 100;
// printf("%d\n", b);
// printf("%d\n", !b);
printf("lit: %d\n", 100 > 200);

ret 0;
ret 0;
}



// THIS CRASHES
// i32 main() {
// i32* memory = cast<i32*>(malloc(100));
Expand Down
16 changes: 8 additions & 8 deletions source/intermediate_representation/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace sigma::ir {
// specify individual optimization passes
const optimization_pass_list optimizations({});
const auto register_allocator = std::make_shared<linear_scan_allocator>();
//utility::string assembly;
utility::string assembly;

// go through all declared functions and run codegen
for (const handle<function> function : m_functions) {
Expand Down Expand Up @@ -69,14 +69,14 @@ namespace sigma::ir {
// generate a bytecode representation of the given function for the specified target
const utility::byte_buffer bytecode = m_codegen.emit_bytecode(codegen);

// for(const auto b : bytecode) {
// std::cout << b.to_hex() << ' ';
// }
//
// std::cout << '\n';
for(const auto b : bytecode) {
std::cout << b.to_hex() << ' ';
}

std::cout << '\n';

// DEBUG
//assembly.append(m_codegen.disassemble(bytecode, codegen));
assembly.append(m_codegen.disassemble(bytecode, codegen));

// finally, emit the compiled function
function->output = {
Expand All @@ -91,7 +91,7 @@ namespace sigma::ir {
}

// DEBUG
//utility::console::print("{}\n", assembly.get_underlying());
utility::console::print("{}\n", assembly.get_underlying());
}

auto module::generate_object_file() -> utility::byte_buffer {
Expand Down

0 comments on commit ab7e2e4

Please sign in to comment.