code_generator_x86.h revision 34bacdf7eb46c0ffbf24ba7aa14a904bc9176fb2
1d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray/*
2d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray * Copyright (C) 2014 The Android Open Source Project
3d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray *
4d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray * Licensed under the Apache License, Version 2.0 (the "License");
5d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray * you may not use this file except in compliance with the License.
6d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray * You may obtain a copy of the License at
7d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray *
8d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray *      http://www.apache.org/licenses/LICENSE-2.0
9d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray *
10d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray * Unless required by applicable law or agreed to in writing, software
11d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray * distributed under the License is distributed on an "AS IS" BASIS,
12d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray * See the License for the specific language governing permissions and
14d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray * limitations under the License.
15d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray */
16d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray
17d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray#ifndef ART_COMPILER_OPTIMIZING_CODE_GENERATOR_X86_H_
18d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray#define ART_COMPILER_OPTIMIZING_CODE_GENERATOR_X86_H_
19d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray
20d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray#include "code_generator.h"
21d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray#include "nodes.h"
2286dbb9a12119273039ce272b41c809fa548b37b6Nicolas Geoffray#include "parallel_move_resolver.h"
23787c3076635cf117eb646c5a89a9014b2072fb44Nicolas Geoffray#include "utils/x86/assembler_x86.h"
24d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray
25d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffraynamespace art {
26d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffraynamespace x86 {
27d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray
28707c809f661554713edfacf338365adca8dfd3a3Nicolas Geoffraystatic constexpr size_t kX86WordSize = 4;
29707c809f661554713edfacf338365adca8dfd3a3Nicolas Geoffray
3001bc96d007b67fdb7fe349232a83e4b354ce3d08Nicolas Geoffrayclass CodeGeneratorX86;
3101bc96d007b67fdb7fe349232a83e4b354ce3d08Nicolas Geoffray
32a747a392fb5f88d2ecc4c6021edf9f1f6615ba16Nicolas Geoffraystatic constexpr Register kParameterCoreRegisters[] = { ECX, EDX, EBX };
33a747a392fb5f88d2ecc4c6021edf9f1f6615ba16Nicolas Geoffraystatic constexpr RegisterPair kParameterCorePairRegisters[] = { ECX_EDX, EDX_EBX };
34a747a392fb5f88d2ecc4c6021edf9f1f6615ba16Nicolas Geoffraystatic constexpr size_t kParameterCoreRegistersLength = arraysize(kParameterCoreRegisters);
357fb49da8ec62e8a10ed9419ade9f32c6b1174687Nicolas Geoffraystatic constexpr XmmRegister kParameterFpuRegisters[] = { };
367fb49da8ec62e8a10ed9419ade9f32c6b1174687Nicolas Geoffraystatic constexpr size_t kParameterFpuRegistersLength = 0;
37a747a392fb5f88d2ecc4c6021edf9f1f6615ba16Nicolas Geoffray
387fb49da8ec62e8a10ed9419ade9f32c6b1174687Nicolas Geoffrayclass InvokeDexCallingConvention : public CallingConvention<Register, XmmRegister> {
39a747a392fb5f88d2ecc4c6021edf9f1f6615ba16Nicolas Geoffray public:
407fb49da8ec62e8a10ed9419ade9f32c6b1174687Nicolas Geoffray  InvokeDexCallingConvention() : CallingConvention(
417fb49da8ec62e8a10ed9419ade9f32c6b1174687Nicolas Geoffray      kParameterCoreRegisters,
427fb49da8ec62e8a10ed9419ade9f32c6b1174687Nicolas Geoffray      kParameterCoreRegistersLength,
437fb49da8ec62e8a10ed9419ade9f32c6b1174687Nicolas Geoffray      kParameterFpuRegisters,
447fb49da8ec62e8a10ed9419ade9f32c6b1174687Nicolas Geoffray      kParameterFpuRegistersLength) {}
45a747a392fb5f88d2ecc4c6021edf9f1f6615ba16Nicolas Geoffray
46a747a392fb5f88d2ecc4c6021edf9f1f6615ba16Nicolas Geoffray  RegisterPair GetRegisterPairAt(size_t argument_index) {
47a747a392fb5f88d2ecc4c6021edf9f1f6615ba16Nicolas Geoffray    DCHECK_LT(argument_index + 1, GetNumberOfRegisters());
48a747a392fb5f88d2ecc4c6021edf9f1f6615ba16Nicolas Geoffray    return kParameterCorePairRegisters[argument_index];
49a747a392fb5f88d2ecc4c6021edf9f1f6615ba16Nicolas Geoffray  }
50a747a392fb5f88d2ecc4c6021edf9f1f6615ba16Nicolas Geoffray
51a747a392fb5f88d2ecc4c6021edf9f1f6615ba16Nicolas Geoffray private:
52a747a392fb5f88d2ecc4c6021edf9f1f6615ba16Nicolas Geoffray  DISALLOW_COPY_AND_ASSIGN(InvokeDexCallingConvention);
53a747a392fb5f88d2ecc4c6021edf9f1f6615ba16Nicolas Geoffray};
54a747a392fb5f88d2ecc4c6021edf9f1f6615ba16Nicolas Geoffray
55a747a392fb5f88d2ecc4c6021edf9f1f6615ba16Nicolas Geoffrayclass InvokeDexCallingConventionVisitor {
56a747a392fb5f88d2ecc4c6021edf9f1f6615ba16Nicolas Geoffray public:
57a747a392fb5f88d2ecc4c6021edf9f1f6615ba16Nicolas Geoffray  InvokeDexCallingConventionVisitor() : gp_index_(0) {}
58a747a392fb5f88d2ecc4c6021edf9f1f6615ba16Nicolas Geoffray
59a747a392fb5f88d2ecc4c6021edf9f1f6615ba16Nicolas Geoffray  Location GetNextLocation(Primitive::Type type);
60a747a392fb5f88d2ecc4c6021edf9f1f6615ba16Nicolas Geoffray
61a747a392fb5f88d2ecc4c6021edf9f1f6615ba16Nicolas Geoffray private:
62a747a392fb5f88d2ecc4c6021edf9f1f6615ba16Nicolas Geoffray  InvokeDexCallingConvention calling_convention;
63a747a392fb5f88d2ecc4c6021edf9f1f6615ba16Nicolas Geoffray  uint32_t gp_index_;
64a747a392fb5f88d2ecc4c6021edf9f1f6615ba16Nicolas Geoffray
65a747a392fb5f88d2ecc4c6021edf9f1f6615ba16Nicolas Geoffray  DISALLOW_COPY_AND_ASSIGN(InvokeDexCallingConventionVisitor);
66a747a392fb5f88d2ecc4c6021edf9f1f6615ba16Nicolas Geoffray};
67a747a392fb5f88d2ecc4c6021edf9f1f6615ba16Nicolas Geoffray
6886dbb9a12119273039ce272b41c809fa548b37b6Nicolas Geoffrayclass ParallelMoveResolverX86 : public ParallelMoveResolver {
6986dbb9a12119273039ce272b41c809fa548b37b6Nicolas Geoffray public:
7086dbb9a12119273039ce272b41c809fa548b37b6Nicolas Geoffray  ParallelMoveResolverX86(ArenaAllocator* allocator, CodeGeneratorX86* codegen)
7186dbb9a12119273039ce272b41c809fa548b37b6Nicolas Geoffray      : ParallelMoveResolver(allocator), codegen_(codegen) {}
7286dbb9a12119273039ce272b41c809fa548b37b6Nicolas Geoffray
7386dbb9a12119273039ce272b41c809fa548b37b6Nicolas Geoffray  virtual void EmitMove(size_t index) OVERRIDE;
7486dbb9a12119273039ce272b41c809fa548b37b6Nicolas Geoffray  virtual void EmitSwap(size_t index) OVERRIDE;
7586dbb9a12119273039ce272b41c809fa548b37b6Nicolas Geoffray  virtual void SpillScratch(int reg) OVERRIDE;
7686dbb9a12119273039ce272b41c809fa548b37b6Nicolas Geoffray  virtual void RestoreScratch(int reg) OVERRIDE;
7786dbb9a12119273039ce272b41c809fa548b37b6Nicolas Geoffray
7886dbb9a12119273039ce272b41c809fa548b37b6Nicolas Geoffray  X86Assembler* GetAssembler() const;
7986dbb9a12119273039ce272b41c809fa548b37b6Nicolas Geoffray
8086dbb9a12119273039ce272b41c809fa548b37b6Nicolas Geoffray private:
8186dbb9a12119273039ce272b41c809fa548b37b6Nicolas Geoffray  void Exchange(Register reg, int mem);
8286dbb9a12119273039ce272b41c809fa548b37b6Nicolas Geoffray  void Exchange(int mem1, int mem2);
8386dbb9a12119273039ce272b41c809fa548b37b6Nicolas Geoffray  void MoveMemoryToMemory(int dst, int src);
8486dbb9a12119273039ce272b41c809fa548b37b6Nicolas Geoffray
8586dbb9a12119273039ce272b41c809fa548b37b6Nicolas Geoffray  CodeGeneratorX86* const codegen_;
8686dbb9a12119273039ce272b41c809fa548b37b6Nicolas Geoffray
8786dbb9a12119273039ce272b41c809fa548b37b6Nicolas Geoffray  DISALLOW_COPY_AND_ASSIGN(ParallelMoveResolverX86);
8886dbb9a12119273039ce272b41c809fa548b37b6Nicolas Geoffray};
8986dbb9a12119273039ce272b41c809fa548b37b6Nicolas Geoffray
90bab4ed7057799a4fadc6283108ab56f389d117d4Nicolas Geoffrayclass LocationsBuilderX86 : public HGraphVisitor {
91bab4ed7057799a4fadc6283108ab56f389d117d4Nicolas Geoffray public:
9201bc96d007b67fdb7fe349232a83e4b354ce3d08Nicolas Geoffray  LocationsBuilderX86(HGraph* graph, CodeGeneratorX86* codegen)
9301bc96d007b67fdb7fe349232a83e4b354ce3d08Nicolas Geoffray      : HGraphVisitor(graph), codegen_(codegen) {}
94bab4ed7057799a4fadc6283108ab56f389d117d4Nicolas Geoffray
95360231a056e796c36ffe62348507e904dc9efb9bNicolas Geoffray#define DECLARE_VISIT_INSTRUCTION(name, super)     \
96bab4ed7057799a4fadc6283108ab56f389d117d4Nicolas Geoffray  virtual void Visit##name(H##name* instr);
97bab4ed7057799a4fadc6283108ab56f389d117d4Nicolas Geoffray
9896f89a290eb67d7bf4b1636798fa28df14309cc7Nicolas Geoffray  FOR_EACH_CONCRETE_INSTRUCTION(DECLARE_VISIT_INSTRUCTION)
99bab4ed7057799a4fadc6283108ab56f389d117d4Nicolas Geoffray
100bab4ed7057799a4fadc6283108ab56f389d117d4Nicolas Geoffray#undef DECLARE_VISIT_INSTRUCTION
101bab4ed7057799a4fadc6283108ab56f389d117d4Nicolas Geoffray
102e982f0b8e809cece6f460fa2d8df25873aa69de4Nicolas Geoffray  void HandleInvoke(HInvoke* invoke);
103e982f0b8e809cece6f460fa2d8df25873aa69de4Nicolas Geoffray
104bab4ed7057799a4fadc6283108ab56f389d117d4Nicolas Geoffray private:
10501bc96d007b67fdb7fe349232a83e4b354ce3d08Nicolas Geoffray  CodeGeneratorX86* const codegen_;
106a747a392fb5f88d2ecc4c6021edf9f1f6615ba16Nicolas Geoffray  InvokeDexCallingConventionVisitor parameter_visitor_;
10701bc96d007b67fdb7fe349232a83e4b354ce3d08Nicolas Geoffray
108bab4ed7057799a4fadc6283108ab56f389d117d4Nicolas Geoffray  DISALLOW_COPY_AND_ASSIGN(LocationsBuilderX86);
109bab4ed7057799a4fadc6283108ab56f389d117d4Nicolas Geoffray};
110bab4ed7057799a4fadc6283108ab56f389d117d4Nicolas Geoffray
111787c3076635cf117eb646c5a89a9014b2072fb44Nicolas Geoffrayclass InstructionCodeGeneratorX86 : public HGraphVisitor {
112d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray public:
1134a34a428c6a2588e0857ef6baf88f1b73ce65958Nicolas Geoffray  InstructionCodeGeneratorX86(HGraph* graph, CodeGeneratorX86* codegen);
114d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray
115360231a056e796c36ffe62348507e904dc9efb9bNicolas Geoffray#define DECLARE_VISIT_INSTRUCTION(name, super)     \
116d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray  virtual void Visit##name(H##name* instr);
117d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray
11896f89a290eb67d7bf4b1636798fa28df14309cc7Nicolas Geoffray  FOR_EACH_CONCRETE_INSTRUCTION(DECLARE_VISIT_INSTRUCTION)
119d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray
120d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray#undef DECLARE_VISIT_INSTRUCTION
121d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray
1228ccc3f5d06fd217cdaabd37e743adab2031d3720Nicolas Geoffray  void LoadCurrentMethod(Register reg);
1238ccc3f5d06fd217cdaabd37e743adab2031d3720Nicolas Geoffray
1244a34a428c6a2588e0857ef6baf88f1b73ce65958Nicolas Geoffray  X86Assembler* GetAssembler() const { return assembler_; }
125787c3076635cf117eb646c5a89a9014b2072fb44Nicolas Geoffray
126787c3076635cf117eb646c5a89a9014b2072fb44Nicolas Geoffray private:
1273c04974a90b0e03f4b509010bff49f0b2a3da57fNicolas Geoffray  // Generate code for the given suspend check. If not null, `successor`
1283c04974a90b0e03f4b509010bff49f0b2a3da57fNicolas Geoffray  // is the block to branch to if the suspend check is not needed, and after
1293c04974a90b0e03f4b509010bff49f0b2a3da57fNicolas Geoffray  // the suspend call.
1303c04974a90b0e03f4b509010bff49f0b2a3da57fNicolas Geoffray  void GenerateSuspendCheck(HSuspendCheck* check, HBasicBlock* successor);
1313c04974a90b0e03f4b509010bff49f0b2a3da57fNicolas Geoffray
1324a34a428c6a2588e0857ef6baf88f1b73ce65958Nicolas Geoffray  X86Assembler* const assembler_;
1334a34a428c6a2588e0857ef6baf88f1b73ce65958Nicolas Geoffray  CodeGeneratorX86* const codegen_;
134787c3076635cf117eb646c5a89a9014b2072fb44Nicolas Geoffray
135787c3076635cf117eb646c5a89a9014b2072fb44Nicolas Geoffray  DISALLOW_COPY_AND_ASSIGN(InstructionCodeGeneratorX86);
136787c3076635cf117eb646c5a89a9014b2072fb44Nicolas Geoffray};
137787c3076635cf117eb646c5a89a9014b2072fb44Nicolas Geoffray
138787c3076635cf117eb646c5a89a9014b2072fb44Nicolas Geoffrayclass CodeGeneratorX86 : public CodeGenerator {
139787c3076635cf117eb646c5a89a9014b2072fb44Nicolas Geoffray public:
140a7aca370a7d62ca04a1e24423d90e8020d6f1a58Nicolas Geoffray  explicit CodeGeneratorX86(HGraph* graph);
141f12feb8e0e857f2832545b3f28d31bad5a9d3903Nicolas Geoffray  virtual ~CodeGeneratorX86() {}
142787c3076635cf117eb646c5a89a9014b2072fb44Nicolas Geoffray
143bab4ed7057799a4fadc6283108ab56f389d117d4Nicolas Geoffray  virtual void GenerateFrameEntry() OVERRIDE;
144bab4ed7057799a4fadc6283108ab56f389d117d4Nicolas Geoffray  virtual void GenerateFrameExit() OVERRIDE;
14592a73aef279be78e3c2b04db1713076183933436Nicolas Geoffray  virtual void Bind(HBasicBlock* block) OVERRIDE;
1464a34a428c6a2588e0857ef6baf88f1b73ce65958Nicolas Geoffray  virtual void Move(HInstruction* instruction, Location location, HInstruction* move_for) OVERRIDE;
1473bca0df855f0e575c6ee020ed016999fc8f14122Nicolas Geoffray  virtual void SaveCoreRegister(Location stack_location, uint32_t reg_id) OVERRIDE;
1483bca0df855f0e575c6ee020ed016999fc8f14122Nicolas Geoffray  virtual void RestoreCoreRegister(Location stack_location, uint32_t reg_id) OVERRIDE;
149bab4ed7057799a4fadc6283108ab56f389d117d4Nicolas Geoffray
150707c809f661554713edfacf338365adca8dfd3a3Nicolas Geoffray  virtual size_t GetWordSize() const OVERRIDE {
151707c809f661554713edfacf338365adca8dfd3a3Nicolas Geoffray    return kX86WordSize;
152707c809f661554713edfacf338365adca8dfd3a3Nicolas Geoffray  }
153707c809f661554713edfacf338365adca8dfd3a3Nicolas Geoffray
154ab032bc1ff57831106fdac6a91a136293609401fNicolas Geoffray  virtual size_t FrameEntrySpillSize() const OVERRIDE;
155ab032bc1ff57831106fdac6a91a136293609401fNicolas Geoffray
156bab4ed7057799a4fadc6283108ab56f389d117d4Nicolas Geoffray  virtual HGraphVisitor* GetLocationBuilder() OVERRIDE {
157bab4ed7057799a4fadc6283108ab56f389d117d4Nicolas Geoffray    return &location_builder_;
158bab4ed7057799a4fadc6283108ab56f389d117d4Nicolas Geoffray  }
159bab4ed7057799a4fadc6283108ab56f389d117d4Nicolas Geoffray
160787c3076635cf117eb646c5a89a9014b2072fb44Nicolas Geoffray  virtual HGraphVisitor* GetInstructionVisitor() OVERRIDE {
161787c3076635cf117eb646c5a89a9014b2072fb44Nicolas Geoffray    return &instruction_visitor_;
162787c3076635cf117eb646c5a89a9014b2072fb44Nicolas Geoffray  }
163787c3076635cf117eb646c5a89a9014b2072fb44Nicolas Geoffray
164787c3076635cf117eb646c5a89a9014b2072fb44Nicolas Geoffray  virtual X86Assembler* GetAssembler() OVERRIDE {
165787c3076635cf117eb646c5a89a9014b2072fb44Nicolas Geoffray    return &assembler_;
166787c3076635cf117eb646c5a89a9014b2072fb44Nicolas Geoffray  }
167787c3076635cf117eb646c5a89a9014b2072fb44Nicolas Geoffray
16871175b7f19a4f6cf9cc264feafd820dbafa371fbNicolas Geoffray  virtual void SetupBlockedRegisters() const OVERRIDE;
16934bacdf7eb46c0ffbf24ba7aa14a904bc9176fb2Calin Juravle
17071175b7f19a4f6cf9cc264feafd820dbafa371fbNicolas Geoffray  virtual Location AllocateFreeRegister(Primitive::Type type) const OVERRIDE;
171a7aca370a7d62ca04a1e24423d90e8020d6f1a58Nicolas Geoffray
172a7aca370a7d62ca04a1e24423d90e8020d6f1a58Nicolas Geoffray  virtual Location GetStackLocation(HLoadLocal* load) const OVERRIDE;
1734a34a428c6a2588e0857ef6baf88f1b73ce65958Nicolas Geoffray
174a7062e05e6048c7f817d784a5b94e3122e25b1ecNicolas Geoffray  virtual void DumpCoreRegister(std::ostream& stream, int reg) const OVERRIDE;
175a7062e05e6048c7f817d784a5b94e3122e25b1ecNicolas Geoffray  virtual void DumpFloatingPointRegister(std::ostream& stream, int reg) const OVERRIDE;
176a7062e05e6048c7f817d784a5b94e3122e25b1ecNicolas Geoffray
17734bacdf7eb46c0ffbf24ba7aa14a904bc9176fb2Calin Juravle  // Blocks all register pairs made out of blocked core registers.
17834bacdf7eb46c0ffbf24ba7aa14a904bc9176fb2Calin Juravle  void UpdateBlockedPairRegisters() const;
17934bacdf7eb46c0ffbf24ba7aa14a904bc9176fb2Calin Juravle
18086dbb9a12119273039ce272b41c809fa548b37b6Nicolas Geoffray  ParallelMoveResolverX86* GetMoveResolver() {
18186dbb9a12119273039ce272b41c809fa548b37b6Nicolas Geoffray    return &move_resolver_;
18286dbb9a12119273039ce272b41c809fa548b37b6Nicolas Geoffray  }
18386dbb9a12119273039ce272b41c809fa548b37b6Nicolas Geoffray
184412f10cfed002ab617c78f2621d68446ca4dd8bdNicolas Geoffray  virtual InstructionSet GetInstructionSet() const OVERRIDE {
185412f10cfed002ab617c78f2621d68446ca4dd8bdNicolas Geoffray    return InstructionSet::kX86;
186412f10cfed002ab617c78f2621d68446ca4dd8bdNicolas Geoffray  }
187412f10cfed002ab617c78f2621d68446ca4dd8bdNicolas Geoffray
18801bc96d007b67fdb7fe349232a83e4b354ce3d08Nicolas Geoffray  // Helper method to move a 32bits value between two locations.
18901bc96d007b67fdb7fe349232a83e4b354ce3d08Nicolas Geoffray  void Move32(Location destination, Location source);
19001bc96d007b67fdb7fe349232a83e4b354ce3d08Nicolas Geoffray  // Helper method to move a 64bits value between two locations.
19101bc96d007b67fdb7fe349232a83e4b354ce3d08Nicolas Geoffray  void Move64(Location destination, Location source);
19201bc96d007b67fdb7fe349232a83e4b354ce3d08Nicolas Geoffray
1933c7bb98698f77af10372cf31824d3bb115d9bf0fNicolas Geoffray  // Emit a write barrier.
1943c7bb98698f77af10372cf31824d3bb115d9bf0fNicolas Geoffray  void MarkGCCard(Register temp, Register card, Register object, Register value);
1953c7bb98698f77af10372cf31824d3bb115d9bf0fNicolas Geoffray
19692a73aef279be78e3c2b04db1713076183933436Nicolas Geoffray  Label* GetLabelOf(HBasicBlock* block) const {
19792a73aef279be78e3c2b04db1713076183933436Nicolas Geoffray    return block_labels_.GetRawStorage() + block->GetBlockId();
19892a73aef279be78e3c2b04db1713076183933436Nicolas Geoffray  }
19992a73aef279be78e3c2b04db1713076183933436Nicolas Geoffray
20092a73aef279be78e3c2b04db1713076183933436Nicolas Geoffray  virtual void Initialize() OVERRIDE {
20192a73aef279be78e3c2b04db1713076183933436Nicolas Geoffray    block_labels_.SetSize(GetGraph()->GetBlocks().Size());
20292a73aef279be78e3c2b04db1713076183933436Nicolas Geoffray  }
20392a73aef279be78e3c2b04db1713076183933436Nicolas Geoffray
2043c7bb98698f77af10372cf31824d3bb115d9bf0fNicolas Geoffray private:
20592a73aef279be78e3c2b04db1713076183933436Nicolas Geoffray  // Labels for each block that will be compiled.
20692a73aef279be78e3c2b04db1713076183933436Nicolas Geoffray  GrowableArray<Label> block_labels_;
207bab4ed7057799a4fadc6283108ab56f389d117d4Nicolas Geoffray  LocationsBuilderX86 location_builder_;
208787c3076635cf117eb646c5a89a9014b2072fb44Nicolas Geoffray  InstructionCodeGeneratorX86 instruction_visitor_;
20986dbb9a12119273039ce272b41c809fa548b37b6Nicolas Geoffray  ParallelMoveResolverX86 move_resolver_;
210787c3076635cf117eb646c5a89a9014b2072fb44Nicolas Geoffray  X86Assembler assembler_;
211d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray
212d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray  DISALLOW_COPY_AND_ASSIGN(CodeGeneratorX86);
213d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray};
214d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray
215d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray}  // namespace x86
216d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray}  // namespace art
217d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray
218d4dd255db1d110ceb5551f6d95ff31fb57420994Nicolas Geoffray#endif  // ART_COMPILER_OPTIMIZING_CODE_GENERATOR_X86_H_
219