Index: src/compiler/instruction.h |
diff --git a/src/compiler/instruction.h b/src/compiler/instruction.h |
index 1740dfbf25b970054417d75c533ba95e8ea65366..522659c9e617604468cff7e873599a26251ec95a 100644 |
--- a/src/compiler/instruction.h |
+++ b/src/compiler/instruction.h |
@@ -441,6 +441,10 @@ class Instruction : public ZoneObject { |
DCHECK(i < InputCount()); |
return operands_[OutputCount() + i]; |
} |
+ void SetInputAt(size_t i, InstructionOperand* operand) { |
+ DCHECK(i < InputCount()); |
+ operands_[OutputCount() + i] = operand; |
+ } |
size_t TempCount() const { return TempCountField::decode(bit_field_); } |
InstructionOperand* TempAt(size_t i) const { |
@@ -520,6 +524,17 @@ class Instruction : public ZoneObject { |
void operator delete(void* pointer, void* location) { UNREACHABLE(); } |
+ void OverwriteWithNop() { |
+ opcode_ = ArchOpcodeField::encode(kArchNop); |
+ bit_field_ = 0; |
+ pointer_map_ = NULL; |
+ } |
+ |
+ bool IsNop() const { |
+ return arch_opcode() == kArchNop && InputCount() == 0 && |
+ OutputCount() == 0 && TempCount() == 0; |
+ } |
+ |
protected: |
explicit Instruction(InstructionCode opcode) |
: opcode_(opcode), |
@@ -599,6 +614,8 @@ class GapInstruction : public Instruction { |
return parallel_moves_[pos]; |
} |
+ bool IsRedundant() const; |
+ |
static GapInstruction* New(Zone* zone) { |
void* buffer = zone->New(sizeof(GapInstruction)); |
return new (buffer) GapInstruction(kGapInstruction); |
@@ -885,12 +902,16 @@ class InstructionBlock FINAL : public ZoneObject { |
const PhiInstructions& phis() const { return phis_; } |
void AddPhi(PhiInstruction* phi) { phis_.push_back(phi); } |
+ void set_ao_number(BasicBlock::RpoNumber ao_number) { |
+ ao_number_ = ao_number; |
+ } |
+ |
private: |
Successors successors_; |
Predecessors predecessors_; |
PhiInstructions phis_; |
const BasicBlock::Id id_; |
- const BasicBlock::RpoNumber ao_number_; // Assembly order number. |
+ BasicBlock::RpoNumber ao_number_; // Assembly order number. |
// TODO(dcarney): probably dont't need this. |
const BasicBlock::RpoNumber rpo_number_; |
const BasicBlock::RpoNumber loop_header_; |
@@ -1024,6 +1045,15 @@ class InstructionSequence FINAL : public ZoneObject { |
FrameStateDescriptor* GetFrameStateDescriptor(StateId deoptimization_id); |
int GetFrameStateDescriptorCount(); |
+ BasicBlock::RpoNumber InputRpo(Instruction* instr, size_t index) { |
+ InstructionOperand* operand = instr->InputAt(index); |
+ Constant constant = operand->IsImmediate() ? GetImmediate(operand->index()) |
+ : GetConstant(operand->index()); |
+ int rpo = constant.ToInt32(); |
+ DCHECK(rpo >= 0 && rpo < static_cast<int>(instruction_blocks_->size())); |
+ return BasicBlock::RpoNumber::FromInt(rpo); |
+ } |
+ |
private: |
friend std::ostream& operator<<(std::ostream& os, |
const PrintableInstructionSequence& code); |