blob: ab34599c94354cd9b884c0e1de587aa1fb35ffc4 [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_x86.h"
18#include "utils/assembler.h"
19#include "utils/x86/assembler_x86.h"
20
21#define __ reinterpret_cast<X86Assembler*>(assembler())->
22
23namespace art {
24namespace x86 {
25
26void CodeGeneratorX86::GenerateFrameEntry() {
27 __ pushl(EBP);
28 __ movl(EBP, ESP);
29}
30
31void CodeGeneratorX86::GenerateFrameExit() {
32 __ movl(ESP, EBP);
33 __ popl(EBP);
34}
35
36void CodeGeneratorX86::Bind(Label* label) {
37 __ Bind(label);
38}
39
40void CodeGeneratorX86::VisitGoto(HGoto* got) {
41 HBasicBlock* successor = got->GetSuccessor();
42 if (graph()->exit_block() == successor) {
43 GenerateFrameExit();
44 } else if (!GoesToNextBlock(got)) {
45 __ jmp(GetLabelOf(successor));
46 }
47}
48
49void CodeGeneratorX86::VisitExit(HExit* exit) {
50 if (kIsDebugBuild) {
51 __ Comment("Unreachable");
52 __ int3();
53 }
54}
55
56void CodeGeneratorX86::VisitIf(HIf* if_instr) {
57 LOG(FATAL) << "UNIMPLEMENTED";
58}
59
Nicolas Geoffray3ff386a2014-03-04 14:46:47 +000060void CodeGeneratorX86::VisitLocal(HLocal* local) {
61 LOG(FATAL) << "UNIMPLEMENTED";
62}
63
64void CodeGeneratorX86::VisitLoadLocal(HLoadLocal* local) {
65 LOG(FATAL) << "UNIMPLEMENTED";
66}
67
68void CodeGeneratorX86::VisitStoreLocal(HStoreLocal* local) {
69 LOG(FATAL) << "UNIMPLEMENTED";
70}
71
72void CodeGeneratorX86::VisitEqual(HEqual* equal) {
73 LOG(FATAL) << "UNIMPLEMENTED";
74}
75
76void CodeGeneratorX86::VisitIntConstant(HIntConstant* constant) {
77 LOG(FATAL) << "UNIMPLEMENTED";
78}
79
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +000080void CodeGeneratorX86::VisitReturnVoid(HReturnVoid* ret) {
81 GenerateFrameExit();
82 __ ret();
83}
84
85} // namespace x86
86} // namespace art