More aggressive constant propagation pass.

This commit is contained in:
Ben Vanik
2013-12-15 14:40:18 -08:00
parent 769b8d59d9
commit f2348301ea
3 changed files with 118 additions and 1 deletions

View File

@@ -48,7 +48,10 @@ void Instr::set_src3(Value* value) {
src3_use = value ? value->AddUse(block->arena, this) : NULL;
}
void Instr::Remove() {
void Instr::Replace(const OpcodeInfo* opcode, uint16_t flags) {
this->opcode = opcode;
this->flags = flags;
if (dest) {
dest->def = NULL;
}
@@ -64,6 +67,11 @@ void Instr::Remove() {
src3.value->RemoveUse(src3_use);
src3_use = NULL;
}
}
void Instr::Remove() {
// Remove all srcs/dest.
Replace(&OPCODE_NOP_info, 0);
if (prev) {
prev->next = next;

View File

@@ -54,6 +54,7 @@ public:
void set_src2(Value* value);
void set_src3(Value* value);
void Replace(const OpcodeInfo* opcode, uint16_t flags);
void Remove();
};