summaryrefslogtreecommitdiffstats
path: root/compiler/optimizing/nodes.h
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2015-03-09 10:02:49 +0000
committerNicolas Geoffray <ngeoffray@google.com>2015-03-10 16:20:35 +0000
commite0fe7ae36180863e45cbb9d1e6e9c30b1b1a949c (patch)
tree26269a55f16d8bee5b5898318fa18491fd72061c /compiler/optimizing/nodes.h
parent3dd536ffd7e8f82e4587964545b272acbd61d68e (diff)
downloadart-e0fe7ae36180863e45cbb9d1e6e9c30b1b1a949c.zip
art-e0fe7ae36180863e45cbb9d1e6e9c30b1b1a949c.tar.gz
art-e0fe7ae36180863e45cbb9d1e6e9c30b1b1a949c.tar.bz2
Make the SSA builder honor the debuggable flag.
This requires to properly type phis that are only used by environments, and discard phis with incomptable types. The code generators do not handle these conflicting types. In the process, ensure a phi has a type that does not depend on the order of the inputs (for example (char, short) -> short), and set int for int-like types. We can refine this later. Change-Id: I60ab601d6d00b1cbf18623ee4ff1795aa28f84a1
Diffstat (limited to 'compiler/optimizing/nodes.h')
-rw-r--r--compiler/optimizing/nodes.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h
index 8b56166..942aa23 100644
--- a/compiler/optimizing/nodes.h
+++ b/compiler/optimizing/nodes.h
@@ -103,7 +103,7 @@ class HInstructionList {
// Control-flow graph of a method. Contains a list of basic blocks.
class HGraph : public ArenaObject<kArenaAllocMisc> {
public:
- HGraph(ArenaAllocator* arena, int start_instruction_id = 0)
+ HGraph(ArenaAllocator* arena, bool debuggable = false, int start_instruction_id = 0)
: arena_(arena),
blocks_(arena, kDefaultNumberOfBlocks),
reverse_post_order_(arena, kDefaultNumberOfBlocks),
@@ -114,6 +114,7 @@ class HGraph : public ArenaObject<kArenaAllocMisc> {
number_of_in_vregs_(0),
temporaries_vreg_slots_(0),
has_array_accesses_(false),
+ debuggable_(debuggable),
current_instruction_id_(start_instruction_id) {}
ArenaAllocator* GetArena() const { return arena_; }
@@ -208,6 +209,8 @@ class HGraph : public ArenaObject<kArenaAllocMisc> {
has_array_accesses_ = value;
}
+ bool IsDebuggable() const { return debuggable_; }
+
HNullConstant* GetNullConstant();
private:
@@ -248,6 +251,11 @@ class HGraph : public ArenaObject<kArenaAllocMisc> {
// Has array accesses. We can totally skip BCE if it's false.
bool has_array_accesses_;
+ // Indicates whether the graph should be compiled in a way that
+ // ensures full debuggability. If false, we can apply more
+ // aggressive optimizations that may limit the level of debugging.
+ const bool debuggable_;
+
// The current id to assign to a newly added instruction. See HInstruction.id_.
int32_t current_instruction_id_;
@@ -2498,6 +2506,19 @@ class HPhi : public HInstruction {
inputs_.SetSize(number_of_inputs);
}
+ // Returns a type equivalent to the given `type`, but that a `HPhi` can hold.
+ static Primitive::Type ToPhiType(Primitive::Type type) {
+ switch (type) {
+ case Primitive::kPrimBoolean:
+ case Primitive::kPrimByte:
+ case Primitive::kPrimShort:
+ case Primitive::kPrimChar:
+ return Primitive::kPrimInt;
+ default:
+ return type;
+ }
+ }
+
size_t InputCount() const OVERRIDE { return inputs_.Size(); }
void AddInput(HInstruction* input);