summaryrefslogtreecommitdiff
path: root/compiler/optimizing/nodes.cc
diff options
context:
space:
mode:
author Aart Bik <ajcbik@google.com> 2015-12-14 11:57:01 -0800
committer Aart Bik <ajcbik@google.com> 2015-12-30 10:52:51 -0800
commit5d75afe333f57546786686d9bee16b52f1bbe971 (patch)
treeee203dd8ff8c4c6257b6c1ae1db1a432a8a8682f /compiler/optimizing/nodes.cc
parent1e65a78577ed71f5e3d79edaa0e6735ea4a3371b (diff)
Improved side-effects/can-throw information on intrinsics.
Rationale: improved side effect and exception analysis gives many more opportunities for GVN/LICM/BCE. Change-Id: I8aa9b757d77c7bd9d58271204a657c2c525195b5
Diffstat (limited to 'compiler/optimizing/nodes.cc')
-rw-r--r--compiler/optimizing/nodes.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index a37298c76e..a9a249333f 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -2091,13 +2091,27 @@ bool HInstruction::HasAnyEnvironmentUseBefore(HInstruction* other) {
}
void HInvoke::SetIntrinsic(Intrinsics intrinsic,
- IntrinsicNeedsEnvironmentOrCache needs_env_or_cache) {
+ IntrinsicNeedsEnvironmentOrCache needs_env_or_cache,
+ IntrinsicSideEffects side_effects,
+ IntrinsicExceptions exceptions) {
intrinsic_ = intrinsic;
IntrinsicOptimizations opt(this);
if (needs_env_or_cache == kNoEnvironmentOrCache) {
opt.SetDoesNotNeedDexCache();
opt.SetDoesNotNeedEnvironment();
}
+ // Adjust method's side effects from intrinsic table.
+ switch (side_effects) {
+ case kNoSideEffects: SetSideEffects(SideEffects::None()); break;
+ case kReadSideEffects: SetSideEffects(SideEffects::AllReads()); break;
+ case kWriteSideEffects: SetSideEffects(SideEffects::AllWrites()); break;
+ case kAllSideEffects: SetSideEffects(SideEffects::AllExceptGCDependency()); break;
+ }
+ // Adjust method's exception status from intrinsic table.
+ switch (exceptions) {
+ case kNoThrow: SetCanThrow(false); break;
+ case kCanThrow: SetCanThrow(true); break;
+ }
}
bool HInvoke::NeedsEnvironment() const {