Nicolas Geoffray | d4dd255 | 2014-02-28 10:23:58 +0000 | [diff] [blame] | 1 | /* |
| 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 | |
| 23 | namespace art { |
| 24 | namespace arm { |
| 25 | |
| 26 | void CodeGeneratorARM::GenerateFrameEntry() { |
| 27 | RegList registers = (1 << LR) | (1 << FP); |
| 28 | __ PushList(registers); |
| 29 | } |
| 30 | |
| 31 | void CodeGeneratorARM::GenerateFrameExit() { |
| 32 | RegList registers = (1 << PC) | (1 << FP); |
| 33 | __ PopList(registers); |
| 34 | } |
| 35 | |
| 36 | void CodeGeneratorARM::Bind(Label* label) { |
| 37 | __ Bind(label); |
| 38 | } |
| 39 | |
| 40 | void 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 | |
| 49 | void CodeGeneratorARM::VisitExit(HExit* exit) { |
| 50 | if (kIsDebugBuild) { |
| 51 | __ Comment("Unreachable"); |
| 52 | __ bkpt(0); |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | void CodeGeneratorARM::VisitIf(HIf* if_instr) { |
| 57 | LOG(FATAL) << "UNIMPLEMENTED"; |
| 58 | } |
| 59 | |
Nicolas Geoffray | 3ff386a | 2014-03-04 14:46:47 +0000 | [diff] [blame] | 60 | void CodeGeneratorARM::VisitEqual(HEqual* equal) { |
| 61 | LOG(FATAL) << "UNIMPLEMENTED"; |
| 62 | } |
| 63 | |
| 64 | void CodeGeneratorARM::VisitLocal(HLocal* local) { |
| 65 | LOG(FATAL) << "UNIMPLEMENTED"; |
| 66 | } |
| 67 | |
| 68 | void CodeGeneratorARM::VisitLoadLocal(HLoadLocal* local) { |
| 69 | LOG(FATAL) << "UNIMPLEMENTED"; |
| 70 | } |
| 71 | |
| 72 | void CodeGeneratorARM::VisitStoreLocal(HStoreLocal* local) { |
| 73 | LOG(FATAL) << "UNIMPLEMENTED"; |
| 74 | } |
| 75 | |
| 76 | void CodeGeneratorARM::VisitIntConstant(HIntConstant* constant) { |
| 77 | LOG(FATAL) << "UNIMPLEMENTED"; |
| 78 | } |
| 79 | |
Nicolas Geoffray | d4dd255 | 2014-02-28 10:23:58 +0000 | [diff] [blame] | 80 | void CodeGeneratorARM::VisitReturnVoid(HReturnVoid* ret) { |
| 81 | GenerateFrameExit(); |
| 82 | } |
| 83 | |
| 84 | } // namespace arm |
| 85 | } // namespace art |