X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=blobdiff_plain;f=ir.h;fp=ir.h;h=1820317a52ba408f5ffb5ab93be0e470908eda41;hp=44ceccfcc25acacb1bf2c461b6dc3b5a699298ba;hb=566e7615466c776fc296b67894621a85691cd42b;hpb=f09c6a5d63faaad1b915868c461b658efd374a34 diff --git a/ir.h b/ir.h index 44ceccf..1820317 100644 --- a/ir.h +++ b/ir.h @@ -108,19 +108,25 @@ struct ir_phi_entry_t { /* instruction */ struct ir_instr { + void* operator new(std::size_t); + void operator delete(void*); + + ir_instr(lex_ctx_t, ir_block *owner, int opcode); + ~ir_instr(); + int opcode; lex_ctx_t context; - ir_value *(_ops[3]); - ir_block *(bops[2]); + ir_value *(_ops[3]) = { nullptr, nullptr, nullptr }; + ir_block *(bops[2]) = { nullptr, nullptr }; std::vector phi; std::vector params; // For the temp-allocation - size_t eid; + size_t eid = 0; // For IFs - bool likely; + bool likely = true; ir_block *owner; }; @@ -262,8 +268,9 @@ struct ir_builder { ht htglobals; ht htfields; - std::vector> extparams; + // extparams' ir_values reference the ones from extparam_protos std::vector> extparam_protos; + std::vector extparams; // the highest func->allocated_locals size_t max_locals = 0; @@ -288,7 +295,7 @@ struct ir_builder { ir_value *vinstr_temp[IR_MAX_VINSTR_TEMPS]; /* code generator */ - code_t *code; + std::unique_ptr code; }; ir_function* ir_builder_create_function(ir_builder*, const std::string& name, qc_type outtype);