Stop printing debug output from the compiler

This commit is contained in:
Konstantin Nazarov 2024-08-11 21:40:32 +01:00
parent f305901121
commit c63af0057f
Signed by: knazarov
GPG key ID: 4CFE0A42FA409C22

View file

@ -104,14 +104,11 @@ Result<Expression> Compiler::compile_primop(Context& context, Symbol& op,
Expression ex = TRY(Expression::create());
Oc opcode = Oc::Unknown;
const char* name = "";
if (TRY(op.cmp("+")) == 0) {
opcode = Oc::Add;
name = "add";
} else if (TRY(op.cmp("*")) == 0) {
opcode = Oc::Mul;
name = "mul";
} else {
return ERROR(NotImplemented);
}
@ -119,7 +116,6 @@ Result<Expression> Compiler::compile_primop(Context& context, Symbol& op,
if (cur.is<Nil>()) {
uint64_t reg = context.alloc_reg();
int64_t zero = TRY(context.add_const(TRY(Value::create((int64_t)0))));
std::cout << "mov r" << reg << ", c" << zero << "\n";
TRY(ex.add_opcode(Oc::Mov, {0, (int64_t)reg}, {1, zero}));
return ex;
@ -152,8 +148,6 @@ Result<Expression> Compiler::compile_primop(Context& context, Symbol& op,
else
res = context.alloc_reg();
std::cout << name << " r" << res << ", r" << reg << ", r" << comp.reg
<< "\n";
TRY(ex.add_opcode(opcode, {0, (int64_t)res}, {0, (int64_t)reg},
{0, (int64_t)comp.reg}));
@ -184,7 +178,6 @@ Result<Expression> Compiler::compile_int64(Context& context, Int64& value) {
int64_t c = TRY(context.add_const(TRY(value.copy())));
std::cout << "mov r" << reg << ", c" << c << "\n";
TRY(ex.add_opcode(Oc::Mov, {0, (int64_t)reg}, {1, (int64_t)c}));
ex.reg = reg;