diff options
author | Andreas Gampe <agampe@google.com> | 2014-07-11 16:40:54 -0700 |
---|---|---|
committer | Andreas Gampe <agampe@google.com> | 2014-07-11 16:47:08 -0700 |
commit | af263df7f643e699abf622c64447d31bacc14c34 (patch) | |
tree | 42f5ff7177b3bf30b0665eb11652dbd1a6031717 /compiler/dex/quick/local_optimizations.cc | |
parent | aebf3cda094f34cf846d19a7724bdc8005267c95 (diff) | |
download | art-af263df7f643e699abf622c64447d31bacc14c34.zip art-af263df7f643e699abf622c64447d31bacc14c34.tar.gz art-af263df7f643e699abf622c64447d31bacc14c34.tar.bz2 |
ART: Change GenPCUseDefEncoding(), turn on Load Hoisting for ARM64
This defines the PC resource mask as empty, as the PC is not
accessible on ARM64.
Unify code paths with x86 in LoadStoreElimination and LoadHoisting.
Change-Id: Iea8b9e666f306c7a6ff52b6c5bf7e05b35346b2c
Diffstat (limited to 'compiler/dex/quick/local_optimizations.cc')
-rw-r--r-- | compiler/dex/quick/local_optimizations.cc | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/compiler/dex/quick/local_optimizations.cc b/compiler/dex/quick/local_optimizations.cc index b97ff2a..2893157 100644 --- a/compiler/dex/quick/local_optimizations.cc +++ b/compiler/dex/quick/local_optimizations.cc @@ -121,20 +121,22 @@ void Mir2Lir::ApplyLoadStoreElimination(LIR* head_lir, LIR* tail_lir) { } ResourceMask stop_def_reg_mask = this_lir->u.m.def_mask->Without(kEncodeMem); - ResourceMask stop_use_reg_mask; - if (cu_->instruction_set == kX86 || cu_->instruction_set == kX86_64) { + + /* + * Add pc to the resource mask to prevent this instruction + * from sinking past branch instructions. Also take out the memory + * region bits since stop_mask is used to check data/control + * dependencies. + * + * Note: on x86(-64) and Arm64 we use the IsBranch bit, as the PC is not exposed. + */ + ResourceMask pc_encoding = GetPCUseDefEncoding(); + if (pc_encoding == kEncodeNone) { // TODO: Stop the abuse of kIsBranch as a bit specification for ResourceMask. - stop_use_reg_mask = ResourceMask::Bit(kIsBranch).Union(*this_lir->u.m.use_mask).Without( - kEncodeMem); - } else { - /* - * Add pc to the resource mask to prevent this instruction - * from sinking past branch instructions. Also take out the memory - * region bits since stop_mask is used to check data/control - * dependencies. - */ - stop_use_reg_mask = GetPCUseDefEncoding().Union(*this_lir->u.m.use_mask).Without(kEncodeMem); + pc_encoding = ResourceMask::Bit(kIsBranch); } + ResourceMask stop_use_reg_mask = pc_encoding.Union(*this_lir->u.m.use_mask). + Without(kEncodeMem); for (check_lir = NEXT_LIR(this_lir); check_lir != tail_lir; check_lir = NEXT_LIR(check_lir)) { /* @@ -310,16 +312,17 @@ void Mir2Lir::ApplyLoadHoisting(LIR* head_lir, LIR* tail_lir) { ResourceMask stop_use_all_mask = *this_lir->u.m.use_mask; - if (cu_->instruction_set != kX86 && cu_->instruction_set != kX86_64) { - /* - * Branches for null/range checks are marked with the true resource - * bits, and loads to Dalvik registers, constant pools, and non-alias - * locations are safe to be hoisted. So only mark the heap references - * conservatively here. - */ - if (stop_use_all_mask.HasBit(ResourceMask::kHeapRef)) { - stop_use_all_mask.SetBits(GetPCUseDefEncoding()); - } + /* + * Branches for null/range checks are marked with the true resource + * bits, and loads to Dalvik registers, constant pools, and non-alias + * locations are safe to be hoisted. So only mark the heap references + * conservatively here. + * + * Note: on x86(-64) and Arm64 this will add kEncodeNone. + * TODO: Sanity check. LoadStoreElimination uses kBranchBit to fake a PC. + */ + if (stop_use_all_mask.HasBit(ResourceMask::kHeapRef)) { + stop_use_all_mask.SetBits(GetPCUseDefEncoding()); } /* Similar as above, but just check for pure register dependency */ |