1 // Copyright (c) 2016, the R8 project authors. Please see the AUTHORS file 2 // for details. All rights reserved. Use of this source code is governed by a 3 // BSD-style license that can be found in the LICENSE file. 4 package com.android.tools.r8.code; 5 6 import com.android.tools.r8.ir.code.MoveType; 7 import com.android.tools.r8.ir.code.SingleConstant; 8 import com.android.tools.r8.ir.conversion.IRBuilder; 9 import com.android.tools.r8.naming.ClassNameMapper; 10 import com.android.tools.r8.utils.StringUtils; 11 12 public class Const16 extends Format21s implements SingleConstant { 13 14 public static final int OPCODE = 0x13; 15 public static final String NAME = "Const16"; 16 public static final String SMALI_NAME = "const/16"; 17 Const16(int high, BytecodeStream stream)18 /*package*/ Const16(int high, BytecodeStream stream) { 19 super(high, stream); 20 } 21 Const16(int dest, int constant)22 public Const16(int dest, int constant) { 23 super(dest, constant); 24 } 25 getName()26 public String getName() { 27 return NAME; 28 } 29 getSmaliName()30 public String getSmaliName() { 31 return SMALI_NAME; 32 } 33 getOpcode()34 public int getOpcode() { 35 return OPCODE; 36 } 37 38 @Override decodedValue()39 public int decodedValue() { 40 return BBBB; 41 } 42 43 @Override toString(ClassNameMapper naming)44 public String toString(ClassNameMapper naming) { 45 return formatString("v" + AA + ", 0x" + StringUtils.hexString(decodedValue(), 4) + 46 " (" + decodedValue() + ")"); 47 } 48 49 @Override buildIR(IRBuilder builder)50 public void buildIR(IRBuilder builder) { 51 builder.addConst(MoveType.SINGLE, AA, decodedValue()); 52 } 53 } 54