summaryrefslogtreecommitdiff
path: root/compiler/optimizing/code_generator.cc
diff options
context:
space:
mode:
author Ulya Trafimovich <skvadrik@google.com> 2021-06-02 17:35:16 +0100
committer Ulya Trafimovich <skvadrik@google.com> 2021-06-03 14:00:34 +0100
commitc8451cb4302e028d4e106c1a2a44749d5cb9bb31 (patch)
treec59b852b27ef441c5a09c4755e33628315d2e678 /compiler/optimizing/code_generator.cc
parent322eced250f893a85dce0f78c74ef91eba5fdb1a (diff)
Factor out arch-independent ScaleFactor definition.
Bug: 65872996 Test: m test-art-host-gtest Test: art/test.py --host -r --optimizing Change-Id: I27763286847b45a5a3a493c3dba48418575b3eb6
Diffstat (limited to 'compiler/optimizing/code_generator.cc')
-rw-r--r--compiler/optimizing/code_generator.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/compiler/optimizing/code_generator.cc b/compiler/optimizing/code_generator.cc
index 886cabbe0a..a096338ee2 100644
--- a/compiler/optimizing/code_generator.cc
+++ b/compiler/optimizing/code_generator.cc
@@ -1830,4 +1830,28 @@ QuickEntrypointEnum CodeGenerator::GetArrayAllocationEntrypoint(HNewArray* new_a
UNREACHABLE();
}
+ScaleFactor CodeGenerator::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();
+ }
+}
+
} // namespace art