code_generator_x86_64.h revision 52c489645b6e9ae33623f1ec24143cde5444906e
19cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray/* 29cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray * Copyright (C) 2014 The Android Open Source Project 39cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray * 49cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray * Licensed under the Apache License, Version 2.0 (the "License"); 59cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray * you may not use this file except in compliance with the License. 69cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray * You may obtain a copy of the License at 79cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray * 89cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray * http://www.apache.org/licenses/LICENSE-2.0 99cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray * 109cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray * Unless required by applicable law or agreed to in writing, software 119cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray * distributed under the License is distributed on an "AS IS" BASIS, 129cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 139cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray * See the License for the specific language governing permissions and 149cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray * limitations under the License. 159cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray */ 169cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 179cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray#ifndef ART_COMPILER_OPTIMIZING_CODE_GENERATOR_X86_64_H_ 189cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray#define ART_COMPILER_OPTIMIZING_CODE_GENERATOR_X86_64_H_ 199cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 209cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray#include "code_generator.h" 2152c489645b6e9ae33623f1ec24143cde5444906eCalin Juravle#include "dex/compiler_enums.h" 229cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray#include "nodes.h" 23ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray#include "parallel_move_resolver.h" 249cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray#include "utils/x86_64/assembler_x86_64.h" 259cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 269cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffraynamespace art { 279cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffraynamespace x86_64 { 289cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 2986a8d7afc7f00ff0f5ea7b8aaf4d50514250a4e6Nicolas Geoffray// Use a local definition to prevent copying mistakes. 3086a8d7afc7f00ff0f5ea7b8aaf4d50514250a4e6Nicolas Geoffraystatic constexpr size_t kX86_64WordSize = kX86_64PointerSize; 319cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 329cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffraystatic constexpr Register kParameterCoreRegisters[] = { RSI, RDX, RCX, R8, R9 }; 337fb49da8ec62e8a10ed9419ade9f32c6b1174687Nicolas Geoffraystatic constexpr FloatRegister kParameterFloatRegisters[] = 347fb49da8ec62e8a10ed9419ade9f32c6b1174687Nicolas Geoffray { XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7 }; 359cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 369cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffraystatic constexpr size_t kParameterCoreRegistersLength = arraysize(kParameterCoreRegisters); 377fb49da8ec62e8a10ed9419ade9f32c6b1174687Nicolas Geoffraystatic constexpr size_t kParameterFloatRegistersLength = arraysize(kParameterFloatRegisters); 389cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 397fb49da8ec62e8a10ed9419ade9f32c6b1174687Nicolas Geoffrayclass InvokeDexCallingConvention : public CallingConvention<Register, FloatRegister> { 409cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray public: 417fb49da8ec62e8a10ed9419ade9f32c6b1174687Nicolas Geoffray InvokeDexCallingConvention() : CallingConvention( 427fb49da8ec62e8a10ed9419ade9f32c6b1174687Nicolas Geoffray kParameterCoreRegisters, 437fb49da8ec62e8a10ed9419ade9f32c6b1174687Nicolas Geoffray kParameterCoreRegistersLength, 447fb49da8ec62e8a10ed9419ade9f32c6b1174687Nicolas Geoffray kParameterFloatRegisters, 457fb49da8ec62e8a10ed9419ade9f32c6b1174687Nicolas Geoffray kParameterFloatRegistersLength) {} 469cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 479cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray private: 489cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray DISALLOW_COPY_AND_ASSIGN(InvokeDexCallingConvention); 499cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray}; 509cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 519cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffrayclass InvokeDexCallingConventionVisitor { 529cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray public: 537fb49da8ec62e8a10ed9419ade9f32c6b1174687Nicolas Geoffray InvokeDexCallingConventionVisitor() : gp_index_(0), fp_index_(0), stack_index_(0) {} 549cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 559cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray Location GetNextLocation(Primitive::Type type); 569cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 579cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray private: 589cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray InvokeDexCallingConvention calling_convention; 597fb49da8ec62e8a10ed9419ade9f32c6b1174687Nicolas Geoffray // The current index for cpu registers. 609cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray uint32_t gp_index_; 617fb49da8ec62e8a10ed9419ade9f32c6b1174687Nicolas Geoffray // The current index for fpu registers. 627fb49da8ec62e8a10ed9419ade9f32c6b1174687Nicolas Geoffray uint32_t fp_index_; 637fb49da8ec62e8a10ed9419ade9f32c6b1174687Nicolas Geoffray // The current stack index. 649cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray uint32_t stack_index_; 659cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 669cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray DISALLOW_COPY_AND_ASSIGN(InvokeDexCallingConventionVisitor); 679cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray}; 689cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 699cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffrayclass CodeGeneratorX86_64; 70424f676379f2f872acd1478672022f19f3240fc1Nicolas Geoffrayclass SlowPathCodeX86_64; 719cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 72ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffrayclass ParallelMoveResolverX86_64 : public ParallelMoveResolver { 73ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray public: 74ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray ParallelMoveResolverX86_64(ArenaAllocator* allocator, CodeGeneratorX86_64* codegen) 75ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray : ParallelMoveResolver(allocator), codegen_(codegen) {} 76ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray 77de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray void EmitMove(size_t index) OVERRIDE; 78de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray void EmitSwap(size_t index) OVERRIDE; 79de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray void SpillScratch(int reg) OVERRIDE; 80de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray void RestoreScratch(int reg) OVERRIDE; 81ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray 82ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray X86_64Assembler* GetAssembler() const; 83ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray 84ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray private: 85412f10cfed002ab617c78f2621d68446ca4dd8bdNicolas Geoffray void Exchange32(CpuRegister reg, int mem); 86102cbed1e52b7c5f09458b44903fe97bb3e14d5fNicolas Geoffray void Exchange32(XmmRegister reg, int mem); 87412f10cfed002ab617c78f2621d68446ca4dd8bdNicolas Geoffray void Exchange32(int mem1, int mem2); 88412f10cfed002ab617c78f2621d68446ca4dd8bdNicolas Geoffray void Exchange64(CpuRegister reg, int mem); 89102cbed1e52b7c5f09458b44903fe97bb3e14d5fNicolas Geoffray void Exchange64(XmmRegister reg, int mem); 90412f10cfed002ab617c78f2621d68446ca4dd8bdNicolas Geoffray void Exchange64(int mem1, int mem2); 91ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray 92ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray CodeGeneratorX86_64* const codegen_; 93ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray 94ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray DISALLOW_COPY_AND_ASSIGN(ParallelMoveResolverX86_64); 95ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray}; 96ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray 979cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffrayclass LocationsBuilderX86_64 : public HGraphVisitor { 989cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray public: 999cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray LocationsBuilderX86_64(HGraph* graph, CodeGeneratorX86_64* codegen) 1009cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray : HGraphVisitor(graph), codegen_(codegen) {} 1019cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 102360231a056e796c36ffe62348507e904dc9efb9bNicolas Geoffray#define DECLARE_VISIT_INSTRUCTION(name, super) \ 103de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray void Visit##name(H##name* instr) OVERRIDE; 1049cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 10596f89a290eb67d7bf4b1636798fa28df14309cc7Nicolas Geoffray FOR_EACH_CONCRETE_INSTRUCTION(DECLARE_VISIT_INSTRUCTION) 1069cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 1079cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray#undef DECLARE_VISIT_INSTRUCTION 1089cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 1099574c4b5f5ef039d694ac12c97e25ca02eca83c0Nicolas Geoffray private: 110e982f0b8e809cece6f460fa2d8df25873aa69de4Nicolas Geoffray void HandleInvoke(HInvoke* invoke); 1119574c4b5f5ef039d694ac12c97e25ca02eca83c0Nicolas Geoffray void HandleBitwiseOperation(HBinaryOperation* operation); 1129aec02fc5df5518c16f1e5a9b6cb198a192db973Calin Juravle void HandleShift(HBinaryOperation* operation); 11352c489645b6e9ae33623f1ec24143cde5444906eCalin Juravle void HandleFieldSet(HInstruction* instruction, const FieldInfo& field_info); 11452c489645b6e9ae33623f1ec24143cde5444906eCalin Juravle void HandleFieldGet(HInstruction* instruction); 115e982f0b8e809cece6f460fa2d8df25873aa69de4Nicolas Geoffray 1169cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray CodeGeneratorX86_64* const codegen_; 1179cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray InvokeDexCallingConventionVisitor parameter_visitor_; 1189cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 1199cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray DISALLOW_COPY_AND_ASSIGN(LocationsBuilderX86_64); 1209cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray}; 1219cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 1229cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffrayclass InstructionCodeGeneratorX86_64 : public HGraphVisitor { 1239cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray public: 1249cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray InstructionCodeGeneratorX86_64(HGraph* graph, CodeGeneratorX86_64* codegen); 1259cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 126360231a056e796c36ffe62348507e904dc9efb9bNicolas Geoffray#define DECLARE_VISIT_INSTRUCTION(name, super) \ 127de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray void Visit##name(H##name* instr) OVERRIDE; 1289cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 12996f89a290eb67d7bf4b1636798fa28df14309cc7Nicolas Geoffray FOR_EACH_CONCRETE_INSTRUCTION(DECLARE_VISIT_INSTRUCTION) 1309cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 1319cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray#undef DECLARE_VISIT_INSTRUCTION 1329cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 1339cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray X86_64Assembler* GetAssembler() const { return assembler_; } 1349cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 1359cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray private: 1363c04974a90b0e03f4b509010bff49f0b2a3da57fNicolas Geoffray // Generate code for the given suspend check. If not null, `successor` 1373c04974a90b0e03f4b509010bff49f0b2a3da57fNicolas Geoffray // is the block to branch to if the suspend check is not needed, and after 1383c04974a90b0e03f4b509010bff49f0b2a3da57fNicolas Geoffray // the suspend call. 1393c04974a90b0e03f4b509010bff49f0b2a3da57fNicolas Geoffray void GenerateSuspendCheck(HSuspendCheck* instruction, HBasicBlock* successor); 140424f676379f2f872acd1478672022f19f3240fc1Nicolas Geoffray void GenerateClassInitializationCheck(SlowPathCodeX86_64* slow_path, CpuRegister class_reg); 1419574c4b5f5ef039d694ac12c97e25ca02eca83c0Nicolas Geoffray void HandleBitwiseOperation(HBinaryOperation* operation); 142bacfec30ee9f2f6fdfd190f11b105b609938efcaCalin Juravle void GenerateDivRemIntegral(HBinaryOperation* instruction); 1439aec02fc5df5518c16f1e5a9b6cb198a192db973Calin Juravle void HandleShift(HBinaryOperation* operation); 14452c489645b6e9ae33623f1ec24143cde5444906eCalin Juravle void GenerateMemoryBarrier(MemBarrierKind kind); 14552c489645b6e9ae33623f1ec24143cde5444906eCalin Juravle void HandleFieldSet(HInstruction* instruction, const FieldInfo& field_info); 14652c489645b6e9ae33623f1ec24143cde5444906eCalin Juravle void HandleFieldGet(HInstruction* instruction, const FieldInfo& field_info); 1473c04974a90b0e03f4b509010bff49f0b2a3da57fNicolas Geoffray 1489cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray X86_64Assembler* const assembler_; 1499cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray CodeGeneratorX86_64* const codegen_; 1509cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 1519cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray DISALLOW_COPY_AND_ASSIGN(InstructionCodeGeneratorX86_64); 1529cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray}; 1539cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 1549cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffrayclass CodeGeneratorX86_64 : public CodeGenerator { 1559cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray public: 1569cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray explicit CodeGeneratorX86_64(HGraph* graph); 1579cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray virtual ~CodeGeneratorX86_64() {} 1589cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 159de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray void GenerateFrameEntry() OVERRIDE; 160de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray void GenerateFrameExit() OVERRIDE; 161de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray void Bind(HBasicBlock* block) OVERRIDE; 162de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray void Move(HInstruction* instruction, Location location, HInstruction* move_for) OVERRIDE; 163de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray size_t SaveCoreRegister(size_t stack_index, uint32_t reg_id) OVERRIDE; 164de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray size_t RestoreCoreRegister(size_t stack_index, uint32_t reg_id) OVERRIDE; 165de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray size_t SaveFloatingPointRegister(size_t stack_index, uint32_t reg_id) OVERRIDE; 166de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray size_t RestoreFloatingPointRegister(size_t stack_index, uint32_t reg_id) OVERRIDE; 1679cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 168de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray size_t GetWordSize() const OVERRIDE { 1699cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray return kX86_64WordSize; 1709cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray } 1719cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 172de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray size_t FrameEntrySpillSize() const OVERRIDE; 173ab032bc1ff57831106fdac6a91a136293609401fNicolas Geoffray 174de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray HGraphVisitor* GetLocationBuilder() OVERRIDE { 1759cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray return &location_builder_; 1769cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray } 1779cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 178de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray HGraphVisitor* GetInstructionVisitor() OVERRIDE { 1799cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray return &instruction_visitor_; 1809cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray } 1819cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 182de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray X86_64Assembler* GetAssembler() OVERRIDE { 1839cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray return &assembler_; 1849cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray } 1859cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 186f0e3937b87453234d0d7970b8712082062709b8dNicolas Geoffray ParallelMoveResolverX86_64* GetMoveResolver() OVERRIDE { 187ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray return &move_resolver_; 188ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray } 189ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray 190de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray uintptr_t GetAddressOf(HBasicBlock* block) const OVERRIDE { 191de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray return GetLabelOf(block)->Position(); 192de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray } 193de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray 194de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray Location GetStackLocation(HLoadLocal* load) const OVERRIDE; 1959cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 196de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray void SetupBlockedRegisters() const OVERRIDE; 197de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray Location AllocateFreeRegister(Primitive::Type type) const OVERRIDE; 198de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray void DumpCoreRegister(std::ostream& stream, int reg) const OVERRIDE; 199de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray void DumpFloatingPointRegister(std::ostream& stream, int reg) const OVERRIDE; 2009cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 201de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray InstructionSet GetInstructionSet() const OVERRIDE { 202412f10cfed002ab617c78f2621d68446ca4dd8bdNicolas Geoffray return InstructionSet::kX86_64; 203412f10cfed002ab617c78f2621d68446ca4dd8bdNicolas Geoffray } 204412f10cfed002ab617c78f2621d68446ca4dd8bdNicolas Geoffray 2053c7bb98698f77af10372cf31824d3bb115d9bf0fNicolas Geoffray // Emit a write barrier. 2063c7bb98698f77af10372cf31824d3bb115d9bf0fNicolas Geoffray void MarkGCCard(CpuRegister temp, CpuRegister card, CpuRegister object, CpuRegister value); 2073c7bb98698f77af10372cf31824d3bb115d9bf0fNicolas Geoffray 2089cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray // Helper method to move a value between two locations. 2099cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray void Move(Location destination, Location source); 2109cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 21119a19cffd197a28ae4c9c3e59eff6352fd392241Nicolas Geoffray void LoadCurrentMethod(CpuRegister reg); 21219a19cffd197a28ae4c9c3e59eff6352fd392241Nicolas Geoffray 21392a73aef279be78e3c2b04db1713076183933436Nicolas Geoffray Label* GetLabelOf(HBasicBlock* block) const { 21492a73aef279be78e3c2b04db1713076183933436Nicolas Geoffray return block_labels_.GetRawStorage() + block->GetBlockId(); 21592a73aef279be78e3c2b04db1713076183933436Nicolas Geoffray } 21692a73aef279be78e3c2b04db1713076183933436Nicolas Geoffray 217de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray void Initialize() OVERRIDE { 21892a73aef279be78e3c2b04db1713076183933436Nicolas Geoffray block_labels_.SetSize(GetGraph()->GetBlocks().Size()); 21992a73aef279be78e3c2b04db1713076183933436Nicolas Geoffray } 22092a73aef279be78e3c2b04db1713076183933436Nicolas Geoffray 2213c7bb98698f77af10372cf31824d3bb115d9bf0fNicolas Geoffray private: 22292a73aef279be78e3c2b04db1713076183933436Nicolas Geoffray // Labels for each block that will be compiled. 22392a73aef279be78e3c2b04db1713076183933436Nicolas Geoffray GrowableArray<Label> block_labels_; 2249cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray LocationsBuilderX86_64 location_builder_; 2259cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray InstructionCodeGeneratorX86_64 instruction_visitor_; 226ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray ParallelMoveResolverX86_64 move_resolver_; 2279cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray X86_64Assembler assembler_; 2289cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 2299cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray DISALLOW_COPY_AND_ASSIGN(CodeGeneratorX86_64); 2309cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray}; 2319cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 2329cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray} // namespace x86_64 2339cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray} // namespace art 2349cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 2359cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray#endif // ART_COMPILER_OPTIMIZING_CODE_GENERATOR_X86_64_H_ 236