1/* 2 * Copyright (C) 2007 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package com.android.dx.dex.code; 18 19import com.android.dx.rop.code.RegisterSpecList; 20import com.android.dx.rop.code.SourcePosition; 21 22/** 23 * Pseudo-instruction base class for variable-sized instructions. 24 */ 25public abstract class VariableSizeInsn extends DalvInsn { 26 /** 27 * Constructs an instance. The output address of this instance is initially 28 * unknown ({@code -1}). 29 * 30 * @param position {@code non-null;} source position 31 * @param registers {@code non-null;} source registers 32 */ 33 public VariableSizeInsn(SourcePosition position, 34 RegisterSpecList registers) { 35 super(Dops.SPECIAL_FORMAT, position, registers); 36 } 37 38 /** {@inheritDoc} */ 39 @Override 40 public final DalvInsn withOpcode(Dop opcode) { 41 throw new RuntimeException("unsupported"); 42 } 43 44 /** {@inheritDoc} */ 45 @Override 46 public final DalvInsn withRegisterOffset(int delta) { 47 return withRegisters(getRegisters().withOffset(delta)); 48 } 49} 50