summaryrefslogtreecommitdiff
path: root/compiler/optimizing/pretty_printer.h
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2016-05-17 16:30:10 +0100
committer Vladimir Marko <vmarko@google.com> 2016-06-02 19:04:20 +0100
commit372f10e5b0b34e2bb6e2b79aeba6c441e14afd1f (patch)
tree1f29c2467c8909ef0e0147f37f176caa1bcd2ccc /compiler/optimizing/pretty_printer.h
parent1b66fdf3f33c72dfdda4d31f6f17b6a0d8607402 (diff)
Refactor handling of input records.
Introduce HInstruction::GetInputRecords(), a new virtual function that returns an ArrayRef<> to all input records. Implement all other functions dealing with input records as wrappers around GetInputRecords(). Rewrite functions that previously used multiple virtual calls to deal with input records, especially in loops, to prefetch the ArrayRef<> only once for each instruction. Besides avoiding all the extra calls, this also allows the compiler (clang++) to perform additional optimizations. This speeds up the Nexus 5 boot image compilation by ~0.5s (4% of "Compile Dex File", 2% of dex2oat time) on AOSP ToT. Change-Id: Id8ebe0fb9405e38d918972a11bd724146e4ca578
Diffstat (limited to 'compiler/optimizing/pretty_printer.h')
-rw-r--r--compiler/optimizing/pretty_printer.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/optimizing/pretty_printer.h b/compiler/optimizing/pretty_printer.h
index ee32518c01..f9bef6809f 100644
--- a/compiler/optimizing/pretty_printer.h
+++ b/compiler/optimizing/pretty_printer.h
@@ -39,16 +39,17 @@ class HPrettyPrinter : public HGraphVisitor {
}
void PrintPostInstruction(HInstruction* instruction) {
- if (instruction->InputCount() != 0) {
+ auto&& inputs = instruction->GetInputs();
+ if (!inputs.empty()) {
PrintString("(");
bool first = true;
- for (HInputIterator it(instruction); !it.Done(); it.Advance()) {
+ for (const HInstruction* input : inputs) {
if (first) {
first = false;
} else {
PrintString(", ");
}
- PrintInt(it.Current()->GetId());
+ PrintInt(input->GetId());
}
PrintString(")");
}