Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 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_MIPS64_H_ |
| 18 | #define ART_COMPILER_OPTIMIZING_CODE_GENERATOR_MIPS64_H_ |
| 19 | |
| 20 | #include "code_generator.h" |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 21 | #include "driver/compiler_options.h" |
| 22 | #include "nodes.h" |
| 23 | #include "parallel_move_resolver.h" |
| 24 | #include "utils/mips64/assembler_mips64.h" |
| 25 | |
| 26 | namespace art { |
| 27 | namespace mips64 { |
| 28 | |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 29 | // InvokeDexCallingConvention registers |
| 30 | |
| 31 | static constexpr GpuRegister kParameterCoreRegisters[] = |
| 32 | { A1, A2, A3, A4, A5, A6, A7 }; |
| 33 | static constexpr size_t kParameterCoreRegistersLength = arraysize(kParameterCoreRegisters); |
| 34 | |
| 35 | static constexpr FpuRegister kParameterFpuRegisters[] = |
| 36 | { F13, F14, F15, F16, F17, F18, F19 }; |
| 37 | static constexpr size_t kParameterFpuRegistersLength = arraysize(kParameterFpuRegisters); |
| 38 | |
| 39 | |
| 40 | // InvokeRuntimeCallingConvention registers |
| 41 | |
| 42 | static constexpr GpuRegister kRuntimeParameterCoreRegisters[] = |
| 43 | { A0, A1, A2, A3, A4, A5, A6, A7 }; |
| 44 | static constexpr size_t kRuntimeParameterCoreRegistersLength = |
| 45 | arraysize(kRuntimeParameterCoreRegisters); |
| 46 | |
| 47 | static constexpr FpuRegister kRuntimeParameterFpuRegisters[] = |
| 48 | { F12, F13, F14, F15, F16, F17, F18, F19 }; |
| 49 | static constexpr size_t kRuntimeParameterFpuRegistersLength = |
| 50 | arraysize(kRuntimeParameterFpuRegisters); |
| 51 | |
| 52 | |
| 53 | static constexpr GpuRegister kCoreCalleeSaves[] = |
| 54 | { S0, S1, S2, S3, S4, S5, S6, S7, GP, S8, RA }; // TODO: review |
| 55 | static constexpr FpuRegister kFpuCalleeSaves[] = |
| 56 | { F24, F25, F26, F27, F28, F29, F30, F31 }; |
| 57 | |
| 58 | |
| 59 | class CodeGeneratorMIPS64; |
| 60 | |
| 61 | class InvokeDexCallingConvention : public CallingConvention<GpuRegister, FpuRegister> { |
| 62 | public: |
| 63 | InvokeDexCallingConvention() |
| 64 | : CallingConvention(kParameterCoreRegisters, |
| 65 | kParameterCoreRegistersLength, |
| 66 | kParameterFpuRegisters, |
| 67 | kParameterFpuRegistersLength, |
| 68 | kMips64PointerSize) {} |
| 69 | |
| 70 | private: |
| 71 | DISALLOW_COPY_AND_ASSIGN(InvokeDexCallingConvention); |
| 72 | }; |
| 73 | |
| 74 | class InvokeDexCallingConventionVisitorMIPS64 : public InvokeDexCallingConventionVisitor { |
| 75 | public: |
| 76 | InvokeDexCallingConventionVisitorMIPS64() {} |
| 77 | virtual ~InvokeDexCallingConventionVisitorMIPS64() {} |
| 78 | |
| 79 | Location GetNextLocation(Primitive::Type type) OVERRIDE; |
| 80 | Location GetReturnLocation(Primitive::Type type) const OVERRIDE; |
| 81 | Location GetMethodLocation() const OVERRIDE; |
| 82 | |
| 83 | private: |
| 84 | InvokeDexCallingConvention calling_convention; |
| 85 | |
| 86 | DISALLOW_COPY_AND_ASSIGN(InvokeDexCallingConventionVisitorMIPS64); |
| 87 | }; |
| 88 | |
| 89 | class InvokeRuntimeCallingConvention : public CallingConvention<GpuRegister, FpuRegister> { |
| 90 | public: |
| 91 | InvokeRuntimeCallingConvention() |
| 92 | : CallingConvention(kRuntimeParameterCoreRegisters, |
| 93 | kRuntimeParameterCoreRegistersLength, |
| 94 | kRuntimeParameterFpuRegisters, |
| 95 | kRuntimeParameterFpuRegistersLength, |
| 96 | kMips64PointerSize) {} |
| 97 | |
| 98 | Location GetReturnLocation(Primitive::Type return_type); |
| 99 | |
| 100 | private: |
| 101 | DISALLOW_COPY_AND_ASSIGN(InvokeRuntimeCallingConvention); |
| 102 | }; |
| 103 | |
Calin Juravle | e460d1d | 2015-09-29 04:52:17 +0100 | [diff] [blame] | 104 | class FieldAccessCallingConventionMIPS64 : public FieldAccessCallingConvention { |
| 105 | public: |
| 106 | FieldAccessCallingConventionMIPS64() {} |
| 107 | |
| 108 | Location GetObjectLocation() const OVERRIDE { |
| 109 | return Location::RegisterLocation(A1); |
| 110 | } |
| 111 | Location GetFieldIndexLocation() const OVERRIDE { |
| 112 | return Location::RegisterLocation(A0); |
| 113 | } |
| 114 | Location GetReturnLocation(Primitive::Type type ATTRIBUTE_UNUSED) const OVERRIDE { |
Goran Jakovljevic | 8c34ec1 | 2015-10-14 11:23:48 +0200 | [diff] [blame] | 115 | return Location::RegisterLocation(V0); |
Calin Juravle | e460d1d | 2015-09-29 04:52:17 +0100 | [diff] [blame] | 116 | } |
Alexey Frunze | 00580bd | 2015-11-11 13:31:12 -0800 | [diff] [blame] | 117 | Location GetSetValueLocation(Primitive::Type type, bool is_instance) const OVERRIDE { |
| 118 | return Primitive::Is64BitType(type) |
| 119 | ? Location::RegisterLocation(A2) |
| 120 | : (is_instance |
| 121 | ? Location::RegisterLocation(A2) |
| 122 | : Location::RegisterLocation(A1)); |
Calin Juravle | e460d1d | 2015-09-29 04:52:17 +0100 | [diff] [blame] | 123 | } |
| 124 | Location GetFpuLocation(Primitive::Type type ATTRIBUTE_UNUSED) const OVERRIDE { |
| 125 | return Location::FpuRegisterLocation(F0); |
| 126 | } |
| 127 | |
| 128 | private: |
| 129 | DISALLOW_COPY_AND_ASSIGN(FieldAccessCallingConventionMIPS64); |
| 130 | }; |
| 131 | |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 132 | class ParallelMoveResolverMIPS64 : public ParallelMoveResolverWithSwap { |
| 133 | public: |
| 134 | ParallelMoveResolverMIPS64(ArenaAllocator* allocator, CodeGeneratorMIPS64* codegen) |
| 135 | : ParallelMoveResolverWithSwap(allocator), codegen_(codegen) {} |
| 136 | |
| 137 | void EmitMove(size_t index) OVERRIDE; |
| 138 | void EmitSwap(size_t index) OVERRIDE; |
| 139 | void SpillScratch(int reg) OVERRIDE; |
| 140 | void RestoreScratch(int reg) OVERRIDE; |
| 141 | |
| 142 | void Exchange(int index1, int index2, bool double_slot); |
| 143 | |
| 144 | Mips64Assembler* GetAssembler() const; |
| 145 | |
| 146 | private: |
| 147 | CodeGeneratorMIPS64* const codegen_; |
| 148 | |
| 149 | DISALLOW_COPY_AND_ASSIGN(ParallelMoveResolverMIPS64); |
| 150 | }; |
| 151 | |
| 152 | class SlowPathCodeMIPS64 : public SlowPathCode { |
| 153 | public: |
David Srbecky | 9cd6d37 | 2016-02-09 15:24:47 +0000 | [diff] [blame] | 154 | explicit SlowPathCodeMIPS64(HInstruction* instruction) |
| 155 | : SlowPathCode(instruction), entry_label_(), exit_label_() {} |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 156 | |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 157 | Mips64Label* GetEntryLabel() { return &entry_label_; } |
| 158 | Mips64Label* GetExitLabel() { return &exit_label_; } |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 159 | |
| 160 | private: |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 161 | Mips64Label entry_label_; |
| 162 | Mips64Label exit_label_; |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 163 | |
| 164 | DISALLOW_COPY_AND_ASSIGN(SlowPathCodeMIPS64); |
| 165 | }; |
| 166 | |
| 167 | class LocationsBuilderMIPS64 : public HGraphVisitor { |
| 168 | public: |
| 169 | LocationsBuilderMIPS64(HGraph* graph, CodeGeneratorMIPS64* codegen) |
| 170 | : HGraphVisitor(graph), codegen_(codegen) {} |
| 171 | |
| 172 | #define DECLARE_VISIT_INSTRUCTION(name, super) \ |
Alexandre Rames | f39e064 | 2015-06-23 11:33:45 +0100 | [diff] [blame] | 173 | void Visit##name(H##name* instr) OVERRIDE; |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 174 | |
Alexandre Rames | f39e064 | 2015-06-23 11:33:45 +0100 | [diff] [blame] | 175 | FOR_EACH_CONCRETE_INSTRUCTION_COMMON(DECLARE_VISIT_INSTRUCTION) |
| 176 | FOR_EACH_CONCRETE_INSTRUCTION_MIPS64(DECLARE_VISIT_INSTRUCTION) |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 177 | |
| 178 | #undef DECLARE_VISIT_INSTRUCTION |
| 179 | |
Alexandre Rames | f39e064 | 2015-06-23 11:33:45 +0100 | [diff] [blame] | 180 | void VisitInstruction(HInstruction* instruction) OVERRIDE { |
| 181 | LOG(FATAL) << "Unreachable instruction " << instruction->DebugName() |
| 182 | << " (id " << instruction->GetId() << ")"; |
| 183 | } |
| 184 | |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 185 | private: |
| 186 | void HandleInvoke(HInvoke* invoke); |
| 187 | void HandleBinaryOp(HBinaryOperation* operation); |
Vladimir Marko | 5f7b58e | 2015-11-23 19:49:34 +0000 | [diff] [blame] | 188 | void HandleCondition(HCondition* instruction); |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 189 | void HandleShift(HBinaryOperation* operation); |
| 190 | void HandleFieldSet(HInstruction* instruction, const FieldInfo& field_info); |
| 191 | void HandleFieldGet(HInstruction* instruction, const FieldInfo& field_info); |
| 192 | |
| 193 | InvokeDexCallingConventionVisitorMIPS64 parameter_visitor_; |
| 194 | |
| 195 | CodeGeneratorMIPS64* const codegen_; |
| 196 | |
| 197 | DISALLOW_COPY_AND_ASSIGN(LocationsBuilderMIPS64); |
| 198 | }; |
| 199 | |
Aart Bik | 42249c3 | 2016-01-07 15:33:50 -0800 | [diff] [blame] | 200 | class InstructionCodeGeneratorMIPS64 : public InstructionCodeGenerator { |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 201 | public: |
| 202 | InstructionCodeGeneratorMIPS64(HGraph* graph, CodeGeneratorMIPS64* codegen); |
| 203 | |
| 204 | #define DECLARE_VISIT_INSTRUCTION(name, super) \ |
Alexandre Rames | f39e064 | 2015-06-23 11:33:45 +0100 | [diff] [blame] | 205 | void Visit##name(H##name* instr) OVERRIDE; |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 206 | |
Alexandre Rames | f39e064 | 2015-06-23 11:33:45 +0100 | [diff] [blame] | 207 | FOR_EACH_CONCRETE_INSTRUCTION_COMMON(DECLARE_VISIT_INSTRUCTION) |
| 208 | FOR_EACH_CONCRETE_INSTRUCTION_MIPS64(DECLARE_VISIT_INSTRUCTION) |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 209 | |
| 210 | #undef DECLARE_VISIT_INSTRUCTION |
| 211 | |
Alexandre Rames | f39e064 | 2015-06-23 11:33:45 +0100 | [diff] [blame] | 212 | void VisitInstruction(HInstruction* instruction) OVERRIDE { |
| 213 | LOG(FATAL) << "Unreachable instruction " << instruction->DebugName() |
| 214 | << " (id " << instruction->GetId() << ")"; |
| 215 | } |
| 216 | |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 217 | Mips64Assembler* GetAssembler() const { return assembler_; } |
| 218 | |
| 219 | private: |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 220 | void GenerateClassInitializationCheck(SlowPathCodeMIPS64* slow_path, GpuRegister class_reg); |
| 221 | void GenerateMemoryBarrier(MemBarrierKind kind); |
| 222 | void GenerateSuspendCheck(HSuspendCheck* check, HBasicBlock* successor); |
| 223 | void HandleBinaryOp(HBinaryOperation* operation); |
Vladimir Marko | 5f7b58e | 2015-11-23 19:49:34 +0000 | [diff] [blame] | 224 | void HandleCondition(HCondition* instruction); |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 225 | void HandleShift(HBinaryOperation* operation); |
Goran Jakovljevic | 8ed1826 | 2016-01-22 13:01:00 +0100 | [diff] [blame] | 226 | void HandleFieldSet(HInstruction* instruction, |
| 227 | const FieldInfo& field_info, |
| 228 | bool value_can_be_null); |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 229 | void HandleFieldGet(HInstruction* instruction, const FieldInfo& field_info); |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 230 | void GenerateTestAndBranch(HInstruction* instruction, |
David Brazdil | 0debae7 | 2015-11-12 18:37:00 +0000 | [diff] [blame] | 231 | size_t condition_input_index, |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 232 | Mips64Label* true_target, |
| 233 | Mips64Label* false_target); |
Alexey Frunze | c857c74 | 2015-09-23 15:12:39 -0700 | [diff] [blame] | 234 | void DivRemOneOrMinusOne(HBinaryOperation* instruction); |
| 235 | void DivRemByPowerOfTwo(HBinaryOperation* instruction); |
| 236 | void GenerateDivRemWithAnyConstant(HBinaryOperation* instruction); |
| 237 | void GenerateDivRemIntegral(HBinaryOperation* instruction); |
Alexey Frunze | 299a939 | 2015-12-08 16:08:02 -0800 | [diff] [blame] | 238 | void GenerateIntLongCompare(IfCondition cond, bool is64bit, LocationSummary* locations); |
| 239 | void GenerateIntLongCompareAndBranch(IfCondition cond, |
| 240 | bool is64bit, |
| 241 | LocationSummary* locations, |
| 242 | Mips64Label* label); |
| 243 | void GenerateFpCompareAndBranch(IfCondition cond, |
| 244 | bool gt_bias, |
| 245 | Primitive::Type type, |
| 246 | LocationSummary* locations, |
| 247 | Mips64Label* label); |
David Brazdil | fc6a86a | 2015-06-26 10:33:45 +0000 | [diff] [blame] | 248 | void HandleGoto(HInstruction* got, HBasicBlock* successor); |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 249 | |
| 250 | Mips64Assembler* const assembler_; |
| 251 | CodeGeneratorMIPS64* const codegen_; |
| 252 | |
| 253 | DISALLOW_COPY_AND_ASSIGN(InstructionCodeGeneratorMIPS64); |
| 254 | }; |
| 255 | |
| 256 | class CodeGeneratorMIPS64 : public CodeGenerator { |
| 257 | public: |
| 258 | CodeGeneratorMIPS64(HGraph* graph, |
| 259 | const Mips64InstructionSetFeatures& isa_features, |
Serban Constantinescu | ecc4366 | 2015-08-13 13:33:12 +0100 | [diff] [blame] | 260 | const CompilerOptions& compiler_options, |
| 261 | OptimizingCompilerStats* stats = nullptr); |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 262 | virtual ~CodeGeneratorMIPS64() {} |
| 263 | |
| 264 | void GenerateFrameEntry() OVERRIDE; |
| 265 | void GenerateFrameExit() OVERRIDE; |
| 266 | |
| 267 | void Bind(HBasicBlock* block) OVERRIDE; |
| 268 | |
Lazar Trsic | d967266 | 2015-09-03 17:33:01 +0200 | [diff] [blame] | 269 | size_t GetWordSize() const OVERRIDE { return kMips64DoublewordSize; } |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 270 | |
Lazar Trsic | d967266 | 2015-09-03 17:33:01 +0200 | [diff] [blame] | 271 | size_t GetFloatingPointSpillSlotSize() const OVERRIDE { return kMips64DoublewordSize; } |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 272 | |
Alexandre Rames | c01a664 | 2016-04-15 11:54:06 +0100 | [diff] [blame] | 273 | uintptr_t GetAddressOf(HBasicBlock* block) OVERRIDE { |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 274 | return assembler_.GetLabelLocation(GetLabelOf(block)); |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 275 | } |
| 276 | |
| 277 | HGraphVisitor* GetLocationBuilder() OVERRIDE { return &location_builder_; } |
| 278 | HGraphVisitor* GetInstructionVisitor() OVERRIDE { return &instruction_visitor_; } |
| 279 | Mips64Assembler* GetAssembler() OVERRIDE { return &assembler_; } |
Alexandre Rames | eb7b739 | 2015-06-19 14:47:01 +0100 | [diff] [blame] | 280 | const Mips64Assembler& GetAssembler() const OVERRIDE { return assembler_; } |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 281 | |
Goran Jakovljevic | 8ed1826 | 2016-01-22 13:01:00 +0100 | [diff] [blame] | 282 | void MarkGCCard(GpuRegister object, GpuRegister value, bool value_can_be_null); |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 283 | |
| 284 | // Register allocation. |
| 285 | |
David Brazdil | 58282f4 | 2016-01-14 12:45:10 +0000 | [diff] [blame] | 286 | void SetupBlockedRegisters() const OVERRIDE; |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 287 | |
Roland Levillain | f41f956 | 2016-09-14 19:26:48 +0100 | [diff] [blame] | 288 | size_t SaveCoreRegister(size_t stack_index, uint32_t reg_id) OVERRIDE; |
| 289 | size_t RestoreCoreRegister(size_t stack_index, uint32_t reg_id) OVERRIDE; |
| 290 | size_t SaveFloatingPointRegister(size_t stack_index, uint32_t reg_id) OVERRIDE; |
| 291 | size_t RestoreFloatingPointRegister(size_t stack_index, uint32_t reg_id) OVERRIDE; |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 292 | |
| 293 | void DumpCoreRegister(std::ostream& stream, int reg) const OVERRIDE; |
| 294 | void DumpFloatingPointRegister(std::ostream& stream, int reg) const OVERRIDE; |
| 295 | |
| 296 | InstructionSet GetInstructionSet() const OVERRIDE { return InstructionSet::kMips64; } |
| 297 | |
| 298 | const Mips64InstructionSetFeatures& GetInstructionSetFeatures() const { |
| 299 | return isa_features_; |
| 300 | } |
| 301 | |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 302 | Mips64Label* GetLabelOf(HBasicBlock* block) const { |
| 303 | return CommonGetLabelOf<Mips64Label>(block_labels_, block); |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 304 | } |
| 305 | |
| 306 | void Initialize() OVERRIDE { |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 307 | block_labels_ = CommonInitializeLabels<Mips64Label>(); |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 308 | } |
| 309 | |
| 310 | void Finalize(CodeAllocator* allocator) OVERRIDE; |
| 311 | |
| 312 | // Code generation helpers. |
Calin Juravle | e460d1d | 2015-09-29 04:52:17 +0100 | [diff] [blame] | 313 | void MoveLocation(Location dst, Location src, Primitive::Type dst_type) OVERRIDE; |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 314 | |
Calin Juravle | 175dc73 | 2015-08-25 15:42:32 +0100 | [diff] [blame] | 315 | void MoveConstant(Location destination, int32_t value) OVERRIDE; |
| 316 | |
Calin Juravle | e460d1d | 2015-09-29 04:52:17 +0100 | [diff] [blame] | 317 | void AddLocationAsTemp(Location location, LocationSummary* locations) OVERRIDE; |
| 318 | |
| 319 | |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 320 | void SwapLocations(Location loc1, Location loc2, Primitive::Type type); |
| 321 | |
| 322 | // Generate code to invoke a runtime entry point. |
Calin Juravle | 175dc73 | 2015-08-25 15:42:32 +0100 | [diff] [blame] | 323 | void InvokeRuntime(QuickEntrypointEnum entrypoint, |
| 324 | HInstruction* instruction, |
| 325 | uint32_t dex_pc, |
Serban Constantinescu | fc73408 | 2016-07-19 17:18:07 +0100 | [diff] [blame] | 326 | SlowPathCode* slow_path = nullptr) OVERRIDE; |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 327 | |
| 328 | ParallelMoveResolver* GetMoveResolver() OVERRIDE { return &move_resolver_; } |
| 329 | |
Roland Levillain | f41f956 | 2016-09-14 19:26:48 +0100 | [diff] [blame] | 330 | bool NeedsTwoRegisters(Primitive::Type type ATTRIBUTE_UNUSED) const OVERRIDE { return false; } |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 331 | |
Vladimir Marko | cac5a7e | 2016-02-22 10:39:50 +0000 | [diff] [blame] | 332 | // Check if the desired_string_load_kind is supported. If it is, return it, |
| 333 | // otherwise return a fall-back kind that should be used instead. |
| 334 | HLoadString::LoadKind GetSupportedLoadStringKind( |
| 335 | HLoadString::LoadKind desired_string_load_kind) OVERRIDE; |
| 336 | |
Vladimir Marko | dbb7f5b | 2016-03-30 13:23:58 +0100 | [diff] [blame] | 337 | // Check if the desired_class_load_kind is supported. If it is, return it, |
| 338 | // otherwise return a fall-back kind that should be used instead. |
| 339 | HLoadClass::LoadKind GetSupportedLoadClassKind( |
| 340 | HLoadClass::LoadKind desired_class_load_kind) OVERRIDE; |
| 341 | |
Vladimir Marko | dc151b2 | 2015-10-15 18:02:30 +0100 | [diff] [blame] | 342 | // Check if the desired_dispatch_info is supported. If it is, return it, |
| 343 | // otherwise return a fall-back info that should be used instead. |
| 344 | HInvokeStaticOrDirect::DispatchInfo GetSupportedInvokeStaticOrDirectDispatch( |
| 345 | const HInvokeStaticOrDirect::DispatchInfo& desired_dispatch_info, |
Nicolas Geoffray | 5e4e11e | 2016-09-22 13:17:41 +0100 | [diff] [blame] | 346 | HInvokeStaticOrDirect* invoke) OVERRIDE; |
Vladimir Marko | dc151b2 | 2015-10-15 18:02:30 +0100 | [diff] [blame] | 347 | |
Andreas Gampe | 85b62f2 | 2015-09-09 13:15:38 -0700 | [diff] [blame] | 348 | void GenerateStaticOrDirectCall(HInvokeStaticOrDirect* invoke, Location temp) OVERRIDE; |
Alexey Frunze | 53afca1 | 2015-11-05 16:34:23 -0800 | [diff] [blame] | 349 | void GenerateVirtualCall(HInvokeVirtual* invoke, Location temp) OVERRIDE; |
Andreas Gampe | 85b62f2 | 2015-09-09 13:15:38 -0700 | [diff] [blame] | 350 | |
| 351 | void MoveFromReturnRegister(Location trg ATTRIBUTE_UNUSED, |
| 352 | Primitive::Type type ATTRIBUTE_UNUSED) OVERRIDE { |
Chris Larsen | 3acee73 | 2015-11-18 13:31:08 -0800 | [diff] [blame] | 353 | UNIMPLEMENTED(FATAL) << "Not implemented on MIPS64"; |
Andreas Gampe | 85b62f2 | 2015-09-09 13:15:38 -0700 | [diff] [blame] | 354 | } |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 355 | |
Roland Levillain | f41f956 | 2016-09-14 19:26:48 +0100 | [diff] [blame] | 356 | void GenerateNop() OVERRIDE; |
| 357 | void GenerateImplicitNullCheck(HNullCheck* instruction) OVERRIDE; |
| 358 | void GenerateExplicitNullCheck(HNullCheck* instruction) OVERRIDE; |
David Srbecky | c7098ff | 2016-02-09 14:30:11 +0000 | [diff] [blame] | 359 | |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 360 | private: |
| 361 | // Labels for each block that will be compiled. |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 362 | Mips64Label* block_labels_; // Indexed by block id. |
| 363 | Mips64Label frame_entry_label_; |
Alexey Frunze | 4dda337 | 2015-06-01 18:31:49 -0700 | [diff] [blame] | 364 | LocationsBuilderMIPS64 location_builder_; |
| 365 | InstructionCodeGeneratorMIPS64 instruction_visitor_; |
| 366 | ParallelMoveResolverMIPS64 move_resolver_; |
| 367 | Mips64Assembler assembler_; |
| 368 | const Mips64InstructionSetFeatures& isa_features_; |
| 369 | |
| 370 | DISALLOW_COPY_AND_ASSIGN(CodeGeneratorMIPS64); |
| 371 | }; |
| 372 | |
| 373 | } // namespace mips64 |
| 374 | } // namespace art |
| 375 | |
| 376 | #endif // ART_COMPILER_OPTIMIZING_CODE_GENERATOR_MIPS64_H_ |