summaryrefslogtreecommitdiffstats
path: root/compiler/optimizing/ssa_builder.cc
diff options
context:
space:
mode:
authorDavid Brazdil <dbrazdil@google.com>2015-03-24 10:51:52 +0000
committerDavid Brazdil <dbrazdil@google.com>2015-03-26 14:10:03 +0000
commit8d5b8b295930aaa43255c4f0b74ece3ee8b43a47 (patch)
treec26fc49bbc74615e7f0b9657aaf3757a8282d7a9 /compiler/optimizing/ssa_builder.cc
parentc8924c6ea9e83ba3832dd5551df38ab06f4aaca9 (diff)
downloadart-8d5b8b295930aaa43255c4f0b74ece3ee8b43a47.zip
art-8d5b8b295930aaa43255c4f0b74ece3ee8b43a47.tar.gz
art-8d5b8b295930aaa43255c4f0b74ece3ee8b43a47.tar.bz2
ART: Force constants into the entry block
Optimizations such as GVN and BCE make the assumption that all constants are located in the entry block of the CFG, but not all passes adhere to this rule. This patch makes constructors of constants private and only accessible to friend classes - HGraph for int/long constants and SsaBuilder for float/double - which ensure that they are placed correctly and not duplicated. Note that the ArenaAllocatorAdapter was modified to not increment the ArenaAllocator's internal reference counter in order to allow for use of ArenaSafeMap inside an arena-allocated objects. Because their destructor is not called, the counter does not get decremented. Change-Id: I36a4fa29ae34fb905cdefd482ccbf386cff14166
Diffstat (limited to 'compiler/optimizing/ssa_builder.cc')
-rw-r--r--compiler/optimizing/ssa_builder.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/optimizing/ssa_builder.cc b/compiler/optimizing/ssa_builder.cc
index ae6bf16..fcc4e69 100644
--- a/compiler/optimizing/ssa_builder.cc
+++ b/compiler/optimizing/ssa_builder.cc
@@ -353,7 +353,7 @@ void SsaBuilder::VisitBasicBlock(HBasicBlock* block) {
* is used for floating point operations. We create a floating-point equivalent
* constant to make the operations correctly typed.
*/
-static HFloatConstant* GetFloatEquivalent(HIntConstant* constant) {
+HFloatConstant* SsaBuilder::GetFloatEquivalent(HIntConstant* constant) {
// We place the floating point constant next to this constant.
HFloatConstant* result = constant->GetNext()->AsFloatConstant();
if (result == nullptr) {
@@ -375,7 +375,7 @@ static HFloatConstant* GetFloatEquivalent(HIntConstant* constant) {
* is used for floating point operations. We create a floating-point equivalent
* constant to make the operations correctly typed.
*/
-static HDoubleConstant* GetDoubleEquivalent(HLongConstant* constant) {
+HDoubleConstant* SsaBuilder::GetDoubleEquivalent(HLongConstant* constant) {
// We place the floating point constant next to this constant.
HDoubleConstant* result = constant->GetNext()->AsDoubleConstant();
if (result == nullptr) {
@@ -398,7 +398,7 @@ static HDoubleConstant* GetDoubleEquivalent(HLongConstant* constant) {
* floating point registers and core registers), we need to create a copy of the
* phi with a floating point / reference type.
*/
-static HPhi* GetFloatDoubleOrReferenceEquivalentOfPhi(HPhi* phi, Primitive::Type type) {
+HPhi* SsaBuilder::GetFloatDoubleOrReferenceEquivalentOfPhi(HPhi* phi, Primitive::Type type) {
// We place the floating point /reference phi next to this phi.
HInstruction* next = phi->GetNext();
if (next != nullptr