blob: 4117cec15b16f4fa808423ff8975846e407a2356 [file] [log] [blame]
// Copyright (c) 2018, 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.code;
import com.android.tools.r8.cf.LoadStoreHelper;
import com.android.tools.r8.errors.Unreachable;
import com.android.tools.r8.graph.DexType;
import com.android.tools.r8.ir.conversion.CfBuilder;
import com.android.tools.r8.ir.conversion.DexBuilder;
import com.android.tools.r8.ir.optimize.Inliner.Constraint;
import com.android.tools.r8.shaking.Enqueuer.AppInfoWithLiveness;
import com.android.tools.r8.utils.InternalOptions;
public class AlwaysMaterializingUser extends Instruction {
public AlwaysMaterializingUser(Value src) {
super(null, src);
// The user instruction never materializes so ensure it has position none.
setPosition(Position.none());
}
@Override
public boolean canBeDeadCode(IRCode code, InternalOptions options) {
// This instruction may never be considered dead as it must remain.
return false;
}
@Override
public void buildDex(DexBuilder builder) {
builder.addNothing(this);
}
@Override
public void buildCf(CfBuilder builder) {
throw new Unreachable();
}
@Override
public boolean identicalNonValueNonPositionParts(Instruction other) {
return false;
}
@Override
public int compareNonValueParts(Instruction other) {
return 0;
}
@Override
public int maxInValueRegister() {
assert inValues.get(0).definition instanceof AlwaysMaterializingDefinition;
return inValues.get(0).definition.maxOutValueRegister();
}
@Override
public int maxOutValueRegister() {
throw new Unreachable();
}
@Override
public Constraint inliningConstraint(AppInfoWithLiveness info, DexType invocationContext) {
return Constraint.ALWAYS;
}
@Override
public void insertLoadAndStores(InstructionListIterator it, LoadStoreHelper helper) {
throw new Unreachable();
}
}