summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2015-03-12 11:06:25 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-03-12 11:06:26 +0000
commitbf5565a75876a84c8c2401df597d922a7870a8f2 (patch)
tree3cb359f31e1f3080fb7cfffd5a6fd417f61753d7
parent28b87a628403c0dc10006c84b6fa009b082c5d84 (diff)
parent3ce57abd8fe50a0a772d14e033a9e7c34beff6cb (diff)
downloadart-bf5565a75876a84c8c2401df597d922a7870a8f2.zip
art-bf5565a75876a84c8c2401df597d922a7870a8f2.tar.gz
art-bf5565a75876a84c8c2401df597d922a7870a8f2.tar.bz2
Merge "Revert "Opt Compiler: Materialise constants that cannot be encoded""
-rw-r--r--compiler/optimizing/code_generator_arm64.cc9
-rw-r--r--compiler/optimizing/common_arm64.h35
2 files changed, 4 insertions, 40 deletions
diff --git a/compiler/optimizing/code_generator_arm64.cc b/compiler/optimizing/code_generator_arm64.cc
index 6b4c2f0..c21084a 100644
--- a/compiler/optimizing/code_generator_arm64.cc
+++ b/compiler/optimizing/code_generator_arm64.cc
@@ -63,7 +63,6 @@ using helpers::StackOperandFrom;
using helpers::VIXLRegCodeFromART;
using helpers::WRegisterFrom;
using helpers::XRegisterFrom;
-using helpers::ARM64EncodableConstantOrRegister;
static constexpr size_t kHeapRefSize = sizeof(mirror::HeapReference<mirror::Object>);
static constexpr int kCurrentMethodStackOffset = 0;
@@ -1105,7 +1104,7 @@ void LocationsBuilderARM64::HandleBinaryOp(HBinaryOperation* instr) {
case Primitive::kPrimInt:
case Primitive::kPrimLong:
locations->SetInAt(0, Location::RequiresRegister());
- locations->SetInAt(1, ARM64EncodableConstantOrRegister(instr->InputAt(1), instr));
+ locations->SetInAt(1, Location::RegisterOrConstant(instr->InputAt(1)));
locations->SetOut(Location::RequiresRegister(), Location::kNoOutputOverlap);
break;
@@ -1396,7 +1395,7 @@ void LocationsBuilderARM64::VisitCompare(HCompare* compare) {
switch (in_type) {
case Primitive::kPrimLong: {
locations->SetInAt(0, Location::RequiresRegister());
- locations->SetInAt(1, ARM64EncodableConstantOrRegister(compare->InputAt(1), compare));
+ locations->SetInAt(1, Location::RegisterOrConstant(compare->InputAt(1)));
locations->SetOut(Location::RequiresRegister(), Location::kNoOutputOverlap);
break;
}
@@ -1466,7 +1465,7 @@ void InstructionCodeGeneratorARM64::VisitCompare(HCompare* compare) {
void LocationsBuilderARM64::VisitCondition(HCondition* instruction) {
LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(instruction);
locations->SetInAt(0, Location::RequiresRegister());
- locations->SetInAt(1, ARM64EncodableConstantOrRegister(instruction->InputAt(1), instruction));
+ locations->SetInAt(1, Location::RegisterOrConstant(instruction->InputAt(1)));
if (instruction->NeedsMaterialization()) {
locations->SetOut(Location::RequiresRegister(), Location::kNoOutputOverlap);
}
@@ -2117,7 +2116,7 @@ void LocationsBuilderARM64::VisitNeg(HNeg* neg) {
switch (neg->GetResultType()) {
case Primitive::kPrimInt:
case Primitive::kPrimLong:
- locations->SetInAt(0, ARM64EncodableConstantOrRegister(neg->InputAt(0), neg));
+ locations->SetInAt(0, Location::RegisterOrConstant(neg->InputAt(0)));
locations->SetOut(Location::RequiresRegister(), Location::kNoOutputOverlap);
break;
diff --git a/compiler/optimizing/common_arm64.h b/compiler/optimizing/common_arm64.h
index 056deb9..9447d3b 100644
--- a/compiler/optimizing/common_arm64.h
+++ b/compiler/optimizing/common_arm64.h
@@ -183,41 +183,6 @@ static inline vixl::Operand OperandFromMemOperand(const vixl::MemOperand& mem_op
}
}
-static bool CanEncodeConstantAsImmediate(HConstant* constant, HInstruction* instr) {
- DCHECK(constant->IsIntConstant() || constant->IsLongConstant());
-
- // For single uses we let VIXL handle the constant generation since it will
- // use registers that are not managed by the register allocator (wip0, wip1).
- if (constant->GetUses().HasOnlyOneUse()) {
- return true;
- }
-
- int64_t value = constant->IsIntConstant() ? constant->AsIntConstant()->GetValue()
- : constant->AsLongConstant()->GetValue();
-
- if (instr->IsAdd() || instr->IsSub() || instr->IsCondition() || instr->IsCompare()) {
- // Uses aliases of ADD/SUB instructions.
- return vixl::Assembler::IsImmAddSub(value);
- } else if (instr->IsAnd() || instr->IsOr() || instr->IsXor()) {
- // Uses logical operations.
- return vixl::Assembler::IsImmLogical(value, vixl::kXRegSize);
- } else {
- DCHECK(instr->IsNeg());
- // Uses mov -immediate.
- return vixl::Assembler::IsImmMovn(value, vixl::kXRegSize);
- }
-}
-
-static inline Location ARM64EncodableConstantOrRegister(HInstruction* constant,
- HInstruction* instr) {
- if (constant->IsConstant()
- && CanEncodeConstantAsImmediate(constant->AsConstant(), instr)) {
- return Location::ConstantLocation(constant->AsConstant());
- }
-
- return Location::RequiresRegister();
-}
-
} // namespace helpers
} // namespace arm64
} // namespace art