From 72bceff11a98cc1ecdb64a6fae16c521f99ec6a7 Mon Sep 17 00:00:00 2001 From: Roland Levillain Date: Mon, 15 Sep 2014 18:29:00 +0100 Subject: Initiate a dead code elimination pass in the optimizing compiler. Change-Id: Ie9db5d8e2c2c30e34145a0f7d2386b8ec58cfc4e --- compiler/optimizing/nodes.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'compiler/optimizing/nodes.h') diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index eebd64bbfc..9741f717fe 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -513,6 +513,11 @@ class SideEffects : public ValueObject { return SideEffects(((1 << count) - 1) << kFlagChangesCount); } + bool HasSideEffects() const { + size_t all_bits_set = (1 << kFlagChangesCount) - 1; + return (flags_ & all_bits_set) != 0; + } + private: static constexpr int kFlagChangesSomething = 0; static constexpr int kFlagChangesCount = kFlagChangesSomething + 1; @@ -564,6 +569,7 @@ class HInstruction : public ArenaObject { virtual bool NeedsEnvironment() const { return false; } virtual bool IsControlFlow() const { return false; } + bool HasSideEffects() const { return side_effects_.HasSideEffects(); } void AddUseAt(HInstruction* user, size_t index) { uses_ = new (block_->GetGraph()->GetArena()) HUseListNode(user, index, uses_); -- cgit v1.2.3-59-g8ed1b