summaryrefslogtreecommitdiffstats
path: root/compiler/optimizing/code_generator.h
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2015-02-16 11:15:43 +0000
committerNicolas Geoffray <ngeoffray@google.com>2015-02-18 09:53:32 +0000
commitdc23d8318db08cb42e20f1d16dbc416798951a8b (patch)
treee7a883bb3263ccb971898df98bc58700604c1d1d /compiler/optimizing/code_generator.h
parente5f5953e744060fde3b4489cea4d934d529e3e32 (diff)
downloadart-dc23d8318db08cb42e20f1d16dbc416798951a8b.zip
art-dc23d8318db08cb42e20f1d16dbc416798951a8b.tar.gz
art-dc23d8318db08cb42e20f1d16dbc416798951a8b.tar.bz2
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
Diffstat (limited to 'compiler/optimizing/code_generator.h')
-rw-r--r--compiler/optimizing/code_generator.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/optimizing/code_generator.h b/compiler/optimizing/code_generator.h
index efd0c84..6c78f10 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 <typename T>
+ 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_;