Factor out arch-independent ScaleFactor definition.
Bug: 65872996
Test: m test-art-host-gtest
Test: art/test.py --host -r --optimizing
Change-Id: I27763286847b45a5a3a493c3dba48418575b3eb6
diff --git a/compiler/optimizing/code_generator_x86_64.cc b/compiler/optimizing/code_generator_x86_64.cc
index f543dd4..8076221 100644
--- a/compiler/optimizing/code_generator_x86_64.cc
+++ b/compiler/optimizing/code_generator_x86_64.cc
@@ -5348,30 +5348,6 @@
}
}
-static ScaleFactor ScaleFactorForType(DataType::Type type) {
- switch (type) {
- case DataType::Type::kBool:
- case DataType::Type::kUint8:
- case DataType::Type::kInt8:
- return TIMES_1;
- case DataType::Type::kUint16:
- case DataType::Type::kInt16:
- return TIMES_2;
- case DataType::Type::kInt32:
- case DataType::Type::kUint32:
- case DataType::Type::kFloat32:
- case DataType::Type::kReference:
- return TIMES_4;
- case DataType::Type::kInt64:
- case DataType::Type::kUint64:
- case DataType::Type::kFloat64:
- return TIMES_8;
- case DataType::Type::kVoid:
- LOG(FATAL) << "Unreachable type " << type;
- UNREACHABLE();
- }
-}
-
void InstructionCodeGeneratorX86_64::VisitArrayGet(HArrayGet* instruction) {
LocationSummary* locations = instruction->GetLocations();
Location obj_loc = locations->InAt(0);
@@ -5427,7 +5403,7 @@
__ movzxw(out, CodeGeneratorX86_64::ArrayAddress(obj, index, TIMES_2, data_offset));
__ Bind(&done);
} else {
- ScaleFactor scale = ScaleFactorForType(type);
+ ScaleFactor scale = CodeGenerator::ScaleFactorForType(type);
Address src = CodeGeneratorX86_64::ArrayAddress(obj, index, scale, data_offset);
codegen_->LoadFromMemoryNoReference(type, out_loc, src);
}