From dc23d8318db08cb42e20f1d16dbc416798951a8b Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Mon, 16 Feb 2015 11:15:43 +0000 Subject: Avoid generating jmp +0. When a block branches to a non-following block, but blocks in-between do branch to it, we can avoid doing the branch. Change-Id: I9b343f662a4efc718cd4b58168f93162a24e1219 --- compiler/optimizing/code_generator.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'compiler/optimizing/code_generator.h') diff --git a/compiler/optimizing/code_generator.h b/compiler/optimizing/code_generator.h index efd0c84797..6c78f10500 100644 --- a/compiler/optimizing/code_generator.h +++ b/compiler/optimizing/code_generator.h @@ -91,6 +91,8 @@ class CodeGenerator { HGraph* GetGraph() const { return graph_; } + HBasicBlock* GetNextBlockToEmit() const; + HBasicBlock* FirstNonEmptyBlock(HBasicBlock* block) const; bool GoesToNextBlock(HBasicBlock* current, HBasicBlock* next) const; size_t GetStackSlotOfParameter(HParameterValue* parameter) const { @@ -314,6 +316,14 @@ class CodeGenerator { return GetFrameSize() == (CallPushesPC() ? GetWordSize() : 0); } + // Arm64 has its own type for a label, so we need to templatize this method + // to share the logic. + template + T* CommonGetLabelOf(T* raw_pointer_to_labels_array, HBasicBlock* block) const { + block = FirstNonEmptyBlock(block); + return raw_pointer_to_labels_array + block->GetBlockId(); + } + // Frame size required for this method. uint32_t frame_size_; uint32_t core_spill_mask_; -- cgit v1.2.3-59-g8ed1b