Use a different block order when not compiling baseline.
Use the linearized order instead, as it puts blocks logically
next to each other in a better way. Also, it does not contain
dead blocks.
Change-Id: Ie65b56041a093c8155e6c1e06351cb36a4053505
diff --git a/compiler/optimizing/code_generator.h b/compiler/optimizing/code_generator.h
index 45f02e5..ab63b91 100644
--- a/compiler/optimizing/code_generator.h
+++ b/compiler/optimizing/code_generator.h
@@ -113,10 +113,11 @@
virtual size_t GetWordSize() const = 0;
virtual size_t GetFloatingPointSpillSlotSize() const = 0;
virtual uintptr_t GetAddressOf(HBasicBlock* block) const = 0;
- void ComputeFrameSize(size_t number_of_spill_slots,
- size_t maximum_number_of_live_core_registers,
- size_t maximum_number_of_live_fp_registers,
- size_t number_of_out_slots);
+ void InitializeCodeGeneration(size_t number_of_spill_slots,
+ size_t maximum_number_of_live_core_registers,
+ size_t maximum_number_of_live_fp_registers,
+ size_t number_of_out_slots,
+ const GrowableArray<HBasicBlock*>& block_order);
int32_t GetStackSlot(HLocal* local) const;
Location GetTemporaryLocation(HTemporary* temp) const;
@@ -181,8 +182,6 @@
slow_paths_.Add(slow_path);
}
- void GenerateSlowPaths();
-
void BuildMappingTable(std::vector<uint8_t>* vector, DefaultSrcMap* src_map) const;
void BuildVMapTable(std::vector<uint8_t>* vector) const;
void BuildNativeGCMap(
@@ -253,6 +252,8 @@
compiler_options_(compiler_options),
pc_infos_(graph->GetArena(), 32),
slow_paths_(graph->GetArena(), 8),
+ block_order_(nullptr),
+ current_block_index_(0),
is_leaf_(true),
stack_map_stream_(graph->GetArena()) {}
@@ -312,6 +313,7 @@
private:
void InitLocations(HInstruction* instruction);
size_t GetStackOffsetOfSavedRegister(size_t index);
+ void CompileInternal(CodeAllocator* allocator, bool is_baseline);
HGraph* const graph_;
const CompilerOptions& compiler_options_;
@@ -319,6 +321,13 @@
GrowableArray<PcInfo> pc_infos_;
GrowableArray<SlowPathCode*> slow_paths_;
+ // The order to use for code generation.
+ const GrowableArray<HBasicBlock*>* block_order_;
+
+ // The current block index in `block_order_` of the block
+ // we are generating code for.
+ size_t current_block_index_;
+
bool is_leaf_;
StackMapStream stack_map_stream_;