summaryrefslogtreecommitdiffstats
path: root/compiler/optimizing/code_generator_arm.h
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2014-04-17 14:56:23 +0100
committerNicolas Geoffray <ngeoffray@google.com>2014-04-17 15:16:00 +0100
commita747a392fb5f88d2ecc4c6021edf9f1f6615ba16 (patch)
treefc5f08b127f3cf6bfb933504070109d46a455bb9 /compiler/optimizing/code_generator_arm.h
parentc2b2bbf1bbdf6273298b79d6006611593ed9f3a0 (diff)
downloadart-a747a392fb5f88d2ecc4c6021edf9f1f6615ba16.zip
art-a747a392fb5f88d2ecc4c6021edf9f1f6615ba16.tar.gz
art-a747a392fb5f88d2ecc4c6021edf9f1f6615ba16.tar.bz2
Code cleanup in preparation for x64 backend.
- Use InvokeDexCallingConventionVisitor for setting up HParameterValues - Use kVregSize instead of kX86WordSize when dealing with virtual registers. Change-Id: Ia520223010194c70a3ff0ed659077f55cec4e7d8
Diffstat (limited to 'compiler/optimizing/code_generator_arm.h')
-rw-r--r--compiler/optimizing/code_generator_arm.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/compiler/optimizing/code_generator_arm.h b/compiler/optimizing/code_generator_arm.h
index 3fbe631..ed35f94 100644
--- a/compiler/optimizing/code_generator_arm.h
+++ b/compiler/optimizing/code_generator_arm.h
@@ -28,6 +28,37 @@ class CodeGeneratorARM;
static constexpr size_t kArmWordSize = 4;
+static constexpr Register kParameterCoreRegisters[] = { R1, R2, R3 };
+static constexpr RegisterPair kParameterCorePairRegisters[] = { R1_R2, R2_R3 };
+static constexpr size_t kParameterCoreRegistersLength = arraysize(kParameterCoreRegisters);
+
+class InvokeDexCallingConvention : public CallingConvention<Register> {
+ public:
+ InvokeDexCallingConvention()
+ : CallingConvention(kParameterCoreRegisters, kParameterCoreRegistersLength) {}
+
+ RegisterPair GetRegisterPairAt(size_t argument_index) {
+ DCHECK_LT(argument_index + 1, GetNumberOfRegisters());
+ return kParameterCorePairRegisters[argument_index];
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(InvokeDexCallingConvention);
+};
+
+class InvokeDexCallingConventionVisitor {
+ public:
+ InvokeDexCallingConventionVisitor() : gp_index_(0) {}
+
+ Location GetNextLocation(Primitive::Type type);
+
+ private:
+ InvokeDexCallingConvention calling_convention;
+ uint32_t gp_index_;
+
+ DISALLOW_COPY_AND_ASSIGN(InvokeDexCallingConventionVisitor);
+};
+
class LocationsBuilderARM : public HGraphVisitor {
public:
explicit LocationsBuilderARM(HGraph* graph, CodeGeneratorARM* codegen)
@@ -42,6 +73,7 @@ class LocationsBuilderARM : public HGraphVisitor {
private:
CodeGeneratorARM* const codegen_;
+ InvokeDexCallingConventionVisitor parameter_visitor_;
DISALLOW_COPY_AND_ASSIGN(LocationsBuilderARM);
};