code_generator_x86_64.h revision 0f7dca4ca0be8d2f8776794d35edf8b51b5bc997
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" 22cd6dffedf1bd8e6dfb3fb0c933551f9a90f7de3fCalin Juravle#include "driver/compiler_options.h" 239cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray#include "nodes.h" 24ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray#include "parallel_move_resolver.h" 259cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray#include "utils/x86_64/assembler_x86_64.h" 269cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 279cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffraynamespace art { 289cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffraynamespace x86_64 { 299cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 3086a8d7afc7f00ff0f5ea7b8aaf4d50514250a4e6Nicolas Geoffray// Use a local definition to prevent copying mistakes. 3186a8d7afc7f00ff0f5ea7b8aaf4d50514250a4e6Nicolas Geoffraystatic constexpr size_t kX86_64WordSize = kX86_64PointerSize; 329cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 33ee3cf0731d0ef0787bc2947c8e3ca432b513956bNicolas Geoffray// Some x86_64 instructions require a register to be available as temp. 34ee3cf0731d0ef0787bc2947c8e3ca432b513956bNicolas Geoffraystatic constexpr Register TMP = R11; 35ee3cf0731d0ef0787bc2947c8e3ca432b513956bNicolas Geoffray 369cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffraystatic constexpr Register kParameterCoreRegisters[] = { RSI, RDX, RCX, R8, R9 }; 377fb49da8ec62e8a10ed9419ade9f32c6b1174687Nicolas Geoffraystatic constexpr FloatRegister kParameterFloatRegisters[] = 387fb49da8ec62e8a10ed9419ade9f32c6b1174687Nicolas Geoffray { XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7 }; 399cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 409cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffraystatic constexpr size_t kParameterCoreRegistersLength = arraysize(kParameterCoreRegisters); 417fb49da8ec62e8a10ed9419ade9f32c6b1174687Nicolas Geoffraystatic constexpr size_t kParameterFloatRegistersLength = arraysize(kParameterFloatRegisters); 429cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 43848f70a3d73833fc1bf3032a9ff6812e429661d9Jeff Haostatic constexpr Register kRuntimeParameterCoreRegisters[] = { RDI, RSI, RDX, RCX }; 44d75948ac93a4a317feaf136cae78823071234ba5Nicolas Geoffraystatic constexpr size_t kRuntimeParameterCoreRegistersLength = 45d75948ac93a4a317feaf136cae78823071234ba5Nicolas Geoffray arraysize(kRuntimeParameterCoreRegisters); 46d75948ac93a4a317feaf136cae78823071234ba5Nicolas Geoffraystatic constexpr FloatRegister kRuntimeParameterFpuRegisters[] = { XMM0, XMM1 }; 47d75948ac93a4a317feaf136cae78823071234ba5Nicolas Geoffraystatic constexpr size_t kRuntimeParameterFpuRegistersLength = 48d75948ac93a4a317feaf136cae78823071234ba5Nicolas Geoffray arraysize(kRuntimeParameterFpuRegisters); 49d75948ac93a4a317feaf136cae78823071234ba5Nicolas Geoffray 50d75948ac93a4a317feaf136cae78823071234ba5Nicolas Geoffrayclass InvokeRuntimeCallingConvention : public CallingConvention<Register, FloatRegister> { 51d75948ac93a4a317feaf136cae78823071234ba5Nicolas Geoffray public: 52d75948ac93a4a317feaf136cae78823071234ba5Nicolas Geoffray InvokeRuntimeCallingConvention() 53d75948ac93a4a317feaf136cae78823071234ba5Nicolas Geoffray : CallingConvention(kRuntimeParameterCoreRegisters, 54d75948ac93a4a317feaf136cae78823071234ba5Nicolas Geoffray kRuntimeParameterCoreRegistersLength, 55d75948ac93a4a317feaf136cae78823071234ba5Nicolas Geoffray kRuntimeParameterFpuRegisters, 56e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier kRuntimeParameterFpuRegistersLength, 57e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier kX86_64PointerSize) {} 58d75948ac93a4a317feaf136cae78823071234ba5Nicolas Geoffray 59d75948ac93a4a317feaf136cae78823071234ba5Nicolas Geoffray private: 60d75948ac93a4a317feaf136cae78823071234ba5Nicolas Geoffray DISALLOW_COPY_AND_ASSIGN(InvokeRuntimeCallingConvention); 61d75948ac93a4a317feaf136cae78823071234ba5Nicolas Geoffray}; 62d75948ac93a4a317feaf136cae78823071234ba5Nicolas Geoffray 637fb49da8ec62e8a10ed9419ade9f32c6b1174687Nicolas Geoffrayclass InvokeDexCallingConvention : public CallingConvention<Register, FloatRegister> { 649cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray public: 657fb49da8ec62e8a10ed9419ade9f32c6b1174687Nicolas Geoffray InvokeDexCallingConvention() : CallingConvention( 667fb49da8ec62e8a10ed9419ade9f32c6b1174687Nicolas Geoffray kParameterCoreRegisters, 677fb49da8ec62e8a10ed9419ade9f32c6b1174687Nicolas Geoffray kParameterCoreRegistersLength, 687fb49da8ec62e8a10ed9419ade9f32c6b1174687Nicolas Geoffray kParameterFloatRegisters, 69e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier kParameterFloatRegistersLength, 70e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier kX86_64PointerSize) {} 719cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 729cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray private: 739cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray DISALLOW_COPY_AND_ASSIGN(InvokeDexCallingConvention); 749cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray}; 759cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 76e460d1df1f789c7c8bb97024a8efbd713ac175e9Calin Juravleclass FieldAccessCallingConventionX86_64 : public FieldAccessCallingConvention { 77e460d1df1f789c7c8bb97024a8efbd713ac175e9Calin Juravle public: 78e460d1df1f789c7c8bb97024a8efbd713ac175e9Calin Juravle FieldAccessCallingConventionX86_64() {} 79e460d1df1f789c7c8bb97024a8efbd713ac175e9Calin Juravle 80e460d1df1f789c7c8bb97024a8efbd713ac175e9Calin Juravle Location GetObjectLocation() const OVERRIDE { 81e460d1df1f789c7c8bb97024a8efbd713ac175e9Calin Juravle return Location::RegisterLocation(RSI); 82e460d1df1f789c7c8bb97024a8efbd713ac175e9Calin Juravle } 83e460d1df1f789c7c8bb97024a8efbd713ac175e9Calin Juravle Location GetFieldIndexLocation() const OVERRIDE { 84e460d1df1f789c7c8bb97024a8efbd713ac175e9Calin Juravle return Location::RegisterLocation(RDI); 85e460d1df1f789c7c8bb97024a8efbd713ac175e9Calin Juravle } 86e460d1df1f789c7c8bb97024a8efbd713ac175e9Calin Juravle Location GetReturnLocation(Primitive::Type type ATTRIBUTE_UNUSED) const OVERRIDE { 87e460d1df1f789c7c8bb97024a8efbd713ac175e9Calin Juravle return Location::RegisterLocation(RAX); 88e460d1df1f789c7c8bb97024a8efbd713ac175e9Calin Juravle } 89e460d1df1f789c7c8bb97024a8efbd713ac175e9Calin Juravle Location GetSetValueLocation(Primitive::Type type, bool is_instance) const OVERRIDE { 90e460d1df1f789c7c8bb97024a8efbd713ac175e9Calin Juravle return Primitive::Is64BitType(type) 91e460d1df1f789c7c8bb97024a8efbd713ac175e9Calin Juravle ? Location::RegisterLocation(RDX) 92e460d1df1f789c7c8bb97024a8efbd713ac175e9Calin Juravle : (is_instance 93e460d1df1f789c7c8bb97024a8efbd713ac175e9Calin Juravle ? Location::RegisterLocation(RDX) 94e460d1df1f789c7c8bb97024a8efbd713ac175e9Calin Juravle : Location::RegisterLocation(RSI)); 95e460d1df1f789c7c8bb97024a8efbd713ac175e9Calin Juravle } 96e460d1df1f789c7c8bb97024a8efbd713ac175e9Calin Juravle Location GetFpuLocation(Primitive::Type type ATTRIBUTE_UNUSED) const OVERRIDE { 97e460d1df1f789c7c8bb97024a8efbd713ac175e9Calin Juravle return Location::FpuRegisterLocation(XMM0); 98e460d1df1f789c7c8bb97024a8efbd713ac175e9Calin Juravle } 99e460d1df1f789c7c8bb97024a8efbd713ac175e9Calin Juravle 100e460d1df1f789c7c8bb97024a8efbd713ac175e9Calin Juravle private: 101e460d1df1f789c7c8bb97024a8efbd713ac175e9Calin Juravle DISALLOW_COPY_AND_ASSIGN(FieldAccessCallingConventionX86_64); 102e460d1df1f789c7c8bb97024a8efbd713ac175e9Calin Juravle}; 103e460d1df1f789c7c8bb97024a8efbd713ac175e9Calin Juravle 104e460d1df1f789c7c8bb97024a8efbd713ac175e9Calin Juravle 1052d27c8e338af7262dbd4aaa66127bb8fa1758b86Roland Levillainclass InvokeDexCallingConventionVisitorX86_64 : public InvokeDexCallingConventionVisitor { 1069cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray public: 1072d27c8e338af7262dbd4aaa66127bb8fa1758b86Roland Levillain InvokeDexCallingConventionVisitorX86_64() {} 1082d27c8e338af7262dbd4aaa66127bb8fa1758b86Roland Levillain virtual ~InvokeDexCallingConventionVisitorX86_64() {} 1099cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 1102d27c8e338af7262dbd4aaa66127bb8fa1758b86Roland Levillain Location GetNextLocation(Primitive::Type type) OVERRIDE; 111fd88f16100cceafbfde1b4f095f17e89444d6fa8Nicolas Geoffray Location GetReturnLocation(Primitive::Type type) const OVERRIDE; 112fd88f16100cceafbfde1b4f095f17e89444d6fa8Nicolas Geoffray Location GetMethodLocation() const OVERRIDE; 1139cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 1149cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray private: 1159cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray InvokeDexCallingConvention calling_convention; 1162d27c8e338af7262dbd4aaa66127bb8fa1758b86Roland Levillain 1172d27c8e338af7262dbd4aaa66127bb8fa1758b86Roland Levillain DISALLOW_COPY_AND_ASSIGN(InvokeDexCallingConventionVisitorX86_64); 1189cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray}; 1199cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 1209cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffrayclass CodeGeneratorX86_64; 12171fb52fee246b7d511f520febbd73dc7a9bbca79Andreas Gampe 122ad4450e5c3ffaa9566216cc6fafbf5c11186c467Zheng Xuclass ParallelMoveResolverX86_64 : public ParallelMoveResolverWithSwap { 123ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray public: 124ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray ParallelMoveResolverX86_64(ArenaAllocator* allocator, CodeGeneratorX86_64* codegen) 125ad4450e5c3ffaa9566216cc6fafbf5c11186c467Zheng Xu : ParallelMoveResolverWithSwap(allocator), codegen_(codegen) {} 126ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray 127de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray void EmitMove(size_t index) OVERRIDE; 128de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray void EmitSwap(size_t index) OVERRIDE; 129de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray void SpillScratch(int reg) OVERRIDE; 130de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray void RestoreScratch(int reg) OVERRIDE; 131ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray 132ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray X86_64Assembler* GetAssembler() const; 133ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray 134ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray private: 135412f10cfed002ab617c78f2621d68446ca4dd8bdNicolas Geoffray void Exchange32(CpuRegister reg, int mem); 136102cbed1e52b7c5f09458b44903fe97bb3e14d5fNicolas Geoffray void Exchange32(XmmRegister reg, int mem); 137412f10cfed002ab617c78f2621d68446ca4dd8bdNicolas Geoffray void Exchange32(int mem1, int mem2); 138412f10cfed002ab617c78f2621d68446ca4dd8bdNicolas Geoffray void Exchange64(CpuRegister reg, int mem); 139102cbed1e52b7c5f09458b44903fe97bb3e14d5fNicolas Geoffray void Exchange64(XmmRegister reg, int mem); 140412f10cfed002ab617c78f2621d68446ca4dd8bdNicolas Geoffray void Exchange64(int mem1, int mem2); 141ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray 142ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray CodeGeneratorX86_64* const codegen_; 143ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray 144ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray DISALLOW_COPY_AND_ASSIGN(ParallelMoveResolverX86_64); 145ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray}; 146ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray 1479cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffrayclass LocationsBuilderX86_64 : public HGraphVisitor { 1489cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray public: 1499cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray LocationsBuilderX86_64(HGraph* graph, CodeGeneratorX86_64* codegen) 1509cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray : HGraphVisitor(graph), codegen_(codegen) {} 1519cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 152360231a056e796c36ffe62348507e904dc9efb9bNicolas Geoffray#define DECLARE_VISIT_INSTRUCTION(name, super) \ 153de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray void Visit##name(H##name* instr) OVERRIDE; 1549cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 155ef20f71e16f035a39a329c8524d7e59ca6a11f04Alexandre Rames FOR_EACH_CONCRETE_INSTRUCTION_COMMON(DECLARE_VISIT_INSTRUCTION) 156ef20f71e16f035a39a329c8524d7e59ca6a11f04Alexandre Rames FOR_EACH_CONCRETE_INSTRUCTION_X86_64(DECLARE_VISIT_INSTRUCTION) 1579cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 1589cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray#undef DECLARE_VISIT_INSTRUCTION 1599cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 160ef20f71e16f035a39a329c8524d7e59ca6a11f04Alexandre Rames void VisitInstruction(HInstruction* instruction) OVERRIDE { 161ef20f71e16f035a39a329c8524d7e59ca6a11f04Alexandre Rames LOG(FATAL) << "Unreachable instruction " << instruction->DebugName() 162ef20f71e16f035a39a329c8524d7e59ca6a11f04Alexandre Rames << " (id " << instruction->GetId() << ")"; 163ef20f71e16f035a39a329c8524d7e59ca6a11f04Alexandre Rames } 164ef20f71e16f035a39a329c8524d7e59ca6a11f04Alexandre Rames 1659574c4b5f5ef039d694ac12c97e25ca02eca83c0Nicolas Geoffray private: 166e982f0b8e809cece6f460fa2d8df25873aa69de4Nicolas Geoffray void HandleInvoke(HInvoke* invoke); 1679574c4b5f5ef039d694ac12c97e25ca02eca83c0Nicolas Geoffray void HandleBitwiseOperation(HBinaryOperation* operation); 1689aec02fc5df5518c16f1e5a9b6cb198a192db973Calin Juravle void HandleShift(HBinaryOperation* operation); 16952c489645b6e9ae33623f1ec24143cde5444906eCalin Juravle void HandleFieldSet(HInstruction* instruction, const FieldInfo& field_info); 17052c489645b6e9ae33623f1ec24143cde5444906eCalin Juravle void HandleFieldGet(HInstruction* instruction); 171e982f0b8e809cece6f460fa2d8df25873aa69de4Nicolas Geoffray 1729cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray CodeGeneratorX86_64* const codegen_; 1732d27c8e338af7262dbd4aaa66127bb8fa1758b86Roland Levillain InvokeDexCallingConventionVisitorX86_64 parameter_visitor_; 1749cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 1759cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray DISALLOW_COPY_AND_ASSIGN(LocationsBuilderX86_64); 1769cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray}; 1779cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 1789cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffrayclass InstructionCodeGeneratorX86_64 : public HGraphVisitor { 1799cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray public: 1809cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray InstructionCodeGeneratorX86_64(HGraph* graph, CodeGeneratorX86_64* codegen); 1819cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 182360231a056e796c36ffe62348507e904dc9efb9bNicolas Geoffray#define DECLARE_VISIT_INSTRUCTION(name, super) \ 183de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray void Visit##name(H##name* instr) OVERRIDE; 1849cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 185ef20f71e16f035a39a329c8524d7e59ca6a11f04Alexandre Rames FOR_EACH_CONCRETE_INSTRUCTION_COMMON(DECLARE_VISIT_INSTRUCTION) 186ef20f71e16f035a39a329c8524d7e59ca6a11f04Alexandre Rames FOR_EACH_CONCRETE_INSTRUCTION_X86_64(DECLARE_VISIT_INSTRUCTION) 1879cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 1889cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray#undef DECLARE_VISIT_INSTRUCTION 1899cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 190ef20f71e16f035a39a329c8524d7e59ca6a11f04Alexandre Rames void VisitInstruction(HInstruction* instruction) OVERRIDE { 191ef20f71e16f035a39a329c8524d7e59ca6a11f04Alexandre Rames LOG(FATAL) << "Unreachable instruction " << instruction->DebugName() 192ef20f71e16f035a39a329c8524d7e59ca6a11f04Alexandre Rames << " (id " << instruction->GetId() << ")"; 193ef20f71e16f035a39a329c8524d7e59ca6a11f04Alexandre Rames } 194ef20f71e16f035a39a329c8524d7e59ca6a11f04Alexandre Rames 1959cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray X86_64Assembler* GetAssembler() const { return assembler_; } 1969cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 1979cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray private: 1983c04974a90b0e03f4b509010bff49f0b2a3da57fNicolas Geoffray // Generate code for the given suspend check. If not null, `successor` 1993c04974a90b0e03f4b509010bff49f0b2a3da57fNicolas Geoffray // is the block to branch to if the suspend check is not needed, and after 2003c04974a90b0e03f4b509010bff49f0b2a3da57fNicolas Geoffray // the suspend call. 2013c04974a90b0e03f4b509010bff49f0b2a3da57fNicolas Geoffray void GenerateSuspendCheck(HSuspendCheck* instruction, HBasicBlock* successor); 20285b62f23fc6dfffe2ddd3ddfa74611666c9ff41dAndreas Gampe void GenerateClassInitializationCheck(SlowPathCode* slow_path, CpuRegister class_reg); 2039574c4b5f5ef039d694ac12c97e25ca02eca83c0Nicolas Geoffray void HandleBitwiseOperation(HBinaryOperation* operation); 204c470193cfc522fc818eb2eaab896aef9caf0c75aMark Mendell void GenerateRemFP(HRem* rem); 2050f88e87085b7cf6544dadff3f555773966a6853eGuillaume Sanchez void DivRemOneOrMinusOne(HBinaryOperation* instruction); 206b19930c5cba3cf662dce5ee057fcc9829b4cbb9cGuillaume Sanchez void DivByPowerOfTwo(HDiv* instruction); 2070f88e87085b7cf6544dadff3f555773966a6853eGuillaume Sanchez void GenerateDivRemWithAnyConstant(HBinaryOperation* instruction); 208bacfec30ee9f2f6fdfd190f11b105b609938efcaCalin Juravle void GenerateDivRemIntegral(HBinaryOperation* instruction); 2099aec02fc5df5518c16f1e5a9b6cb198a192db973Calin Juravle void HandleShift(HBinaryOperation* operation); 21052c489645b6e9ae33623f1ec24143cde5444906eCalin Juravle void GenerateMemoryBarrier(MemBarrierKind kind); 21107276db28d654594e0e86e9e467cad393f752e6eNicolas Geoffray void HandleFieldSet(HInstruction* instruction, 21207276db28d654594e0e86e9e467cad393f752e6eNicolas Geoffray const FieldInfo& field_info, 21307276db28d654594e0e86e9e467cad393f752e6eNicolas Geoffray bool value_can_be_null); 21452c489645b6e9ae33623f1ec24143cde5444906eCalin Juravle void HandleFieldGet(HInstruction* instruction, const FieldInfo& field_info); 215cd6dffedf1bd8e6dfb3fb0c933551f9a90f7de3fCalin Juravle void GenerateImplicitNullCheck(HNullCheck* instruction); 216cd6dffedf1bd8e6dfb3fb0c933551f9a90f7de3fCalin Juravle void GenerateExplicitNullCheck(HNullCheck* instruction); 21724f2dfae084b2382c053f5d688fd6bb26cb8a328Mark Mendell void PushOntoFPStack(Location source, uint32_t temp_offset, 21824f2dfae084b2382c053f5d688fd6bb26cb8a328Mark Mendell uint32_t stack_adjustment, bool is_float); 219d43b3ac88cd46b8815890188c9c2b9a3f1564648Mingyao Yang void GenerateTestAndBranch(HInstruction* instruction, 220d43b3ac88cd46b8815890188c9c2b9a3f1564648Mingyao Yang Label* true_target, 221d43b3ac88cd46b8815890188c9c2b9a3f1564648Mingyao Yang Label* false_target, 222d43b3ac88cd46b8815890188c9c2b9a3f1564648Mingyao Yang Label* always_true_target); 223c470193cfc522fc818eb2eaab896aef9caf0c75aMark Mendell void GenerateCompareTestAndBranch(HIf* if_inst, 224c470193cfc522fc818eb2eaab896aef9caf0c75aMark Mendell HCondition* condition, 225c470193cfc522fc818eb2eaab896aef9caf0c75aMark Mendell Label* true_target, 226c470193cfc522fc818eb2eaab896aef9caf0c75aMark Mendell Label* false_target, 227c470193cfc522fc818eb2eaab896aef9caf0c75aMark Mendell Label* always_true_target); 228c470193cfc522fc818eb2eaab896aef9caf0c75aMark Mendell void GenerateFPJumps(HCondition* cond, Label* true_label, Label* false_label); 229fc6a86ab2b70781e72b807c1798b83829ca7f931David Brazdil void HandleGoto(HInstruction* got, HBasicBlock* successor); 2303c04974a90b0e03f4b509010bff49f0b2a3da57fNicolas Geoffray 2319cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray X86_64Assembler* const assembler_; 2329cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray CodeGeneratorX86_64* const codegen_; 2339cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 2349cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray DISALLOW_COPY_AND_ASSIGN(InstructionCodeGeneratorX86_64); 2359cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray}; 2369cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 2379c86b485bc6169eadf846dd5f7cdf0958fe1eb23Mark Mendell// Class for fixups to jump tables. 2389c86b485bc6169eadf846dd5f7cdf0958fe1eb23Mark Mendellclass JumpTableRIPFixup; 2399c86b485bc6169eadf846dd5f7cdf0958fe1eb23Mark Mendell 2409cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffrayclass CodeGeneratorX86_64 : public CodeGenerator { 2419cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray public: 242fb8d279bc011b31d0765dc7ca59afea324fd0d0cMark Mendell CodeGeneratorX86_64(HGraph* graph, 243fb8d279bc011b31d0765dc7ca59afea324fd0d0cMark Mendell const X86_64InstructionSetFeatures& isa_features, 244ecc4366670e12b4812ef1653f7c8d52234ca1b1fSerban Constantinescu const CompilerOptions& compiler_options, 245ecc4366670e12b4812ef1653f7c8d52234ca1b1fSerban Constantinescu OptimizingCompilerStats* stats = nullptr); 2469cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray virtual ~CodeGeneratorX86_64() {} 2479cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 248de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray void GenerateFrameEntry() OVERRIDE; 249de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray void GenerateFrameExit() OVERRIDE; 250de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray void Bind(HBasicBlock* block) OVERRIDE; 251de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray void Move(HInstruction* instruction, Location location, HInstruction* move_for) OVERRIDE; 252175dc732c80e6f2afd83209348124df349290ba8Calin Juravle void MoveConstant(Location destination, int32_t value) OVERRIDE; 253e460d1df1f789c7c8bb97024a8efbd713ac175e9Calin Juravle void MoveLocation(Location dst, Location src, Primitive::Type dst_type) OVERRIDE; 254e460d1df1f789c7c8bb97024a8efbd713ac175e9Calin Juravle void AddLocationAsTemp(Location location, LocationSummary* locations) OVERRIDE; 255e460d1df1f789c7c8bb97024a8efbd713ac175e9Calin Juravle 256de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray size_t SaveCoreRegister(size_t stack_index, uint32_t reg_id) OVERRIDE; 257de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray size_t RestoreCoreRegister(size_t stack_index, uint32_t reg_id) OVERRIDE; 258de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray size_t SaveFloatingPointRegister(size_t stack_index, uint32_t reg_id) OVERRIDE; 259de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray size_t RestoreFloatingPointRegister(size_t stack_index, uint32_t reg_id) OVERRIDE; 2609cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 2618158f28b6689314213eb4dbbe14166073be71f7eAlexandre Rames // Generate code to invoke a runtime entry point. 262175dc732c80e6f2afd83209348124df349290ba8Calin Juravle void InvokeRuntime(QuickEntrypointEnum entrypoint, 263175dc732c80e6f2afd83209348124df349290ba8Calin Juravle HInstruction* instruction, 264175dc732c80e6f2afd83209348124df349290ba8Calin Juravle uint32_t dex_pc, 265175dc732c80e6f2afd83209348124df349290ba8Calin Juravle SlowPathCode* slow_path) OVERRIDE; 266175dc732c80e6f2afd83209348124df349290ba8Calin Juravle 267175dc732c80e6f2afd83209348124df349290ba8Calin Juravle void InvokeRuntime(int32_t entry_point_offset, 2688158f28b6689314213eb4dbbe14166073be71f7eAlexandre Rames HInstruction* instruction, 2698158f28b6689314213eb4dbbe14166073be71f7eAlexandre Rames uint32_t dex_pc, 2708158f28b6689314213eb4dbbe14166073be71f7eAlexandre Rames SlowPathCode* slow_path); 2718158f28b6689314213eb4dbbe14166073be71f7eAlexandre Rames 272de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray size_t GetWordSize() const OVERRIDE { 2739cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray return kX86_64WordSize; 2749cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray } 2759cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 276f85a9ca9859ad843dc03d3a2b600afbaf2e9bbddMark Mendell size_t GetFloatingPointSpillSlotSize() const OVERRIDE { 277f85a9ca9859ad843dc03d3a2b600afbaf2e9bbddMark Mendell return kX86_64WordSize; 278f85a9ca9859ad843dc03d3a2b600afbaf2e9bbddMark Mendell } 279f85a9ca9859ad843dc03d3a2b600afbaf2e9bbddMark Mendell 280de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray HGraphVisitor* GetLocationBuilder() OVERRIDE { 2819cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray return &location_builder_; 2829cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray } 2839cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 284de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray HGraphVisitor* GetInstructionVisitor() OVERRIDE { 2859cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray return &instruction_visitor_; 2869cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray } 2879cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 288de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray X86_64Assembler* GetAssembler() OVERRIDE { 2899cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray return &assembler_; 2909cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray } 2919cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 292eb7b7399dbdb5e471b8ae00a567bf4f19edd3907Alexandre Rames const X86_64Assembler& GetAssembler() const OVERRIDE { 293eb7b7399dbdb5e471b8ae00a567bf4f19edd3907Alexandre Rames return assembler_; 294eb7b7399dbdb5e471b8ae00a567bf4f19edd3907Alexandre Rames } 295eb7b7399dbdb5e471b8ae00a567bf4f19edd3907Alexandre Rames 296f0e3937b87453234d0d7970b8712082062709b8dNicolas Geoffray ParallelMoveResolverX86_64* GetMoveResolver() OVERRIDE { 297ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray return &move_resolver_; 298ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray } 299ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray 300de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray uintptr_t GetAddressOf(HBasicBlock* block) const OVERRIDE { 301de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray return GetLabelOf(block)->Position(); 302de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray } 303de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray 304de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray Location GetStackLocation(HLoadLocal* load) const OVERRIDE; 3059cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 306988939683c26c0b1c8808fc206add6337319509aNicolas Geoffray void SetupBlockedRegisters(bool is_baseline) const OVERRIDE; 307de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray Location AllocateFreeRegister(Primitive::Type type) const OVERRIDE; 308de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray void DumpCoreRegister(std::ostream& stream, int reg) const OVERRIDE; 309de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray void DumpFloatingPointRegister(std::ostream& stream, int reg) const OVERRIDE; 310f55c3e0825cdfc4c5a27730031177d1a0198ec5aMark Mendell void Finalize(CodeAllocator* allocator) OVERRIDE; 3119cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 312de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray InstructionSet GetInstructionSet() const OVERRIDE { 313412f10cfed002ab617c78f2621d68446ca4dd8bdNicolas Geoffray return InstructionSet::kX86_64; 314412f10cfed002ab617c78f2621d68446ca4dd8bdNicolas Geoffray } 315412f10cfed002ab617c78f2621d68446ca4dd8bdNicolas Geoffray 3163c7bb98698f77af10372cf31824d3bb115d9bf0fNicolas Geoffray // Emit a write barrier. 31707276db28d654594e0e86e9e467cad393f752e6eNicolas Geoffray void MarkGCCard(CpuRegister temp, 31807276db28d654594e0e86e9e467cad393f752e6eNicolas Geoffray CpuRegister card, 31907276db28d654594e0e86e9e467cad393f752e6eNicolas Geoffray CpuRegister object, 32007276db28d654594e0e86e9e467cad393f752e6eNicolas Geoffray CpuRegister value, 32107276db28d654594e0e86e9e467cad393f752e6eNicolas Geoffray bool value_can_be_null); 3223c7bb98698f77af10372cf31824d3bb115d9bf0fNicolas Geoffray 3239cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray // Helper method to move a value between two locations. 3249cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray void Move(Location destination, Location source); 3259cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 32692a73aef279be78e3c2b04db1713076183933436Nicolas Geoffray Label* GetLabelOf(HBasicBlock* block) const { 327225b6464a58ebe11c156144653f11a1c6607f4ebVladimir Marko return CommonGetLabelOf<Label>(block_labels_, block); 32892a73aef279be78e3c2b04db1713076183933436Nicolas Geoffray } 32992a73aef279be78e3c2b04db1713076183933436Nicolas Geoffray 330de58ab2c03ff8112b07ab827c8fa38f670dfc656Nicolas Geoffray void Initialize() OVERRIDE { 331225b6464a58ebe11c156144653f11a1c6607f4ebVladimir Marko block_labels_ = CommonInitializeLabels<Label>(); 33292a73aef279be78e3c2b04db1713076183933436Nicolas Geoffray } 33392a73aef279be78e3c2b04db1713076183933436Nicolas Geoffray 334840e5461a85f8908f51e7f6cd562a9129ff0e7ceNicolas Geoffray bool NeedsTwoRegisters(Primitive::Type type ATTRIBUTE_UNUSED) const OVERRIDE { 335840e5461a85f8908f51e7f6cd562a9129ff0e7ceNicolas Geoffray return false; 336840e5461a85f8908f51e7f6cd562a9129ff0e7ceNicolas Geoffray } 337840e5461a85f8908f51e7f6cd562a9129ff0e7ceNicolas Geoffray 338dc151b2346bb8a4fdeed0c06e54c2fca21d59b5dVladimir Marko // Check if the desired_dispatch_info is supported. If it is, return it, 339dc151b2346bb8a4fdeed0c06e54c2fca21d59b5dVladimir Marko // otherwise return a fall-back info that should be used instead. 340dc151b2346bb8a4fdeed0c06e54c2fca21d59b5dVladimir Marko HInvokeStaticOrDirect::DispatchInfo GetSupportedInvokeStaticOrDirectDispatch( 341dc151b2346bb8a4fdeed0c06e54c2fca21d59b5dVladimir Marko const HInvokeStaticOrDirect::DispatchInfo& desired_dispatch_info, 342dc151b2346bb8a4fdeed0c06e54c2fca21d59b5dVladimir Marko MethodReference target_method) OVERRIDE; 343dc151b2346bb8a4fdeed0c06e54c2fca21d59b5dVladimir Marko 34485b62f23fc6dfffe2ddd3ddfa74611666c9ff41dAndreas Gampe void GenerateStaticOrDirectCall(HInvokeStaticOrDirect* invoke, Location temp) OVERRIDE; 34585b62f23fc6dfffe2ddd3ddfa74611666c9ff41dAndreas Gampe void GenerateVirtualCall(HInvokeVirtual* invoke, Location temp) OVERRIDE; 34685b62f23fc6dfffe2ddd3ddfa74611666c9ff41dAndreas Gampe 34785b62f23fc6dfffe2ddd3ddfa74611666c9ff41dAndreas Gampe void MoveFromReturnRegister(Location trg, Primitive::Type type) OVERRIDE; 34871fb52fee246b7d511f520febbd73dc7a9bbca79Andreas Gampe 349581550137ee3a068a14224870e71aeee924a0646Vladimir Marko void EmitLinkerPatches(ArenaVector<LinkerPatch>* linker_patches) OVERRIDE; 350581550137ee3a068a14224870e71aeee924a0646Vladimir Marko 351fb8d279bc011b31d0765dc7ca59afea324fd0d0cMark Mendell const X86_64InstructionSetFeatures& GetInstructionSetFeatures() const { 352fb8d279bc011b31d0765dc7ca59afea324fd0d0cMark Mendell return isa_features_; 353fb8d279bc011b31d0765dc7ca59afea324fd0d0cMark Mendell } 354fb8d279bc011b31d0765dc7ca59afea324fd0d0cMark Mendell 355f55c3e0825cdfc4c5a27730031177d1a0198ec5aMark Mendell int ConstantAreaStart() const { 356f55c3e0825cdfc4c5a27730031177d1a0198ec5aMark Mendell return constant_area_start_; 357f55c3e0825cdfc4c5a27730031177d1a0198ec5aMark Mendell } 358f55c3e0825cdfc4c5a27730031177d1a0198ec5aMark Mendell 359f55c3e0825cdfc4c5a27730031177d1a0198ec5aMark Mendell Address LiteralDoubleAddress(double v); 360f55c3e0825cdfc4c5a27730031177d1a0198ec5aMark Mendell Address LiteralFloatAddress(float v); 361f55c3e0825cdfc4c5a27730031177d1a0198ec5aMark Mendell Address LiteralInt32Address(int32_t v); 362f55c3e0825cdfc4c5a27730031177d1a0198ec5aMark Mendell Address LiteralInt64Address(int64_t v); 363f55c3e0825cdfc4c5a27730031177d1a0198ec5aMark Mendell 36492e83bf8c0b2df8c977ffbc527989631d94b1819Mark Mendell // Load a 64 bit value into a register in the most efficient manner. 36592e83bf8c0b2df8c977ffbc527989631d94b1819Mark Mendell void Load64BitValue(CpuRegister dest, int64_t value); 3669c86b485bc6169eadf846dd5f7cdf0958fe1eb23Mark Mendell Address LiteralCaseTable(HPackedSwitch* switch_instr); 36792e83bf8c0b2df8c977ffbc527989631d94b1819Mark Mendell 368cfa410b0ea561318f74a76c5323f0f6cd8eaaa50Mark Mendell // Store a 64 bit value into a DoubleStackSlot in the most efficient manner. 369cfa410b0ea561318f74a76c5323f0f6cd8eaaa50Mark Mendell void Store64BitValueToStack(Location dest, int64_t value); 370cfa410b0ea561318f74a76c5323f0f6cd8eaaa50Mark Mendell 371ea5af68d6dda832bdfb5978a0c5d6f86a3f67e80Mark Mendell // Assign a 64 bit constant to an address. 372ea5af68d6dda832bdfb5978a0c5d6f86a3f67e80Mark Mendell void MoveInt64ToAddress(const Address& addr_low, 373ea5af68d6dda832bdfb5978a0c5d6f86a3f67e80Mark Mendell const Address& addr_high, 374ea5af68d6dda832bdfb5978a0c5d6f86a3f67e80Mark Mendell int64_t v, 375ea5af68d6dda832bdfb5978a0c5d6f86a3f67e80Mark Mendell HInstruction* instruction); 376ea5af68d6dda832bdfb5978a0c5d6f86a3f67e80Mark Mendell 3773c7bb98698f77af10372cf31824d3bb115d9bf0fNicolas Geoffray private: 378581550137ee3a068a14224870e71aeee924a0646Vladimir Marko struct PcRelativeDexCacheAccessInfo { 379581550137ee3a068a14224870e71aeee924a0646Vladimir Marko PcRelativeDexCacheAccessInfo(const DexFile& dex_file, uint32_t element_off) 380581550137ee3a068a14224870e71aeee924a0646Vladimir Marko : target_dex_file(dex_file), element_offset(element_off), label() { } 381581550137ee3a068a14224870e71aeee924a0646Vladimir Marko 382581550137ee3a068a14224870e71aeee924a0646Vladimir Marko const DexFile& target_dex_file; 383581550137ee3a068a14224870e71aeee924a0646Vladimir Marko uint32_t element_offset; 384581550137ee3a068a14224870e71aeee924a0646Vladimir Marko Label label; 385581550137ee3a068a14224870e71aeee924a0646Vladimir Marko }; 386581550137ee3a068a14224870e71aeee924a0646Vladimir Marko 38792a73aef279be78e3c2b04db1713076183933436Nicolas Geoffray // Labels for each block that will be compiled. 388225b6464a58ebe11c156144653f11a1c6607f4ebVladimir Marko Label* block_labels_; // Indexed by block id. 3891cf95287364948689f6a1a320567acd7728e94a3Nicolas Geoffray Label frame_entry_label_; 3909cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray LocationsBuilderX86_64 location_builder_; 3919cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray InstructionCodeGeneratorX86_64 instruction_visitor_; 392ecb2f9ba57b08ceac4204ddd6a0a88a0524f8741Nicolas Geoffray ParallelMoveResolverX86_64 move_resolver_; 3939cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray X86_64Assembler assembler_; 394fb8d279bc011b31d0765dc7ca59afea324fd0d0cMark Mendell const X86_64InstructionSetFeatures& isa_features_; 3959cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 39639dcf55a56da746e04f477f89e7b00ba1de03880Mark Mendell // Offset to the start of the constant area in the assembled code. 397f55c3e0825cdfc4c5a27730031177d1a0198ec5aMark Mendell // Used for fixups to the constant area. 398f55c3e0825cdfc4c5a27730031177d1a0198ec5aMark Mendell int constant_area_start_; 399f55c3e0825cdfc4c5a27730031177d1a0198ec5aMark Mendell 400581550137ee3a068a14224870e71aeee924a0646Vladimir Marko // Method patch info. Using ArenaDeque<> which retains element addresses on push/emplace_back(). 401581550137ee3a068a14224870e71aeee924a0646Vladimir Marko ArenaDeque<MethodPatchInfo<Label>> method_patches_; 402581550137ee3a068a14224870e71aeee924a0646Vladimir Marko ArenaDeque<MethodPatchInfo<Label>> relative_call_patches_; 403581550137ee3a068a14224870e71aeee924a0646Vladimir Marko // PC-relative DexCache access info. 4040f7dca4ca0be8d2f8776794d35edf8b51b5bc997Vladimir Marko ArenaDeque<PcRelativeDexCacheAccessInfo> pc_relative_dex_cache_patches_; 405581550137ee3a068a14224870e71aeee924a0646Vladimir Marko 406581550137ee3a068a14224870e71aeee924a0646Vladimir Marko // When we don't know the proper offset for the value, we use kDummy32BitOffset. 407581550137ee3a068a14224870e71aeee924a0646Vladimir Marko // We will fix this up in the linker later to have the right value. 408581550137ee3a068a14224870e71aeee924a0646Vladimir Marko static constexpr int32_t kDummy32BitOffset = 256; 409581550137ee3a068a14224870e71aeee924a0646Vladimir Marko 4109c86b485bc6169eadf846dd5f7cdf0958fe1eb23Mark Mendell // Fixups for jump tables need to be handled specially. 4119c86b485bc6169eadf846dd5f7cdf0958fe1eb23Mark Mendell ArenaVector<JumpTableRIPFixup*> fixups_to_jump_tables_; 4129c86b485bc6169eadf846dd5f7cdf0958fe1eb23Mark Mendell 4139cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray DISALLOW_COPY_AND_ASSIGN(CodeGeneratorX86_64); 4149cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray}; 4159cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 4169cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray} // namespace x86_64 4179cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray} // namespace art 4189cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray 4199cf35523764d829ae0470dae2d5dd99be469c841Nicolas Geoffray#endif // ART_COMPILER_OPTIMIZING_CODE_GENERATOR_X86_64_H_ 420