blob: 33d8e624a8490e84032cd295ca4c39b2b7b64f0b [file] [log] [blame]
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +00001/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ART_COMPILER_OPTIMIZING_CODE_GENERATOR_ARM_H_
18#define ART_COMPILER_OPTIMIZING_CODE_GENERATOR_ARM_H_
19
20#include "code_generator.h"
21#include "nodes.h"
22
23namespace art {
24
25class Assembler;
26class Label;
27
28namespace arm {
29
Nicolas Geoffraybab4ed72014-03-11 17:53:17 +000030class LocationsBuilderARM : public HGraphVisitor {
31 public:
32 explicit LocationsBuilderARM(HGraph* graph) : HGraphVisitor(graph) { }
33
34#define DECLARE_VISIT_INSTRUCTION(name) \
35 virtual void Visit##name(H##name* instr);
36
37 FOR_EACH_INSTRUCTION(DECLARE_VISIT_INSTRUCTION)
38
39#undef DECLARE_VISIT_INSTRUCTION
40
41 private:
42 DISALLOW_COPY_AND_ASSIGN(LocationsBuilderARM);
43};
44
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +000045class CodeGeneratorARM : public CodeGenerator {
46 public:
47 CodeGeneratorARM(Assembler* assembler, HGraph* graph)
Nicolas Geoffraybab4ed72014-03-11 17:53:17 +000048 : CodeGenerator(assembler, graph), location_builder_(graph) { }
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +000049
50 // Visit functions for instruction classes.
51#define DECLARE_VISIT_INSTRUCTION(name) \
52 virtual void Visit##name(H##name* instr);
53
54 FOR_EACH_INSTRUCTION(DECLARE_VISIT_INSTRUCTION)
55
56#undef DECLARE_VISIT_INSTRUCTION
57
Nicolas Geoffraybab4ed72014-03-11 17:53:17 +000058 protected:
59 virtual void GenerateFrameEntry() OVERRIDE;
60 virtual void GenerateFrameExit() OVERRIDE;
61 virtual void Bind(Label* label) OVERRIDE;
62 virtual void Move(HInstruction* instruction, Location location) OVERRIDE;
63 virtual void Push(HInstruction* instruction, Location location) OVERRIDE;
64
65 virtual HGraphVisitor* GetLocationBuilder() OVERRIDE {
66 return &location_builder_;
67 }
68
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +000069 private:
Nicolas Geoffraybab4ed72014-03-11 17:53:17 +000070 LocationsBuilderARM location_builder_;
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +000071
72 DISALLOW_COPY_AND_ASSIGN(CodeGeneratorARM);
73};
74
75} // namespace arm
76} // namespace art
77
78#endif // ART_COMPILER_OPTIMIZING_CODE_GENERATOR_ARM_H_