summaryrefslogtreecommitdiff
path: root/src/compiler/compiler_ir.h
diff options
context:
space:
mode:
author buzbee <buzbee@google.com> 2012-12-14 13:35:28 -0800
committer buzbee <buzbee@google.com> 2013-02-06 12:16:33 -0800
commit4ef3e45d7c6ec3c482a1a48f4df470811aa3cf0a (patch)
tree5d91ff23708048a2b453a5917dab82be1b545f91 /src/compiler/compiler_ir.h
parentf84f99fe3a944310fdfb6f17836079ac5c48c799 (diff)
Compiler constant handling rework
In preparation for de-optimization, reworked the constant handling mechanism. Also took advantage of knowledge of constant operands (particularly for long operations). Significant performance improvements for Mandelbrot (~60 seconds to ~34 seconds). Minor improvements in other benchmarks. The new constant handling breaks two of the existing optimization passes: "Skip Large Method" and "Load/Store Elimization." I don't intend to update the large method optimization because it will be superceeded by the upcoming interpreter/ fingerprinting mechanism. Leaving the code in place for now in order to compare compile-time improvements with fingerprinting/interpret. All related code will be deleted when that is complete. The load/store elimination pass needs some rework to handle uses of multiple-register loads and stores. It will be updated & restored in a future CL. Change-Id: Ia979abaf51b8ae81bbb0428031cbcea854625fac
Diffstat (limited to 'src/compiler/compiler_ir.h')
-rw-r--r--src/compiler/compiler_ir.h34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/compiler/compiler_ir.h b/src/compiler/compiler_ir.h
index aca32d5585..056c308c79 100644
--- a/src/compiler/compiler_ir.h
+++ b/src/compiler/compiler_ir.h
@@ -230,7 +230,8 @@ struct BasicBlock {
bool catch_entry;
bool explicit_throw;
bool conditional_branch;
- bool has_return;
+ bool has_return; // Contains a return.
+ bool dominates_return; // Is a member of return extended basic block
uint16_t start_offset;
uint16_t nesting_depth;
BBType block_type;
@@ -306,6 +307,7 @@ struct CompilationUnit {
vreg_to_ssa_map(NULL),
ssa_last_defs(NULL),
is_constant_v(NULL),
+ must_flush_constant_v(NULL),
constant_values(NULL),
reg_location(NULL),
promotion_map(NULL),
@@ -418,6 +420,7 @@ struct CompilationUnit {
int* vreg_to_ssa_map; // length == method->registers_size
int* ssa_last_defs; // length == method->registers_size
ArenaBitVector* is_constant_v; // length == num_ssa_reg
+ ArenaBitVector* must_flush_constant_v; // length == num_ssa_reg
int* constant_values; // length == num_ssa_reg
// Use counts of ssa names.
@@ -579,6 +582,35 @@ static const CodePattern special_patterns[] = {
{{Instruction::RETURN_WIDE}, kIdentity},
};
+static inline bool IsConst(const CompilationUnit* cu, int32_t s_reg)
+{
+ return (IsBitSet(cu->is_constant_v, s_reg));
+}
+
+static inline bool IsConst(const CompilationUnit* cu, RegLocation loc)
+{
+ return (IsConst(cu, loc.orig_sreg));
+}
+
+static inline int32_t ConstantValue(const CompilationUnit* cu, RegLocation loc)
+{
+ DCHECK(IsConst(cu, loc));
+ return cu->constant_values[loc.orig_sreg];
+}
+
+static inline int64_t ConstantValueWide(const CompilationUnit* cu, RegLocation loc)
+{
+ DCHECK(IsConst(cu, loc));
+ return (static_cast<int64_t>(cu->constant_values[loc.orig_sreg + 1]) << 32) |
+ Low32Bits(static_cast<int64_t>(cu->constant_values[loc.orig_sreg]));
+}
+
+static inline bool MustFlushConstant(const CompilationUnit* cu, RegLocation loc)
+{
+ DCHECK(IsConst(cu, loc));
+ return IsBitSet(cu->must_flush_constant_v, loc.orig_sreg);
+}
+
} // namespace art
#endif // ART_SRC_COMPILER_COMPILER_IR_H_