diff options
Diffstat (limited to 'compiler/optimizing/nodes.h')
-rw-r--r-- | compiler/optimizing/nodes.h | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index bb699e47c3..ea0cacc4ea 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -554,6 +554,10 @@ class HInstruction : public ArenaObject { HEnvironment* GetEnvironment() const { return environment_; } void SetEnvironment(HEnvironment* environment) { environment_ = environment; } + // Returns the number of entries in the environment. Typically, that is the + // number of dex registers in a method. It could be more in case of inlining. + size_t EnvironmentSize() const; + LocationSummary* GetLocations() const { return locations_; } void SetLocations(LocationSummary* locations) { locations_ = locations; } @@ -583,7 +587,7 @@ class HInstruction : public ArenaObject { // An instruction gets an id when it is added to the graph. // It reflects creation order. A negative id means the instruction - // has not beed added to the graph. + // has not been added to the graph. int id_; // When doing liveness analysis, instructions that have uses get an SSA index. @@ -595,6 +599,8 @@ class HInstruction : public ArenaObject { // List of environments that contain this instruction. HUseListNode<HEnvironment>* env_uses_; + // The environment associated with this instruction. Not null if the instruction + // might jump out of the method. HEnvironment* environment_; // Set by the code generator. @@ -660,10 +666,16 @@ class HEnvironment : public ArenaObject { vregs_.Put(index, instruction); } + HInstruction* GetInstructionAt(size_t index) const { + return vregs_.Get(index); + } + GrowableArray<HInstruction*>* GetVRegs() { return &vregs_; } + size_t Size() const { return vregs_.Size(); } + private: GrowableArray<HInstruction*> vregs_; @@ -1324,13 +1336,15 @@ class HNullCheck : public HExpression<1> { class FieldInfo : public ValueObject { public: - explicit FieldInfo(MemberOffset field_offset) - : field_offset_(field_offset) {} + explicit FieldInfo(MemberOffset field_offset, Primitive::Type field_type) + : field_offset_(field_offset), field_type_(field_type) {} MemberOffset GetFieldOffset() const { return field_offset_; } + Primitive::Type GetFieldType() const { return field_type_; } private: const MemberOffset field_offset_; + const Primitive::Type field_type_; }; class HInstanceFieldGet : public HExpression<1> { @@ -1338,11 +1352,12 @@ class HInstanceFieldGet : public HExpression<1> { HInstanceFieldGet(HInstruction* value, Primitive::Type field_type, MemberOffset field_offset) - : HExpression(field_type), field_info_(field_offset) { + : HExpression(field_type), field_info_(field_offset, field_type) { SetRawInputAt(0, value); } MemberOffset GetFieldOffset() const { return field_info_.GetFieldOffset(); } + Primitive::Type GetFieldType() const { return field_info_.GetFieldType(); } DECLARE_INSTRUCTION(InstanceFieldGet); @@ -1356,13 +1371,15 @@ class HInstanceFieldSet : public HTemplateInstruction<2> { public: HInstanceFieldSet(HInstruction* object, HInstruction* value, + Primitive::Type field_type, MemberOffset field_offset) - : field_info_(field_offset) { + : field_info_(field_offset, field_type) { SetRawInputAt(0, object); SetRawInputAt(1, value); } MemberOffset GetFieldOffset() const { return field_info_.GetFieldOffset(); } + Primitive::Type GetFieldType() const { return field_info_.GetFieldType(); } DECLARE_INSTRUCTION(InstanceFieldSet); @@ -1391,7 +1408,8 @@ class HArraySet : public HTemplateInstruction<3> { HArraySet(HInstruction* array, HInstruction* index, HInstruction* value, - uint32_t dex_pc) : dex_pc_(dex_pc) { + Primitive::Type component_type, + uint32_t dex_pc) : dex_pc_(dex_pc), component_type_(component_type) { SetRawInputAt(0, array); SetRawInputAt(1, index); SetRawInputAt(2, value); @@ -1405,10 +1423,13 @@ class HArraySet : public HTemplateInstruction<3> { uint32_t GetDexPc() const { return dex_pc_; } + Primitive::Type GetComponentType() const { return component_type_; } + DECLARE_INSTRUCTION(ArraySet); private: const uint32_t dex_pc_; + const Primitive::Type component_type_; DISALLOW_COPY_AND_ASSIGN(HArraySet); }; |