blob: 61426a0fef0a3e69ca15daca10e56a8c66120bf3 [file] [log] [blame]
// Copyright (c) 2019, the R8 project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
package com.android.tools.r8.ir.analysis.value;
import com.android.tools.r8.graph.AppInfoWithClassHierarchy;
import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.DexType;
import com.android.tools.r8.graph.GraphLense;
import com.android.tools.r8.ir.code.IRCode;
import com.android.tools.r8.ir.code.Instruction;
import com.android.tools.r8.ir.code.TypeAndLocalInfoSupplier;
import com.android.tools.r8.ir.optimize.info.field.InstanceFieldInitializationInfo;
import com.android.tools.r8.shaking.AppInfoWithLiveness;
public abstract class SingleValue extends AbstractValue implements InstanceFieldInitializationInfo {
@Override
public boolean isNonTrivial() {
return true;
}
@Override
public boolean isSingleValue() {
return true;
}
@Override
public SingleValue asSingleValue() {
return this;
}
/**
* Note that calls to this method should generally be guarded by {@link
* #isMaterializableInContext}.
*/
public abstract Instruction createMaterializingInstruction(
AppView<? extends AppInfoWithClassHierarchy> appView,
IRCode code,
TypeAndLocalInfoSupplier info);
public abstract boolean isMaterializableInContext(
AppView<AppInfoWithLiveness> appView, DexType context);
public abstract boolean isMaterializableInAllContexts(AppView<?> appView);
@Override
public abstract SingleValue rewrittenWithLens(
AppView<AppInfoWithLiveness> appView, GraphLense lens);
}