blob: 99bbaa05145792f6bf1007b59ca9f899d074c6ba [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#include "code_generator_arm.h"
18#include "utils/assembler.h"
19#include "utils/arm/assembler_arm.h"
20
21#define __ reinterpret_cast<ArmAssembler*>(assembler())->
22
23namespace art {
24namespace arm {
25
26void CodeGeneratorARM::GenerateFrameEntry() {
27 RegList registers = (1 << LR) | (1 << FP);
28 __ PushList(registers);
29}
30
31void CodeGeneratorARM::GenerateFrameExit() {
32 RegList registers = (1 << PC) | (1 << FP);
33 __ PopList(registers);
34}
35
36void CodeGeneratorARM::Bind(Label* label) {
37 __ Bind(label);
38}
39
40void CodeGeneratorARM::VisitGoto(HGoto* got) {
41 HBasicBlock* successor = got->GetSuccessor();
42 if (graph()->exit_block() == successor) {
43 GenerateFrameExit();
44 } else if (!GoesToNextBlock(got)) {
45 __ b(GetLabelOf(successor));
46 }
47}
48
49void CodeGeneratorARM::VisitExit(HExit* exit) {
50 if (kIsDebugBuild) {
51 __ Comment("Unreachable");
52 __ bkpt(0);
53 }
54}
55
56void CodeGeneratorARM::VisitIf(HIf* if_instr) {
57 LOG(FATAL) << "UNIMPLEMENTED";
58}
59
60void CodeGeneratorARM::VisitReturnVoid(HReturnVoid* ret) {
61 GenerateFrameExit();
62}
63
64} // namespace arm
65} // namespace art