summaryrefslogtreecommitdiffstats
path: root/compiler/optimizing/ssa_builder.cc
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2015-04-27 08:53:46 +0000
committerNicolas Geoffray <ngeoffray@google.com>2015-04-27 15:05:20 +0100
commitf213e05cef6d38166cfe0cce8f3b0a53225a1b39 (patch)
tree2fd9573056062ae085f84f1b63b8ec3298927da1 /compiler/optimizing/ssa_builder.cc
parent76bf84a196576f902a76a1165516a49dac15856f (diff)
downloadart-f213e05cef6d38166cfe0cce8f3b0a53225a1b39.zip
art-f213e05cef6d38166cfe0cce8f3b0a53225a1b39.tar.gz
art-f213e05cef6d38166cfe0cce8f3b0a53225a1b39.tar.bz2
Add support for caching float and double constants.
Change-Id: Ib5205bad1006bc5e3c9cc86bc82a6b4b1ce9bef9
Diffstat (limited to 'compiler/optimizing/ssa_builder.cc')
-rw-r--r--compiler/optimizing/ssa_builder.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/optimizing/ssa_builder.cc b/compiler/optimizing/ssa_builder.cc
index 7a252af..b66e655 100644
--- a/compiler/optimizing/ssa_builder.cc
+++ b/compiler/optimizing/ssa_builder.cc
@@ -417,6 +417,7 @@ HFloatConstant* SsaBuilder::GetFloatEquivalent(HIntConstant* constant) {
ArenaAllocator* allocator = graph->GetArena();
result = new (allocator) HFloatConstant(bit_cast<float, int32_t>(constant->GetValue()));
constant->GetBlock()->InsertInstructionBefore(result, constant->GetNext());
+ graph->CacheFloatConstant(result);
} else {
// If there is already a constant with the expected type, we know it is
// the floating point equivalent of this constant.
@@ -439,6 +440,7 @@ HDoubleConstant* SsaBuilder::GetDoubleEquivalent(HLongConstant* constant) {
ArenaAllocator* allocator = graph->GetArena();
result = new (allocator) HDoubleConstant(bit_cast<double, int64_t>(constant->GetValue()));
constant->GetBlock()->InsertInstructionBefore(result, constant->GetNext());
+ graph->CacheDoubleConstant(result);
} else {
// If there is already a constant with the expected type, we know it is
// the floating point equivalent of this constant.