summaryrefslogtreecommitdiff
path: root/compiler/optimizing/intrinsics.h
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2016-08-26 16:19:59 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2016-08-26 16:19:59 +0000
commitcc55a7ce2aa0f10c2da9efaa89855cf075e56e20 (patch)
tree9bf090506ab95337f9029be4e4c8453b7d01a488 /compiler/optimizing/intrinsics.h
parentc9c055f96005b319d6c582b23432ba3ef0bd7488 (diff)
parent68c981fad87720fae9c799b240141ce3c12cd5bf (diff)
Merge "ARM/MIPS: Avoid dead dex cache arrays base for intrinsics."
Diffstat (limited to 'compiler/optimizing/intrinsics.h')
-rw-r--r--compiler/optimizing/intrinsics.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/compiler/optimizing/intrinsics.h b/compiler/optimizing/intrinsics.h
index 1a8eb58857..62f731d03f 100644
--- a/compiler/optimizing/intrinsics.h
+++ b/compiler/optimizing/intrinsics.h
@@ -243,6 +243,24 @@ UNREACHABLE_INTRINSIC(Arch, UnsafeLoadFence) \
UNREACHABLE_INTRINSIC(Arch, UnsafeStoreFence) \
UNREACHABLE_INTRINSIC(Arch, UnsafeFullFence)
+template <typename IntrinsicLocationsBuilder, typename Codegenerator>
+bool IsCallFreeIntrinsic(HInvoke* invoke, Codegenerator* codegen) {
+ if (invoke->GetIntrinsic() != Intrinsics::kNone) {
+ // This invoke may have intrinsic code generation defined. However, we must
+ // now also determine if this code generation is truly there and call-free
+ // (not unimplemented, no bail on instruction features, or call on slow path).
+ // This is done by actually calling the locations builder on the instruction
+ // and clearing out the locations once result is known. We assume this
+ // call only has creating locations as side effects!
+ // TODO: Avoid wasting Arena memory.
+ IntrinsicLocationsBuilder builder(codegen);
+ bool success = builder.TryDispatch(invoke) && !invoke->GetLocations()->CanCall();
+ invoke->SetLocations(nullptr);
+ return success;
+ }
+ return false;
+}
+
} // namespace art
#endif // ART_COMPILER_OPTIMIZING_INTRINSICS_H_