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 * Instruction which has no extra info beyond the basics provided for in 24 * the base class. 25 */ 26public final class SimpleInsn extends FixedSizeInsn { 27 /** 28 * Constructs an instance. The output address of this instance is initially 29 * unknown ({@code -1}). 30 * 31 * @param opcode the opcode; one of the constants from {@link Dops} 32 * @param position {@code non-null;} source position 33 * @param registers {@code non-null;} register list, including a 34 * result register if appropriate (that is, registers may be either 35 * ins or outs) 36 */ 37 public SimpleInsn(Dop opcode, SourcePosition position, 38 RegisterSpecList registers) { 39 super(opcode, position, registers); 40 } 41 42 /** {@inheritDoc} */ 43 @Override 44 public DalvInsn withOpcode(Dop opcode) { 45 return new SimpleInsn(opcode, getPosition(), getRegisters()); 46 } 47 48 /** {@inheritDoc} */ 49 @Override 50 public DalvInsn withRegisters(RegisterSpecList registers) { 51 return new SimpleInsn(getOpcode(), getPosition(), registers); 52 } 53 54 /** {@inheritDoc} */ 55 @Override 56 protected String argString() { 57 return null; 58 } 59} 60