24 lines
710 B
C
24 lines
710 B
C
#include <mie/ir/register.h>
|
|
#include <mie/print/printer.h>
|
|
|
|
void mie_printer_print_register(
|
|
struct mie_printer *printer, const struct mie_register *reg,
|
|
enum mie_print_flags flags)
|
|
{
|
|
if (reg->reg_flags & MIE_REGISTER_F_VIRTUAL) {
|
|
b_stream_write_fmt(
|
|
printer->p_stream, NULL, "%%%s", reg->reg_name.n_str);
|
|
} else if (reg->reg_flags & MIE_REGISTER_F_MACHINE) {
|
|
// TODO this shouldnt use reg_name
|
|
b_stream_write_fmt(
|
|
printer->p_stream, NULL, "$%s", reg->reg_name.n_str);
|
|
} else {
|
|
b_stream_write_string(printer->p_stream, "?REG", NULL);
|
|
}
|
|
|
|
if (flags & MIE_PRINT_F_INCLUDE_TYPE) {
|
|
b_stream_write_string(printer->p_stream, ": ", NULL);
|
|
mie_printer_print_type(printer, reg->reg_type);
|
|
}
|
|
}
|