summaryrefslogtreecommitdiffstats
path: root/compiler/optimizing/code_generator_x86.h
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2014-03-11 17:53:17 +0000
committerNicolas Geoffray <ngeoffray@google.com>2014-03-13 09:23:12 +0000
commitbab4ed7057799a4fadc6283108ab56f389d117d4 (patch)
treeea1bf495458fd9f7a3ffbed0ea4e1dda5a0b8184 /compiler/optimizing/code_generator_x86.h
parent37d4c1db4d705f5a28001f65afdd68d0527948d8 (diff)
downloadart-bab4ed7057799a4fadc6283108ab56f389d117d4.tar.gz
art-bab4ed7057799a4fadc6283108ab56f389d117d4.tar.bz2
art-bab4ed7057799a4fadc6283108ab56f389d117d4.zip
More code generation for the optimizing compiler.
- Add HReturn instruction - Generate code for locals/if/return - Setup infrastructure for register allocation. Currently emulate a stack. Change-Id: Ib28c2dba80f6c526177ed9a7b09c0689ac8122fb
Diffstat (limited to 'compiler/optimizing/code_generator_x86.h')
-rw-r--r--compiler/optimizing/code_generator_x86.h33
1 files changed, 28 insertions, 5 deletions
diff --git a/compiler/optimizing/code_generator_x86.h b/compiler/optimizing/code_generator_x86.h
index 7dae2ab0e5..dd146b8378 100644
--- a/compiler/optimizing/code_generator_x86.h
+++ b/compiler/optimizing/code_generator_x86.h
@@ -27,12 +27,26 @@ class Label;
namespace x86 {
+class LocationsBuilderX86 : public HGraphVisitor {
+ public:
+ explicit LocationsBuilderX86(HGraph* graph) : HGraphVisitor(graph) { }
+
+#define DECLARE_VISIT_INSTRUCTION(name) \
+ virtual void Visit##name(H##name* instr);
+
+ FOR_EACH_INSTRUCTION(DECLARE_VISIT_INSTRUCTION)
+
+#undef DECLARE_VISIT_INSTRUCTION
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(LocationsBuilderX86);
+};
+
class CodeGeneratorX86 : public CodeGenerator {
public:
CodeGeneratorX86(Assembler* assembler, HGraph* graph)
- : CodeGenerator(assembler, graph) { }
+ : CodeGenerator(assembler, graph), location_builder_(graph) { }
- // Visit functions for instruction classes.
#define DECLARE_VISIT_INSTRUCTION(name) \
virtual void Visit##name(H##name* instr);
@@ -40,10 +54,19 @@ class CodeGeneratorX86 : public CodeGenerator {
#undef DECLARE_VISIT_INSTRUCTION
+ protected:
+ virtual void GenerateFrameEntry() OVERRIDE;
+ virtual void GenerateFrameExit() OVERRIDE;
+ virtual void Bind(Label* label) OVERRIDE;
+ virtual void Move(HInstruction* instruction, Location location) OVERRIDE;
+ virtual void Push(HInstruction* instruction, Location location) OVERRIDE;
+
+ virtual HGraphVisitor* GetLocationBuilder() OVERRIDE {
+ return &location_builder_;
+ }
+
private:
- virtual void GenerateFrameEntry();
- virtual void GenerateFrameExit();
- virtual void Bind(Label* label);
+ LocationsBuilderX86 location_builder_;
DISALLOW_COPY_AND_ASSIGN(CodeGeneratorX86);
};