├── .gitignore ├── .idea ├── .gitignore ├── artifacts │ └── android_d8_jar.xml ├── encodings.xml ├── libraries │ ├── asm_all_6_0_BETA.xml │ ├── commons_compress_1_18.xml │ ├── fastutil_8_3_1.xml │ ├── guava_29_0_android.xml │ ├── jopt_simple_5_0_4.xml │ └── org_json_simple_0_4.xml ├── misc.xml └── modules.xml ├── README.md ├── android-d8.iml ├── libs ├── asm-all-6.0_BETA.jar ├── commons-compress-1.18.jar ├── fastutil-8.3.1.jar ├── guava-29.0-android.jar ├── jopt-simple-5.0.4.jar └── org.json.simple-0.4.jar └── src ├── META-INF └── MANIFEST.MF └── com └── android └── tools └── r8 ├── BSPatch.java ├── BaseCommand.java ├── BaseCompilerCommand.java ├── BaseOutput.java ├── ClassFileResourceProvider.java ├── CompilationException.java ├── CompilationMode.java ├── CompilationResult.java ├── D8.java ├── D8Command.java ├── D8Logger.java ├── D8Output.java ├── DexSegments.java ├── Disassemble.java ├── ExtractMarker.java ├── GenerateMainDexList.java ├── GenerateMainDexListCommand.java ├── IncrementalDexingBenchmark.java ├── PrintClassList.java ├── R8.java ├── R8Command.java ├── ReadKeepFile.java ├── ReadMainDexList.java ├── ReadProguardMap.java ├── Resource.java ├── bisect ├── Bisect.java ├── BisectOptions.java └── BisectState.java ├── code ├── AddDouble.java ├── AddDouble2Addr.java ├── AddFloat.java ├── AddFloat2Addr.java ├── AddInt.java ├── AddInt2Addr.java ├── AddIntLit16.java ├── AddIntLit8.java ├── AddLong.java ├── AddLong2Addr.java ├── Aget.java ├── AgetBoolean.java ├── AgetByte.java ├── AgetChar.java ├── AgetObject.java ├── AgetShort.java ├── AgetWide.java ├── AndInt.java ├── AndInt2Addr.java ├── AndIntLit16.java ├── AndIntLit8.java ├── AndLong.java ├── AndLong2Addr.java ├── Aput.java ├── AputBoolean.java ├── AputByte.java ├── AputChar.java ├── AputObject.java ├── AputShort.java ├── AputWide.java ├── ArrayLength.java ├── Base1Format.java ├── Base2Format.java ├── Base3Format.java ├── Base4Format.java ├── Base5Format.java ├── BaseInstructionFactory.java ├── BytecodeStream.java ├── CheckCast.java ├── CmpLong.java ├── CmpgDouble.java ├── CmpgFloat.java ├── CmplDouble.java ├── CmplFloat.java ├── Const.java ├── Const16.java ├── Const4.java ├── ConstClass.java ├── ConstHigh16.java ├── ConstString.java ├── ConstStringJumbo.java ├── ConstWide.java ├── ConstWide16.java ├── ConstWide32.java ├── ConstWideHigh16.java ├── DivDouble.java ├── DivDouble2Addr.java ├── DivFloat.java ├── DivFloat2Addr.java ├── DivInt.java ├── DivInt2Addr.java ├── DivIntLit16.java ├── DivIntLit8.java ├── DivLong.java ├── DivLong2Addr.java ├── DoubleToFloat.java ├── DoubleToInt.java ├── DoubleToLong.java ├── FillArrayData.java ├── FillArrayDataPayload.java ├── FilledNewArray.java ├── FilledNewArrayRange.java ├── FloatToDouble.java ├── FloatToInt.java ├── FloatToLong.java ├── Format10t.java ├── Format10x.java ├── Format11n.java ├── Format11x.java ├── Format12x.java ├── Format20t.java ├── Format21c.java ├── Format21h.java ├── Format21s.java ├── Format21t.java ├── Format22b.java ├── Format22c.java ├── Format22s.java ├── Format22t.java ├── Format22x.java ├── Format23x.java ├── Format30t.java ├── Format31c.java ├── Format31i.java ├── Format31t.java ├── Format32x.java ├── Format35c.java ├── Format3rc.java ├── Format45cc.java ├── Format4rcc.java ├── Format51l.java ├── Goto.java ├── Goto16.java ├── Goto32.java ├── IfEq.java ├── IfEqz.java ├── IfGe.java ├── IfGez.java ├── IfGt.java ├── IfGtz.java ├── IfLe.java ├── IfLez.java ├── IfLt.java ├── IfLtz.java ├── IfNe.java ├── IfNez.java ├── Iget.java ├── IgetBoolean.java ├── IgetByte.java ├── IgetChar.java ├── IgetObject.java ├── IgetShort.java ├── IgetWide.java ├── InstanceOf.java ├── Instruction.java ├── InstructionFactory.java ├── IntToByte.java ├── IntToChar.java ├── IntToDouble.java ├── IntToFloat.java ├── IntToLong.java ├── IntToShort.java ├── InvokeCustom.java ├── InvokeCustomRange.java ├── InvokeDirect.java ├── InvokeDirectRange.java ├── InvokeInterface.java ├── InvokeInterfaceRange.java ├── InvokePolymorphic.java ├── InvokePolymorphicRange.java ├── InvokeStatic.java ├── InvokeStaticRange.java ├── InvokeSuper.java ├── InvokeSuperRange.java ├── InvokeVirtual.java ├── InvokeVirtualRange.java ├── Iput.java ├── IputBoolean.java ├── IputByte.java ├── IputChar.java ├── IputObject.java ├── IputShort.java ├── IputWide.java ├── LongToDouble.java ├── LongToFloat.java ├── LongToInt.java ├── MonitorEnter.java ├── MonitorExit.java ├── Move.java ├── Move16.java ├── MoveException.java ├── MoveFrom16.java ├── MoveObject.java ├── MoveObject16.java ├── MoveObjectFrom16.java ├── MoveResult.java ├── MoveResultObject.java ├── MoveResultWide.java ├── MoveWide.java ├── MoveWide16.java ├── MoveWideFrom16.java ├── MulDouble.java ├── MulDouble2Addr.java ├── MulFloat.java ├── MulFloat2Addr.java ├── MulInt.java ├── MulInt2Addr.java ├── MulIntLit16.java ├── MulIntLit8.java ├── MulLong.java ├── MulLong2Addr.java ├── NegDouble.java ├── NegFloat.java ├── NegInt.java ├── NegLong.java ├── NewArray.java ├── NewInstance.java ├── Nop.java ├── NotInt.java ├── NotLong.java ├── OrInt.java ├── OrInt2Addr.java ├── OrIntLit16.java ├── OrIntLit8.java ├── OrLong.java ├── OrLong2Addr.java ├── PackedSwitch.java ├── PackedSwitchPayload.java ├── RemDouble.java ├── RemDouble2Addr.java ├── RemFloat.java ├── RemFloat2Addr.java ├── RemInt.java ├── RemInt2Addr.java ├── RemIntLit16.java ├── RemIntLit8.java ├── RemLong.java ├── RemLong2Addr.java ├── Return.java ├── ReturnObject.java ├── ReturnVoid.java ├── ReturnWide.java ├── RsubInt.java ├── RsubIntLit8.java ├── Sget.java ├── SgetBoolean.java ├── SgetByte.java ├── SgetChar.java ├── SgetObject.java ├── SgetShort.java ├── SgetWide.java ├── ShlInt.java ├── ShlInt2Addr.java ├── ShlIntLit8.java ├── ShlLong.java ├── ShlLong2Addr.java ├── ShrInt.java ├── ShrInt2Addr.java ├── ShrIntLit8.java ├── ShrLong.java ├── ShrLong2Addr.java ├── SparseSwitch.java ├── SparseSwitchPayload.java ├── Sput.java ├── SputBoolean.java ├── SputByte.java ├── SputChar.java ├── SputObject.java ├── SputShort.java ├── SputWide.java ├── SubDouble.java ├── SubDouble2Addr.java ├── SubFloat.java ├── SubFloat2Addr.java ├── SubInt.java ├── SubInt2Addr.java ├── SubLong.java ├── SubLong2Addr.java ├── SwitchPayload.java ├── Throw.java ├── UshrInt.java ├── UshrInt2Addr.java ├── UshrIntLit8.java ├── UshrLong.java ├── UshrLong2Addr.java ├── XorInt.java ├── XorInt2Addr.java ├── XorIntLit16.java ├── XorIntLit8.java ├── XorLong.java └── XorLong2Addr.java ├── compatdx ├── CompatDx.java └── CompatDxCommandBuilder.java ├── dex ├── ApplicationReader.java ├── ApplicationWriter.java ├── Constants.java ├── DebugBytecodeWriter.java ├── DexFile.java ├── DexFileReader.java ├── DexOutputBuffer.java ├── FileWriter.java ├── IndexedItemCollection.java ├── JumboStringRewriter.java ├── Marker.java ├── MixedSectionCollection.java ├── Segment.java └── VirtualFile.java ├── errors ├── CompilationError.java ├── InternalCompilerError.java ├── InvalidDebugInfoException.java ├── MainDexError.java ├── Unimplemented.java └── Unreachable.java ├── graph ├── AppInfo.java ├── AppInfoWithSubtyping.java ├── CachedHashValueDexItem.java ├── ClassAndMemberPublicizer.java ├── ClassKind.java ├── Code.java ├── DebugLocalInfo.java ├── DelegatingUseRegistry.java ├── Descriptor.java ├── DexAccessFlags.java ├── DexAnnotation.java ├── DexAnnotationDirectory.java ├── DexAnnotationElement.java ├── DexAnnotationSet.java ├── DexAnnotationSetRefList.java ├── DexApplication.java ├── DexCallSite.java ├── DexClass.java ├── DexClasspathClass.java ├── DexCode.java ├── DexDebugEntry.java ├── DexDebugEntryBuilder.java ├── DexDebugEvent.java ├── DexDebugEventBuilder.java ├── DexDebugInfo.java ├── DexEncodedAnnotation.java ├── DexEncodedArray.java ├── DexEncodedField.java ├── DexEncodedMethod.java ├── DexField.java ├── DexItem.java ├── DexItemFactory.java ├── DexLibraryClass.java ├── DexMemberAnnotation.java ├── DexMethod.java ├── DexMethodHandle.java ├── DexProgramClass.java ├── DexProto.java ├── DexString.java ├── DexType.java ├── DexTypeList.java ├── DexValue.java ├── GraphLense.java ├── IndexedDexItem.java ├── JarApplicationReader.java ├── JarClassFileReader.java ├── JarCode.java ├── KeyedDexItem.java ├── ObjectToOffsetMapping.java ├── OffsetToObjectMapping.java ├── Presorted.java ├── PresortedComparable.java ├── ProgramClassVisitor.java └── UseRegistry.java ├── ir ├── code │ ├── Add.java │ ├── And.java │ ├── Argument.java │ ├── ArithmeticBinop.java │ ├── ArrayGet.java │ ├── ArrayLength.java │ ├── ArrayPut.java │ ├── BasicBlock.java │ ├── BasicBlockInstructionIterator.java │ ├── BasicBlockIterator.java │ ├── Binop.java │ ├── CatchHandlers.java │ ├── CheckCast.java │ ├── Cmp.java │ ├── ConstClass.java │ ├── ConstInstruction.java │ ├── ConstNumber.java │ ├── ConstString.java │ ├── ConstType.java │ ├── DebugLocalUninitialized.java │ ├── DebugLocalWrite.java │ ├── DebugLocalsChange.java │ ├── DebugPosition.java │ ├── Div.java │ ├── DominatorTree.java │ ├── FieldInstruction.java │ ├── FixedRegisterValue.java │ ├── Goto.java │ ├── IRCode.java │ ├── IRCodeInstructionsIterator.java │ ├── If.java │ ├── InstanceGet.java │ ├── InstanceOf.java │ ├── InstancePut.java │ ├── Instruction.java │ ├── InstructionIterator.java │ ├── InstructionListIterator.java │ ├── Invoke.java │ ├── InvokeCustom.java │ ├── InvokeDirect.java │ ├── InvokeInterface.java │ ├── InvokeMethod.java │ ├── InvokeMethodWithReceiver.java │ ├── InvokeNewArray.java │ ├── InvokePolymorphic.java │ ├── InvokeStatic.java │ ├── InvokeSuper.java │ ├── InvokeVirtual.java │ ├── JumpInstruction.java │ ├── LogicalBinop.java │ ├── MemberType.java │ ├── Monitor.java │ ├── Move.java │ ├── MoveException.java │ ├── MoveType.java │ ├── Mul.java │ ├── Neg.java │ ├── NewArrayEmpty.java │ ├── NewArrayFilledData.java │ ├── NewInstance.java │ ├── NextUntilIterator.java │ ├── Not.java │ ├── NumberConversion.java │ ├── NumericType.java │ ├── Or.java │ ├── Phi.java │ ├── Rem.java │ ├── Return.java │ ├── Shl.java │ ├── Shr.java │ ├── SingleConstant.java │ ├── StaticGet.java │ ├── StaticPut.java │ ├── Sub.java │ ├── Switch.java │ ├── Throw.java │ ├── Unop.java │ ├── Ushr.java │ ├── Value.java │ ├── ValueNumberGenerator.java │ ├── WideConstant.java │ └── Xor.java ├── conversion │ ├── ArrayFilledDataPayloadResolver.java │ ├── CallGraph.java │ ├── DexBuilder.java │ ├── DexSourceCode.java │ ├── IRBuilder.java │ ├── IRConverter.java │ ├── JarSourceCode.java │ ├── JarState.java │ ├── LensCodeRewriter.java │ ├── OptimizationFeedback.java │ ├── OptimizationFeedbackDirect.java │ ├── OptimizationFeedbackIgnore.java │ ├── SourceCode.java │ └── SwitchPayloadResolver.java ├── desugar │ ├── AccessorMethodSourceCode.java │ ├── ClassProcessor.java │ ├── DefaultMethodsHelper.java │ ├── InterfaceMethodRewriter.java │ ├── InterfaceProcessor.java │ ├── LambdaBridgeMethodSourceCode.java │ ├── LambdaClass.java │ ├── LambdaClassConstructorSourceCode.java │ ├── LambdaConstructorSourceCode.java │ ├── LambdaDescriptor.java │ ├── LambdaMainMethodSourceCode.java │ ├── LambdaRewriter.java │ └── SynthesizedLambdaSourceCode.java ├── optimize │ ├── BasicBlockInstructionsEquivalence.java │ ├── CodeRewriter.java │ ├── DeadCodeRemover.java │ ├── EnumOrdinalMapCollector.java │ ├── Inliner.java │ ├── InliningInfo.java │ ├── InliningOracle.java │ ├── InstructionEquivalence.java │ ├── MemberValuePropagation.java │ ├── MoveEliminator.java │ ├── Outliner.java │ ├── PeepholeOptimizer.java │ ├── SwitchMapCollector.java │ └── SwitchUtils.java ├── regalloc │ ├── LinearScanRegisterAllocator.java │ ├── LiveIntervals.java │ ├── LiveIntervalsUse.java │ ├── LiveRange.java │ ├── RegisterAllocator.java │ ├── RegisterMove.java │ ├── RegisterMoveScheduler.java │ ├── RegisterPositions.java │ ├── SpillMove.java │ └── SpillMoveSet.java └── synthetic │ ├── ForwardMethodSourceCode.java │ ├── SingleBlockSourceCode.java │ └── SynthesizedCode.java ├── jar └── JarRegisterEffectsVisitor.java ├── logging └── Log.java ├── naming ├── ClassNameMapper.java ├── ClassNameMinifier.java ├── ClassNaming.java ├── ClassRenamingMapper.java ├── DictionaryReader.java ├── FieldNameMinifier.java ├── MemberNaming.java ├── MethodNameMinifier.java ├── MinifiedNameMapPrinter.java ├── Minifier.java ├── NamingLens.java ├── NamingState.java ├── ProguardMapReader.java └── signature │ ├── GenericSignatureAction.java │ └── GenericSignatureParser.java ├── optimize ├── BridgeMethodAnalysis.java ├── DebugStripper.java ├── InvokeSingleTargetExtractor.java ├── MemberRebindingAnalysis.java └── VisibilityBridgeRemover.java ├── shaking ├── AbstractMethodRemover.java ├── AnnotationRemover.java ├── DiscardedChecker.java ├── Enqueuer.java ├── KeepReason.java ├── MainDexListBuilder.java ├── ProguardAlwaysInlineRule.java ├── ProguardAssumeNoSideEffectRule.java ├── ProguardAssumeValuesRule.java ├── ProguardCheckDiscardRule.java ├── ProguardClassSpecification.java ├── ProguardClassType.java ├── ProguardConfiguration.java ├── ProguardConfigurationParser.java ├── ProguardConfigurationRule.java ├── ProguardConfigurationSource.java ├── ProguardConfigurationSourceFile.java ├── ProguardConfigurationSourceStrings.java ├── ProguardKeepPackageNamesRule.java ├── ProguardKeepRule.java ├── ProguardKeepRuleModifiers.java ├── ProguardKeepRuleType.java ├── ProguardMemberRule.java ├── ProguardMemberRuleReturnValue.java ├── ProguardMemberType.java ├── ProguardNameMatcher.java ├── ProguardRuleParserException.java ├── ProguardTypeMatcher.java ├── ProguardWhyAreYouKeepingRule.java ├── ReasonPrinter.java ├── RootSetBuilder.java ├── SimpleClassMerger.java ├── TreePruner.java ├── UsagePrinter.java └── protolite │ ├── ProtoLiteBase.java │ ├── ProtoLiteExtension.java │ └── ProtoLitePruner.java └── utils ├── AndroidApp.java ├── CfgPrinter.java ├── ClassMap.java ├── ClassProvider.java ├── ClasspathClassCollection.java ├── DescriptorUtils.java ├── DirectoryClassFileProvider.java ├── EncodedValueUtils.java ├── FieldSignatureEquivalence.java ├── FileUtils.java ├── InternalOptions.java ├── LebUtils.java ├── LibraryClassCollection.java ├── ListUtils.java ├── LongInterval.java ├── MainDexList.java ├── MethodJavaSignatureEquivalence.java ├── MethodSignatureEquivalence.java ├── NumberUtils.java ├── OffOrAuto.java ├── OneShotByteResource.java ├── OrderedMergingIterator.java ├── OutputMode.java ├── PackageDistribution.java ├── PreloadedClassFileProvider.java ├── ProgramClassCollection.java ├── ProgramFileArchiveReader.java ├── SimpleHashMap.java ├── StringUtils.java ├── ThreadUtils.java ├── Timing.java └── ZipUtils.java /.gitignore: -------------------------------------------------------------------------------- 1 | # Project exclude paths 2 | /out/ -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /workspace.xml -------------------------------------------------------------------------------- /.idea/artifacts/android_d8_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | $PROJECT_DIR$/out/artifacts/android_d8_jar 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/libraries/asm_all_6_0_BETA.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/commons_compress_1_18.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/fastutil_8_3_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/guava_29_0_android.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/jopt_simple_5_0_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/org_json_simple_0_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # android-d8 2 | andaroid build-tools d8 source code 3 | 4 | ## 作用 5 | 将class字节码文件转为dex,dx的升级版 6 | 7 | ## 编译环境 8 | IDEA 9 | 10 | ## 反馈 11 | QQEmail:1223414335@qq.com 12 | -------------------------------------------------------------------------------- /android-d8.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /libs/asm-all-6.0_BETA.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoyvyv/android-d8/f0401ff1bb377891726ee8aa521e7f8e38fe5998/libs/asm-all-6.0_BETA.jar -------------------------------------------------------------------------------- /libs/commons-compress-1.18.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoyvyv/android-d8/f0401ff1bb377891726ee8aa521e7f8e38fe5998/libs/commons-compress-1.18.jar -------------------------------------------------------------------------------- /libs/fastutil-8.3.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoyvyv/android-d8/f0401ff1bb377891726ee8aa521e7f8e38fe5998/libs/fastutil-8.3.1.jar -------------------------------------------------------------------------------- /libs/guava-29.0-android.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoyvyv/android-d8/f0401ff1bb377891726ee8aa521e7f8e38fe5998/libs/guava-29.0-android.jar -------------------------------------------------------------------------------- /libs/jopt-simple-5.0.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoyvyv/android-d8/f0401ff1bb377891726ee8aa521e7f8e38fe5998/libs/jopt-simple-5.0.4.jar -------------------------------------------------------------------------------- /libs/org.json.simple-0.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoyvyv/android-d8/f0401ff1bb377891726ee8aa521e7f8e38fe5998/libs/org.json.simple-0.4.jar -------------------------------------------------------------------------------- /src/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Main-Class: com.android.tools.r8.D8 3 | 4 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/ClassFileResourceProvider.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, 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; 5 | 6 | import java.util.Set; 7 | 8 | /** 9 | * Represents a provider for application resources of class file kind. 10 | * 11 | * Note that the classes will only be created for resources provided by 12 | * resource providers on-demand when they are needed by the tool. If 13 | * never needed, the resource will never be loaded. 14 | */ 15 | public interface ClassFileResourceProvider { 16 | /** Returns all class descriptors. */ 17 | Set getClassDescriptors(); 18 | 19 | /** 20 | * Get the class resource associated with the descriptor, or null if 21 | * this provider does not have one. 22 | * 23 | * Method may be called several times for the same resource, and should 24 | * support concurrent calls from different threads. 25 | */ 26 | Resource getResource(String descriptor); 27 | } 28 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/CompilationMode.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, 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; 5 | 6 | /** Compilation mode. */ 7 | public enum CompilationMode { 8 | /** Preserves debugging information during compilation, eg, line-numbers and locals. */ 9 | DEBUG, 10 | /** Strips debugging information that cannot affect stack traces. */ 11 | RELEASE 12 | } 13 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/CompilationResult.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, 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; 5 | 6 | import com.android.tools.r8.graph.AppInfo; 7 | import com.android.tools.r8.graph.DexApplication; 8 | import com.android.tools.r8.utils.AndroidApp; 9 | 10 | public class CompilationResult { 11 | public final AndroidApp androidApp; 12 | public final DexApplication dexApplication; 13 | public final AppInfo appInfo; 14 | 15 | public CompilationResult(AndroidApp androidApp, DexApplication dexApplication, AppInfo appInfo) { 16 | this.androidApp = androidApp; 17 | this.dexApplication = dexApplication; 18 | this.appInfo = appInfo; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/D8Output.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, 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; 5 | 6 | import com.android.tools.r8.utils.AndroidApp; 7 | import com.android.tools.r8.utils.OutputMode; 8 | import java.io.IOException; 9 | import java.nio.file.Path; 10 | 11 | /** Represents the output of a D8 compilation. */ 12 | public class D8Output extends BaseOutput { 13 | 14 | D8Output(AndroidApp app, OutputMode outputMode) { 15 | super(app, outputMode); 16 | } 17 | 18 | @Override 19 | public void write(Path output) throws IOException { 20 | getAndroidApp().write(output, getOutputMode()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/AddDouble.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | public class AddDouble extends Format23x { 9 | 10 | public static final int OPCODE = 0xab; 11 | public static final String NAME = "AddDouble"; 12 | public static final String SMALI_NAME = "add-double"; 13 | 14 | AddDouble(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public AddDouble(int dest, int left, int right) { 19 | super(dest, left, right); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addAdd(NumericType.DOUBLE, AA, BB, CC); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/AddDouble2Addr.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | public class AddDouble2Addr extends Format12x { 9 | 10 | public static final int OPCODE = 0xcb; 11 | public static final String NAME = "AddDouble2Addr"; 12 | public static final String SMALI_NAME = "add-double/2addr"; 13 | 14 | AddDouble2Addr(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public AddDouble2Addr(int left, int right) { 19 | super(left, right); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addAdd(NumericType.DOUBLE, A, A, B); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/AddFloat.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class AddFloat extends Format23x { 10 | 11 | public static final int OPCODE = 0xa6; 12 | public static final String NAME = "AddFloat"; 13 | public static final String SMALI_NAME = "add-float"; 14 | 15 | AddFloat(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public AddFloat(int dest, int left, int right) { 20 | super(dest, left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addAdd(NumericType.FLOAT, AA, BB, CC); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/AddFloat2Addr.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class AddFloat2Addr extends Format12x { 10 | 11 | public static final int OPCODE = 0xc6; 12 | public static final String NAME = "AddFloat2Addr"; 13 | public static final String SMALI_NAME = "add-float/2addr"; 14 | 15 | AddFloat2Addr(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public AddFloat2Addr(int left, int right) { 20 | super(left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addAdd(NumericType.FLOAT, A, A, B); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/AddInt.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class AddInt extends Format23x { 10 | 11 | public static final int OPCODE = 0x90; 12 | public static final String NAME = "AddInt"; 13 | public static final String SMALI_NAME = "add-int"; 14 | 15 | AddInt(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public AddInt(int dest, int left, int right) { 20 | super(dest, left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addAdd(NumericType.INT, AA, BB, CC); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/AddInt2Addr.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class AddInt2Addr extends Format12x { 10 | 11 | public static final int OPCODE = 0xb0; 12 | public static final String NAME = "AddInt2Addr"; 13 | public static final String SMALI_NAME = "add-int/2addr"; 14 | 15 | AddInt2Addr(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public AddInt2Addr(int left, int right) { 20 | super(left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addAdd(NumericType.INT, A, A, B); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/AddIntLit16.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class AddIntLit16 extends Format22s { 10 | 11 | public static final int OPCODE = 0xd0; 12 | public static final String NAME = "AddIntLit16"; 13 | public static final String SMALI_NAME = "add-int/lit16"; 14 | 15 | AddIntLit16(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public AddIntLit16(int dest, int register, int constant) { 20 | super(dest, register, constant); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addAddLiteral(NumericType.INT, A, B, CCCC); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/AddIntLit8.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class AddIntLit8 extends Format22b { 10 | 11 | public static final int OPCODE = 0xd8; 12 | public static final String NAME = "AddIntLit8"; 13 | public static final String SMALI_NAME = "add-int/lit8"; 14 | 15 | AddIntLit8(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public AddIntLit8(int dest, int register, int constant) { 20 | super(dest, register, constant); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addAddLiteral(NumericType.INT, AA, BB, CC); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/AddLong.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | public class AddLong extends Format23x { 9 | 10 | public static final int OPCODE = 0x9b; 11 | public static final String NAME = "AddLong"; 12 | public static final String SMALI_NAME = "add-long"; 13 | 14 | AddLong(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public AddLong(int dest, int left, int right) { 19 | super(dest, left, right); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addAdd(NumericType.LONG, AA, BB, CC); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/AddLong2Addr.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | public class AddLong2Addr extends Format12x { 9 | 10 | public static final int OPCODE = 0xbb; 11 | public static final String NAME = "AddLong2Addr"; 12 | public static final String SMALI_NAME = "add-long/2addr"; 13 | 14 | AddLong2Addr(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public AddLong2Addr(int left, int right) { 19 | super(left, right); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addAdd(NumericType.LONG, A, A, B); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/Aget.java: -------------------------------------------------------------------------------- 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.MemberType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class Aget extends Format23x { 10 | 11 | public static final int OPCODE = 0x44; 12 | public static final String NAME = "Aget"; 13 | public static final String SMALI_NAME = "aget"; 14 | 15 | /*package*/ Aget(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public Aget(int AA, int BB, int CC) { 20 | super(AA, BB, CC); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addArrayGet(MemberType.SINGLE, AA, BB, CC); 38 | } 39 | 40 | @Override 41 | public boolean canThrow() { 42 | return true; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/AgetByte.java: -------------------------------------------------------------------------------- 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.MemberType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class AgetByte extends Format23x { 10 | 11 | public static final int OPCODE = 0x48; 12 | public static final String NAME = "AgetByte"; 13 | public static final String SMALI_NAME = "aget-byte"; 14 | 15 | /*package*/ AgetByte(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public AgetByte(int AA, int BB, int CC) { 20 | super(AA, BB, CC); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addArrayGet(MemberType.BYTE, AA, BB, CC); 38 | } 39 | 40 | @Override 41 | public boolean canThrow() { 42 | return true; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/AgetChar.java: -------------------------------------------------------------------------------- 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.MemberType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class AgetChar extends Format23x { 10 | 11 | public static final int OPCODE = 0x49; 12 | public static final String NAME = "AgetChar"; 13 | public static final String SMALI_NAME = "aget-char"; 14 | 15 | /*package*/ AgetChar(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public AgetChar(int AA, int BB, int CC) { 20 | super(AA, BB, CC); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addArrayGet(MemberType.CHAR, AA, BB, CC); 38 | } 39 | 40 | @Override 41 | public boolean canThrow() { 42 | return true; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/AgetObject.java: -------------------------------------------------------------------------------- 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.MemberType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | public class AgetObject extends Format23x { 9 | 10 | public static final int OPCODE = 0x46; 11 | public static final String NAME = "AgetObject"; 12 | public static final String SMALI_NAME = "aget-object"; 13 | 14 | AgetObject(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public AgetObject(int AA, int BB, int CC) { 19 | super(AA, BB, CC); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addArrayGet(MemberType.OBJECT, AA, BB, CC); 37 | } 38 | 39 | @Override 40 | public boolean canThrow() { 41 | return true; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/AgetShort.java: -------------------------------------------------------------------------------- 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.MemberType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class AgetShort extends Format23x { 10 | 11 | public static final int OPCODE = 0x4a; 12 | public static final String NAME = "AgetShort"; 13 | public static final String SMALI_NAME = "aget-short"; 14 | 15 | AgetShort(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public AgetShort(int AA, int BB, int CC) { 20 | super(AA, BB, CC); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addArrayGet(MemberType.SHORT, AA, BB, CC); 38 | } 39 | 40 | @Override 41 | public boolean canThrow() { 42 | return true; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/AgetWide.java: -------------------------------------------------------------------------------- 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.MemberType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class AgetWide extends Format23x { 10 | 11 | public static final int OPCODE = 0x45; 12 | public static final String NAME = "AgetWide"; 13 | public static final String SMALI_NAME = "aget-wide"; 14 | 15 | /*package*/ AgetWide(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public AgetWide(int AA, int BB, int CC) { 20 | super(AA, BB, CC); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addArrayGet(MemberType.WIDE, AA, BB, CC); 38 | } 39 | 40 | @Override 41 | public boolean canThrow() { 42 | return true; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/AndInt.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class AndInt extends Format23x { 10 | 11 | public static final int OPCODE = 0x95; 12 | public static final String NAME = "AndInt"; 13 | public static final String SMALI_NAME = "and-int"; 14 | 15 | AndInt(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public AndInt(int dest, int left, int right) { 20 | super(dest, left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addAnd(NumericType.INT, AA, BB, CC); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/AndInt2Addr.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class AndInt2Addr extends Format12x { 10 | 11 | public static final int OPCODE = 0xb5; 12 | public static final String NAME = "AndInt2Addr"; 13 | public static final String SMALI_NAME = "and-int/2addr"; 14 | 15 | AndInt2Addr(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public AndInt2Addr(int left, int right) { 20 | super(left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addAnd(NumericType.INT, A, A, B); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/AndIntLit16.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class AndIntLit16 extends Format22s { 10 | 11 | public static final int OPCODE = 0xd5; 12 | public static final String NAME = "AndIntLit16"; 13 | public static final String SMALI_NAME = "and-int/lit16"; 14 | 15 | AndIntLit16(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public AndIntLit16(int dest, int left, int constant) { 20 | super(dest, left, constant); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addAndLiteral(NumericType.INT, A, B, CCCC); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/AndIntLit8.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | public class AndIntLit8 extends Format22b { 9 | 10 | public static final int OPCODE = 0xdd; 11 | public static final String NAME = "AndIntLit8"; 12 | public static final String SMALI_NAME = "and-int/lit8"; 13 | 14 | AndIntLit8(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public AndIntLit8(int dest, int left, int constant) { 19 | super(dest, left, constant); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addAndLiteral(NumericType.INT, AA, BB, CC); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/AndLong.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class AndLong extends Format23x { 10 | 11 | public static final int OPCODE = 0xA0; 12 | public static final String NAME = "AndLong"; 13 | public static final String SMALI_NAME = "and-long"; 14 | 15 | AndLong(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public AndLong(int dest, int left, int right) { 20 | super(dest, left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addAnd(NumericType.LONG, AA, BB, CC); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/AndLong2Addr.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | public class AndLong2Addr extends Format12x { 9 | 10 | public static final int OPCODE = 0xc0; 11 | public static final String NAME = "AndLong2Addr"; 12 | public static final String SMALI_NAME = "and-long/2addr"; 13 | 14 | AndLong2Addr(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public AndLong2Addr(int left, int right) { 19 | super(left, right); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addAnd(NumericType.LONG, A, A, B); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/Aput.java: -------------------------------------------------------------------------------- 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.MemberType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class Aput extends Format23x { 10 | 11 | public static final int OPCODE = 0x4b; 12 | public static final String NAME = "Aput"; 13 | public static final String SMALI_NAME = "aput"; 14 | 15 | /*package*/ Aput(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public Aput(int AA, int BB, int CC) { 20 | super(AA, BB, CC); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addArrayPut(MemberType.SINGLE, AA, BB, CC); 38 | } 39 | 40 | @Override 41 | public boolean canThrow() { 42 | return true; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/ArrayLength.java: -------------------------------------------------------------------------------- 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.conversion.IRBuilder; 7 | 8 | public class ArrayLength extends Format12x { 9 | 10 | public static final int OPCODE = 0x21; 11 | public static final String NAME = "ArrayLength"; 12 | public static final String SMALI_NAME = "array-length"; 13 | 14 | ArrayLength(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public ArrayLength(int dest, int array) { 19 | super(dest, array); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addArrayLength(A, B); 37 | } 38 | 39 | @Override 40 | public boolean canThrow() { 41 | return true; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/Base1Format.java: -------------------------------------------------------------------------------- 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 | public abstract class Base1Format extends Instruction { 7 | 8 | public Base1Format(BytecodeStream stream) { 9 | super(stream); 10 | } 11 | 12 | protected Base1Format() {} 13 | 14 | public int getSize() { 15 | return 1; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/Base2Format.java: -------------------------------------------------------------------------------- 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 | public abstract class Base2Format extends Instruction { 7 | 8 | protected Base2Format() {} 9 | 10 | public Base2Format(BytecodeStream stream) { 11 | super(stream); 12 | } 13 | 14 | public int getSize() { 15 | return 2; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/Base3Format.java: -------------------------------------------------------------------------------- 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 | public abstract class Base3Format extends Instruction { 7 | 8 | protected Base3Format() {} 9 | 10 | public Base3Format(BytecodeStream stream) { 11 | super(stream); 12 | } 13 | 14 | public int getSize() { 15 | return 3; 16 | } 17 | } -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/Base4Format.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, 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 | public abstract class Base4Format extends Instruction { 7 | 8 | protected Base4Format() {} 9 | 10 | public Base4Format(BytecodeStream stream) { 11 | super(stream); 12 | } 13 | 14 | public int getSize() { 15 | return 4; 16 | } 17 | } -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/Base5Format.java: -------------------------------------------------------------------------------- 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 | public abstract class Base5Format extends Instruction { 7 | 8 | protected Base5Format() {} 9 | 10 | public Base5Format(BytecodeStream stream) { 11 | super(stream); 12 | } 13 | 14 | public int getSize() { 15 | return 5; 16 | } 17 | } -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/BytecodeStream.java: -------------------------------------------------------------------------------- 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 | public interface BytecodeStream { 7 | 8 | /** 9 | * Returns the current position from the starting index in shorts. 10 | * 11 | * @return offset from start in shorts. 12 | */ 13 | int getOffset(); 14 | 15 | /** 16 | * Returns the next short value from the stream of values. 17 | * 18 | * @return next short value in stream. 19 | */ 20 | int nextShort(); 21 | 22 | /** 23 | * Returns the next byte value from the stream, i.e., the high value of the next short followed by 24 | * the low value. 25 | * 26 | * Both bytes need to be consumed before the next call to {@link #nextShort()}. 27 | * 28 | * @return next byte value in the stream. 29 | */ 30 | int nextByte(); 31 | 32 | /** 33 | * Returns true of there are more values to be consumed. 34 | * 35 | * @return true if more values can be consumed. 36 | */ 37 | boolean hasMore(); 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/CmpLong.java: -------------------------------------------------------------------------------- 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.Cmp.Bias; 7 | import com.android.tools.r8.ir.code.NumericType; 8 | import com.android.tools.r8.ir.conversion.IRBuilder; 9 | 10 | public class CmpLong extends Format23x { 11 | 12 | public static final int OPCODE = 0x31; 13 | public static final String NAME = "CmpLong"; 14 | public static final String SMALI_NAME = "cmp-long"; 15 | 16 | CmpLong(int high, BytecodeStream stream) { 17 | super(high, stream); 18 | } 19 | 20 | public CmpLong(int dest, int left, int right) { 21 | super(dest, left, right); 22 | } 23 | 24 | public String getName() { 25 | return NAME; 26 | } 27 | 28 | public String getSmaliName() { 29 | return SMALI_NAME; 30 | } 31 | 32 | public int getOpcode() { 33 | return OPCODE; 34 | } 35 | 36 | @Override 37 | public void buildIR(IRBuilder builder) { 38 | builder.addCmp(NumericType.LONG, Bias.NONE, AA, BB, CC); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/CmpgDouble.java: -------------------------------------------------------------------------------- 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.Cmp.Bias; 7 | import com.android.tools.r8.ir.code.NumericType; 8 | import com.android.tools.r8.ir.conversion.IRBuilder; 9 | 10 | public class CmpgDouble extends Format23x { 11 | 12 | public static final int OPCODE = 0x30; 13 | public static final String NAME = "CmpgDouble"; 14 | public static final String SMALI_NAME = "cmpg-double"; 15 | 16 | CmpgDouble(int high, BytecodeStream stream) { 17 | super(high, stream); 18 | } 19 | 20 | public CmpgDouble(int dest, int left, int right) { 21 | super(dest, left, right); 22 | } 23 | 24 | public String getName() { 25 | return NAME; 26 | } 27 | 28 | public String getSmaliName() { 29 | return SMALI_NAME; 30 | } 31 | 32 | public int getOpcode() { 33 | return OPCODE; 34 | } 35 | 36 | @Override 37 | public void buildIR(IRBuilder builder) { 38 | builder.addCmp(NumericType.DOUBLE, Bias.GT, AA, BB, CC); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/CmpgFloat.java: -------------------------------------------------------------------------------- 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.Cmp.Bias; 7 | import com.android.tools.r8.ir.code.NumericType; 8 | import com.android.tools.r8.ir.conversion.IRBuilder; 9 | 10 | public class CmpgFloat extends Format23x { 11 | 12 | public static final int OPCODE = 0x2e; 13 | public static final String NAME = "CmpgFloat"; 14 | public static final String SMALI_NAME = "cmpg-float"; 15 | 16 | CmpgFloat(int high, BytecodeStream stream) { 17 | super(high, stream); 18 | } 19 | 20 | public CmpgFloat(int dest, int left, int right) { 21 | super(dest, left, right); 22 | } 23 | 24 | public String getName() { 25 | return NAME; 26 | } 27 | 28 | public String getSmaliName() { 29 | return SMALI_NAME; 30 | } 31 | 32 | public int getOpcode() { 33 | return OPCODE; 34 | } 35 | 36 | @Override 37 | public void buildIR(IRBuilder builder) { 38 | builder.addCmp(NumericType.FLOAT, Bias.GT, AA, BB, CC); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/CmplDouble.java: -------------------------------------------------------------------------------- 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.Cmp.Bias; 7 | import com.android.tools.r8.ir.code.NumericType; 8 | import com.android.tools.r8.ir.conversion.IRBuilder; 9 | 10 | public class CmplDouble extends Format23x { 11 | 12 | public static final int OPCODE = 0x2f; 13 | public static final String NAME = "CmplDouble"; 14 | public static final String SMALI_NAME = "cmpl-double"; 15 | 16 | CmplDouble(int high, BytecodeStream stream) { 17 | super(high, stream); 18 | } 19 | 20 | public CmplDouble(int dest, int left, int right) { 21 | super(dest, left, right); 22 | } 23 | 24 | public String getName() { 25 | return NAME; 26 | } 27 | 28 | public String getSmaliName() { 29 | return SMALI_NAME; 30 | } 31 | 32 | public int getOpcode() { 33 | return OPCODE; 34 | } 35 | 36 | @Override 37 | public void buildIR(IRBuilder builder) { 38 | builder.addCmp(NumericType.DOUBLE, Bias.LT, AA, BB, CC); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/CmplFloat.java: -------------------------------------------------------------------------------- 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.Cmp.Bias; 7 | import com.android.tools.r8.ir.code.NumericType; 8 | import com.android.tools.r8.ir.conversion.IRBuilder; 9 | 10 | public class CmplFloat extends Format23x { 11 | 12 | public static final int OPCODE = 0x2d; 13 | public static final String NAME = "CmplFloat"; 14 | public static final String SMALI_NAME = "cmpl-float"; 15 | 16 | CmplFloat(int high, BytecodeStream stream) { 17 | super(high, stream); 18 | } 19 | 20 | public CmplFloat(int dest, int left, int right) { 21 | super(dest, left, right); 22 | } 23 | 24 | public String getName() { 25 | return NAME; 26 | } 27 | 28 | public String getSmaliName() { 29 | return SMALI_NAME; 30 | } 31 | 32 | public int getOpcode() { 33 | return OPCODE; 34 | } 35 | 36 | @Override 37 | public void buildIR(IRBuilder builder) { 38 | builder.addCmp(NumericType.FLOAT, Bias.LT, AA, BB, CC); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/DivDouble.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | public class DivDouble extends Format23x { 9 | 10 | public static final int OPCODE = 0xae; 11 | public static final String NAME = "DivDouble"; 12 | public static final String SMALI_NAME = "div-double"; 13 | 14 | DivDouble(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public DivDouble(int dest, int left, int right) { 19 | super(dest, left, right); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addDiv(NumericType.DOUBLE, AA, BB, CC); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/DivDouble2Addr.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class DivDouble2Addr extends Format12x { 10 | 11 | public static final int OPCODE = 0xce; 12 | public static final String NAME = "DivDouble2Addr"; 13 | public static final String SMALI_NAME = "div-double/2addr"; 14 | 15 | DivDouble2Addr(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public DivDouble2Addr(int left, int right) { 20 | super(left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addDiv(NumericType.DOUBLE, A, A, B); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/DivFloat.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | public class DivFloat extends Format23x { 9 | 10 | public static final int OPCODE = 0xa9; 11 | public static final String NAME = "DivFloat"; 12 | public static final String SMALI_NAME = "div-float"; 13 | 14 | DivFloat(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public DivFloat(int dest, int left, int right) { 19 | super(dest, left, right); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addDiv(NumericType.FLOAT, AA, BB, CC); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/DivFloat2Addr.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class DivFloat2Addr extends Format12x { 10 | 11 | public static final int OPCODE = 0xc9; 12 | public static final String NAME = "DivFloat2Addr"; 13 | public static final String SMALI_NAME = "div-float/2addr"; 14 | 15 | DivFloat2Addr(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public DivFloat2Addr(int left, int right) { 20 | super(left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addDiv(NumericType.FLOAT, A, A, B); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/DivInt.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class DivInt extends Format23x { 10 | 11 | public static final int OPCODE = 0x93; 12 | public static final String NAME = "DivInt"; 13 | public static final String SMALI_NAME = "div-int"; 14 | 15 | /*package*/ DivInt(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public DivInt(int dest, int left, int right) { 20 | super(dest, left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addDiv(NumericType.INT, AA, BB, CC); 38 | } 39 | 40 | @Override 41 | public boolean canThrow() { 42 | return true; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/DivLong.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | public class DivLong extends Format23x { 9 | 10 | public static final int OPCODE = 0x9e; 11 | public static final String NAME = "DivLong"; 12 | public static final String SMALI_NAME = "div-long"; 13 | 14 | DivLong(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public DivLong(int dest, int left, int right) { 19 | super(dest, left, right); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addDiv(NumericType.LONG, AA, BB, CC); 37 | } 38 | 39 | @Override 40 | public boolean canThrow() { 41 | return true; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/DoubleToFloat.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class DoubleToFloat extends Format12x { 10 | 11 | public static final int OPCODE = 0x8c; 12 | public static final String NAME = "DoubleToFloat"; 13 | public static final String SMALI_NAME = "double-to-float"; 14 | 15 | DoubleToFloat(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public DoubleToFloat(int dest, int source) { 20 | super(dest, source); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addConversion(NumericType.FLOAT, NumericType.DOUBLE, A, B); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/DoubleToInt.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | public class DoubleToInt extends Format12x { 9 | 10 | public static final int OPCODE = 0x8a; 11 | public static final String NAME = "DoubleToInt"; 12 | public static final String SMALI_NAME = "doubleto-int"; 13 | 14 | DoubleToInt(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public DoubleToInt(int dest, int source) { 19 | super(dest, source); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addConversion(NumericType.INT, NumericType.DOUBLE, A, B); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/DoubleToLong.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | public class DoubleToLong extends Format12x { 9 | 10 | public static final int OPCODE = 0x8b; 11 | public static final String NAME = "DoubleToLong"; 12 | public static final String SMALI_NAME = "double-to-long"; 13 | 14 | DoubleToLong(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public DoubleToLong(int dest, int source) { 19 | super(dest, source); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addConversion(NumericType.LONG, NumericType.DOUBLE, A, B); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/FloatToDouble.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class FloatToDouble extends Format12x { 10 | 11 | public static final int OPCODE = 0x89; 12 | public static final String NAME = "FloatToDouble"; 13 | public static final String SMALI_NAME = "float-to-double"; 14 | 15 | FloatToDouble(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public FloatToDouble(int dest, int source) { 20 | super(dest, source); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addConversion(NumericType.DOUBLE, NumericType.FLOAT, A, B); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/FloatToInt.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class FloatToInt extends Format12x { 10 | 11 | public static final int OPCODE = 0x87; 12 | public static final String NAME = "FloatToInt"; 13 | public static final String SMALI_NAME = "float-to-int"; 14 | 15 | FloatToInt(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public FloatToInt(int dest, int source) { 20 | super(dest, source); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addConversion(NumericType.INT, NumericType.FLOAT, A, B); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/FloatToLong.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | public class FloatToLong extends Format12x { 9 | 10 | public static final int OPCODE = 0x88; 11 | public static final String NAME = "FloatToLong"; 12 | public static final String SMALI_NAME = "float-to-long"; 13 | 14 | FloatToLong(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public FloatToLong(int dest, int source) { 19 | super(dest, source); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addConversion(NumericType.LONG, NumericType.FLOAT, A, B); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/Goto.java: -------------------------------------------------------------------------------- 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.conversion.IRBuilder; 7 | 8 | public class Goto extends Format10t { 9 | 10 | public static final int OPCODE = 0x28; 11 | public static final String NAME = "Goto"; 12 | public static final String SMALI_NAME = "goto"; 13 | 14 | Goto(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public Goto(int AA) { 19 | super(AA); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public int[] getTargets() { 36 | return new int[] { AA }; 37 | } 38 | 39 | @Override 40 | public void buildIR(IRBuilder builder) { 41 | builder.addGoto(getOffset() + AA); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/Goto16.java: -------------------------------------------------------------------------------- 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.conversion.IRBuilder; 7 | 8 | public class Goto16 extends Format20t { 9 | 10 | public static final int OPCODE = 0x29; 11 | public static final String NAME = "Goto16"; 12 | public static final String SMALI_NAME = "goto/16"; 13 | 14 | Goto16(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public Goto16(int AAAA) { 19 | super(AAAA); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public int[] getTargets() { 36 | return new int[]{AAAA}; 37 | } 38 | 39 | @Override 40 | public void buildIR(IRBuilder builder) { 41 | builder.addGoto(getOffset() + AAAA); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/Goto32.java: -------------------------------------------------------------------------------- 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.conversion.IRBuilder; 7 | 8 | public class Goto32 extends Format30t { 9 | 10 | public static final int OPCODE = 0x2a; 11 | public static final String NAME = "Goto32"; 12 | public static final String SMALI_NAME = "goto/32"; 13 | 14 | Goto32(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public Goto32(int AAAAAAAA) { 19 | super(AAAAAAAA); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public int[] getTargets() { 36 | return new int[]{AAAAAAAA}; 37 | } 38 | 39 | @Override 40 | public void buildIR(IRBuilder builder) { 41 | builder.addGoto(getOffset() + AAAAAAAA); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/IfEq.java: -------------------------------------------------------------------------------- 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.If.Type; 7 | 8 | public class IfEq extends Format22t { 9 | 10 | public static final int OPCODE = 0x32; 11 | public static final String NAME = "IfEq"; 12 | public static final String SMALI_NAME = "if-eq"; 13 | 14 | IfEq(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public IfEq(int register1, int register2, int offset) { 19 | super(register1, register2, offset); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public Type getType() { 36 | return Type.EQ; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/IfEqz.java: -------------------------------------------------------------------------------- 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.If.Type; 7 | 8 | public class IfEqz extends Format21t { 9 | 10 | public static final int OPCODE = 0x38; 11 | public static final String NAME = "IfEqz"; 12 | public static final String SMALI_NAME = "if-eqz"; 13 | 14 | IfEqz(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public IfEqz(int register, int offset) { 19 | super(register, offset); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public Type getType() { 36 | return Type.EQ; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/IfGe.java: -------------------------------------------------------------------------------- 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.If.Type; 7 | 8 | public class IfGe extends Format22t { 9 | 10 | public static final int OPCODE = 0x35; 11 | public static final String NAME = "IfGe"; 12 | public static final String SMALI_NAME = "if-ge"; 13 | 14 | IfGe(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public IfGe(int register1, int register2, int offset) { 19 | super(register1, register2, offset); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public Type getType() { 36 | return Type.GE; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/IfGez.java: -------------------------------------------------------------------------------- 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.If.Type; 7 | 8 | public class IfGez extends Format21t { 9 | 10 | public static final int OPCODE = 0x3b; 11 | public static final String NAME = "IfGez"; 12 | public static final String SMALI_NAME = "if-gez"; 13 | 14 | IfGez(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public IfGez(int register, int offset) { 19 | super(register, offset); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public Type getType() { 36 | return Type.GE; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/IfGt.java: -------------------------------------------------------------------------------- 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.If.Type; 7 | 8 | public class IfGt extends Format22t { 9 | 10 | public static final int OPCODE = 0x36; 11 | public static final String NAME = "IfGt"; 12 | public static final String SMALI_NAME = "if-gt"; 13 | 14 | IfGt(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public IfGt(int register1, int register2, int offset) { 19 | super(register1, register2, offset); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public Type getType() { 36 | return Type.GT; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/IfGtz.java: -------------------------------------------------------------------------------- 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.If.Type; 7 | 8 | public class IfGtz extends Format21t { 9 | 10 | public static final int OPCODE = 0x3c; 11 | public static final String NAME = "IfGtz"; 12 | public static final String SMALI_NAME = "if-gtz"; 13 | 14 | IfGtz(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public IfGtz(int register, int offset) { 19 | super(register, offset); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public Type getType() { 36 | return Type.GT; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/IfLe.java: -------------------------------------------------------------------------------- 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.If.Type; 7 | 8 | public class IfLe extends Format22t { 9 | 10 | public static final int OPCODE = 0x37; 11 | public static final String NAME = "IfLe"; 12 | public static final String SMALI_NAME = "if-le"; 13 | 14 | IfLe(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public IfLe(int register1, int register2, int offset) { 19 | super(register1, register2, offset); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public Type getType() { 36 | return Type.LE; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/IfLez.java: -------------------------------------------------------------------------------- 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.If.Type; 7 | 8 | public class IfLez extends Format21t { 9 | 10 | public static final int OPCODE = 0x3d; 11 | public static final String NAME = "IfLez"; 12 | public static final String SMALI_NAME = "if-lez"; 13 | 14 | IfLez(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public IfLez(int register, int offset) { 19 | super(register, offset); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public Type getType() { 36 | return Type.LE; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/IfLt.java: -------------------------------------------------------------------------------- 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.If.Type; 7 | 8 | public class IfLt extends Format22t { 9 | 10 | public static final int OPCODE = 0x34; 11 | public static final String NAME = "IfLt"; 12 | public static final String SMALI_NAME = "if-lt"; 13 | 14 | IfLt(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public IfLt(int register1, int register2, int offset) { 19 | super(register1, register2, offset); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public Type getType() { 36 | return Type.LT; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/IfLtz.java: -------------------------------------------------------------------------------- 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.If.Type; 7 | 8 | public class IfLtz extends Format21t { 9 | 10 | public static final int OPCODE = 0x3a; 11 | public static final String NAME = "IfLtz"; 12 | public static final String SMALI_NAME = "if-ltz"; 13 | 14 | IfLtz(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public IfLtz(int register, int offset) { 19 | super(register, offset); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public Type getType() { 36 | return Type.LT; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/IfNe.java: -------------------------------------------------------------------------------- 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.If.Type; 7 | 8 | public class IfNe extends Format22t { 9 | 10 | public static final int OPCODE = 0x33; 11 | public static final String NAME = "IfNe"; 12 | public static final String SMALI_NAME = "if-ne"; 13 | 14 | IfNe(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public IfNe(int register1, int register2, int offset) { 19 | super(register1, register2, offset); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public Type getType() { 36 | return Type.NE; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/IfNez.java: -------------------------------------------------------------------------------- 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.If.Type; 7 | 8 | public class IfNez extends Format21t { 9 | 10 | public static final int OPCODE = 0x39; 11 | public static final String NAME = "IfNez"; 12 | public static final String SMALI_NAME = "if-nez"; 13 | 14 | IfNez(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public IfNez(int register, int offset) { 19 | super(register, offset); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public Type getType() { 36 | return Type.NE; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/IntToByte.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | public class IntToByte extends Format12x { 9 | 10 | public static final int OPCODE = 0x8d; 11 | public static final String NAME = "IntToByte"; 12 | public static final String SMALI_NAME = "int-to-byte"; 13 | 14 | IntToByte(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public IntToByte(int dest, int source) { 19 | super(dest, source); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addConversion(NumericType.BYTE, NumericType.INT, A, B); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/IntToChar.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class IntToChar extends Format12x { 10 | 11 | public static final int OPCODE = 0x8e; 12 | public static final String NAME = "IntToChar"; 13 | public static final String SMALI_NAME = "int-to-char"; 14 | 15 | IntToChar(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public IntToChar(int dest, int source) { 20 | super(dest, source); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addConversion(NumericType.CHAR, NumericType.INT, A, B); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/IntToDouble.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class IntToDouble extends Format12x { 10 | 11 | public static final int OPCODE = 0x83; 12 | public static final String NAME = "IntToDouble"; 13 | public static final String SMALI_NAME = "int-to-double"; 14 | 15 | IntToDouble(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public IntToDouble(int dest, int source) { 20 | super(dest, source); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addConversion(NumericType.DOUBLE, NumericType.INT, A, B); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/IntToFloat.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | public class IntToFloat extends Format12x { 9 | 10 | public static final int OPCODE = 0x82; 11 | public static final String NAME = "IntToFloat"; 12 | public static final String SMALI_NAME = "int-to-float"; 13 | 14 | IntToFloat(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public IntToFloat(int dest, int source) { 19 | super(dest, source); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addConversion(NumericType.FLOAT, NumericType.INT, A, B); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/IntToLong.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class IntToLong extends Format12x { 10 | 11 | public static final int OPCODE = 0x81; 12 | public static final String NAME = "IntToLong"; 13 | public static final String SMALI_NAME = "int-to-long"; 14 | 15 | IntToLong(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public IntToLong(int dest, int source) { 20 | super(dest, source); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addConversion(NumericType.LONG, NumericType.INT, A, B); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/IntToShort.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class IntToShort extends Format12x { 10 | 11 | public static final int OPCODE = 0x8f; 12 | public static final String NAME = "IntToShort"; 13 | public static final String SMALI_NAME = "int-to-short"; 14 | 15 | IntToShort(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public IntToShort(int dest, int source) { 20 | super(dest, source); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addConversion(NumericType.SHORT, NumericType.INT, A, B); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/LongToDouble.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | public class LongToDouble extends Format12x { 9 | 10 | public static final int OPCODE = 0x86; 11 | public static final String NAME = "LongToDouble"; 12 | public static final String SMALI_NAME = "long-to-double"; 13 | 14 | LongToDouble(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public LongToDouble(int dest, int source) { 19 | super(dest, source); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addConversion(NumericType.DOUBLE, NumericType.LONG, A, B); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/LongToFloat.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | public class LongToFloat extends Format12x { 9 | 10 | public static final int OPCODE = 0x85; 11 | public static final String NAME = "LongToFloat"; 12 | public static final String SMALI_NAME = "long-to-float"; 13 | 14 | LongToFloat(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public LongToFloat(int dest, int source) { 19 | super(dest, source); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addConversion(NumericType.FLOAT, NumericType.LONG, A, B); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/LongToInt.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class LongToInt extends Format12x { 10 | 11 | public static final int OPCODE = 0x84; 12 | public static final String NAME = "LongToInt"; 13 | public static final String SMALI_NAME = "long-to-int"; 14 | 15 | LongToInt(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public LongToInt(int dest, int source) { 20 | super(dest, source); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addConversion(NumericType.INT, NumericType.LONG, A, B); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/MonitorEnter.java: -------------------------------------------------------------------------------- 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.Monitor.Type; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | public class MonitorEnter extends Format11x { 9 | 10 | public static final int OPCODE = 0x1d; 11 | public static final String NAME = "MonitorEnter"; 12 | public static final String SMALI_NAME = "monitor-enter"; 13 | 14 | MonitorEnter(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public MonitorEnter(int register) { 19 | super(register); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addMonitor(Type.ENTER, AA); 37 | } 38 | 39 | @Override 40 | public boolean canThrow() { 41 | return true; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/MonitorExit.java: -------------------------------------------------------------------------------- 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.Monitor.Type; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | public class MonitorExit extends Format11x { 9 | 10 | public static final int OPCODE = 0x1e; 11 | public static final String NAME = "MonitorExit"; 12 | public static final String SMALI_NAME = "monitor-exit"; 13 | 14 | MonitorExit(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public MonitorExit(int register) { 19 | super(register); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addMonitor(Type.EXIT, AA); 37 | } 38 | 39 | @Override 40 | public boolean canThrow() { 41 | return true; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/Move.java: -------------------------------------------------------------------------------- 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.conversion.IRBuilder; 8 | 9 | public class Move extends Format12x { 10 | 11 | public static final int OPCODE = 0x1; 12 | public static final String NAME = "Move"; 13 | public static final String SMALI_NAME = "move"; 14 | 15 | Move(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public Move(int dest, int src) { 20 | super(dest, src); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addMove(MoveType.SINGLE, A, B); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/Move16.java: -------------------------------------------------------------------------------- 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.conversion.IRBuilder; 8 | public class Move16 extends Format32x { 9 | 10 | public static final int OPCODE = 0x3; 11 | public static final String NAME = "Move16"; 12 | public static final String SMALI_NAME = "move/16"; 13 | 14 | Move16(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public Move16(int dest, int src) { 19 | super(dest, src); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addMove(MoveType.SINGLE, AAAA, BBBB); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/MoveException.java: -------------------------------------------------------------------------------- 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.conversion.IRBuilder; 7 | 8 | public class MoveException extends Format11x { 9 | 10 | public static final int OPCODE = 0xd; 11 | public static final String NAME = "MoveException"; 12 | public static final String SMALI_NAME = "move-exception"; 13 | 14 | MoveException(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public MoveException(int AA) { 19 | super(AA); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addMoveException(AA); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/MoveFrom16.java: -------------------------------------------------------------------------------- 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.conversion.IRBuilder; 8 | public class MoveFrom16 extends Format22x { 9 | 10 | public static final int OPCODE = 0x2; 11 | public static final String NAME = "MoveFrom16"; 12 | public static final String SMALI_NAME = "move-from/16"; 13 | 14 | MoveFrom16(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public MoveFrom16(int dest, int src) { 19 | super(dest, src); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addMove(MoveType.SINGLE, AA, BBBB); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/MoveObject.java: -------------------------------------------------------------------------------- 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.conversion.IRBuilder; 8 | 9 | public class MoveObject extends Format12x { 10 | 11 | public static final int OPCODE = 0x7; 12 | public static final String NAME = "MoveObject"; 13 | public static final String SMALI_NAME = "move-object"; 14 | 15 | MoveObject(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public MoveObject(int dest, int src) { 20 | super(dest, src); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addMove(MoveType.OBJECT, A, B); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/MoveObject16.java: -------------------------------------------------------------------------------- 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.conversion.IRBuilder; 8 | 9 | public class MoveObject16 extends Format32x { 10 | 11 | public static final int OPCODE = 0x9; 12 | public static final String NAME = "MoveObject16"; 13 | public static final String SMALI_NAME = "move-object/16"; 14 | 15 | MoveObject16(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public MoveObject16(int dest, int src) { 20 | super(dest, src); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addMove(MoveType.OBJECT, AAAA, BBBB); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/MoveObjectFrom16.java: -------------------------------------------------------------------------------- 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.conversion.IRBuilder; 8 | public class MoveObjectFrom16 extends Format22x { 9 | 10 | public static final int OPCODE = 0x8; 11 | public static final String NAME = "MoveObjectFrom16"; 12 | public static final String SMALI_NAME = "move-object-from/16"; 13 | 14 | MoveObjectFrom16(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public MoveObjectFrom16(int dest, int src) { 19 | super(dest, src); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addMove(MoveType.OBJECT, AA, BBBB); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/MoveResult.java: -------------------------------------------------------------------------------- 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.conversion.IRBuilder; 8 | public class MoveResult extends Format11x { 9 | 10 | public static final int OPCODE = 0xa; 11 | public static final String NAME = "MoveResult"; 12 | public static final String SMALI_NAME = "move-result"; 13 | 14 | /*package*/ MoveResult(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public MoveResult(int AA) { 19 | super(AA); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addMoveResult(MoveType.SINGLE, AA); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/MoveResultObject.java: -------------------------------------------------------------------------------- 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.conversion.IRBuilder; 8 | 9 | public class MoveResultObject extends Format11x { 10 | 11 | public static final int OPCODE = 0xc; 12 | public static final String NAME = "MoveResultObject"; 13 | public static final String SMALI_NAME = "move-result-object"; 14 | 15 | /*package*/ MoveResultObject(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public MoveResultObject(int AA) { 20 | super(AA); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addMoveResult(MoveType.OBJECT, AA); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/MoveResultWide.java: -------------------------------------------------------------------------------- 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.conversion.IRBuilder; 8 | 9 | public class MoveResultWide extends Format11x { 10 | 11 | public static final int OPCODE = 0xb; 12 | public static final String NAME = "MoveResultWide"; 13 | public static final String SMALI_NAME = "move-result-wide"; 14 | 15 | /*package*/ MoveResultWide(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public MoveResultWide(int AA) { 20 | super(AA); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addMoveResult(MoveType.WIDE, AA); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/MoveWide.java: -------------------------------------------------------------------------------- 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.conversion.IRBuilder; 8 | public class MoveWide extends Format12x { 9 | 10 | public static final int OPCODE = 0x4; 11 | public static final String NAME = "MoveWide"; 12 | public static final String SMALI_NAME = "move-wide"; 13 | 14 | MoveWide(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public MoveWide(int dest, int src) { 19 | super(dest, src); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addMove(MoveType.WIDE, A, B); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/MoveWide16.java: -------------------------------------------------------------------------------- 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.conversion.IRBuilder; 8 | public class MoveWide16 extends Format32x { 9 | 10 | public static final int OPCODE = 0x6; 11 | public static final String NAME = "MoveWide16"; 12 | public static final String SMALI_NAME = "move-wide/16"; 13 | 14 | MoveWide16(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public MoveWide16(int dest, int src) { 19 | super(dest, src); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addMove(MoveType.WIDE, AAAA, BBBB); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/MoveWideFrom16.java: -------------------------------------------------------------------------------- 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.conversion.IRBuilder; 8 | public class MoveWideFrom16 extends Format22x { 9 | 10 | public static final int OPCODE = 0x5; 11 | public static final String NAME = "MoveWideFrom16"; 12 | public static final String SMALI_NAME = "move-wide-from/16"; 13 | 14 | MoveWideFrom16(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public MoveWideFrom16(int dest, int src) { 19 | super(dest, src); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addMove(MoveType.WIDE, AA, BBBB); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/MulDouble2Addr.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class MulDouble2Addr extends Format12x { 10 | 11 | public static final int OPCODE = 0xcd; 12 | public static final String NAME = "MulDouble2Addr"; 13 | public static final String SMALI_NAME = "mul-double/2addr"; 14 | 15 | MulDouble2Addr(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public MulDouble2Addr(int left, int right) { 20 | super(left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addMul(NumericType.DOUBLE, A, A, B); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/MulFloat2Addr.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class MulFloat2Addr extends Format12x { 10 | 11 | public static final int OPCODE = 0xc8; 12 | public static final String NAME = "MulFloat2Addr"; 13 | public static final String SMALI_NAME = "mul-float/2addr"; 14 | 15 | MulFloat2Addr(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public MulFloat2Addr(int left, int right) { 20 | super(left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addMul(NumericType.FLOAT, A, A, B); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/MulInt2Addr.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | public class MulInt2Addr extends Format12x { 9 | 10 | public static final int OPCODE = 0xb2; 11 | public static final String NAME = "MulInt2Addr"; 12 | public static final String SMALI_NAME = "mul-int/2addr"; 13 | 14 | MulInt2Addr(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public MulInt2Addr(int left, int right) { 19 | super(left, right); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addMul(NumericType.INT, A, A, B); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/MulIntLit16.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class MulIntLit16 extends Format22s { 10 | 11 | public static final int OPCODE = 0xd2; 12 | public static final String NAME = "MulIntLit16"; 13 | public static final String SMALI_NAME = "mul-int/lit16"; 14 | 15 | MulIntLit16(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public MulIntLit16(int dest, int register, int constant) { 20 | super(dest, register, constant); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addMulLiteral(NumericType.INT, A, B, CCCC); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/MulIntLit8.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class MulIntLit8 extends Format22b { 10 | 11 | public static final int OPCODE = 0xda; 12 | public static final String NAME = "MulIntLit8"; 13 | public static final String SMALI_NAME = "mul-int/lit8"; 14 | 15 | MulIntLit8(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public MulIntLit8(int dest, int register, int constant) { 20 | super(dest, register, constant); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addMulLiteral(NumericType.INT, AA, BB, CC); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/MulLong2Addr.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class MulLong2Addr extends Format12x { 10 | 11 | public static final int OPCODE = 0xbd; 12 | public static final String NAME = "MulLong2Addr"; 13 | public static final String SMALI_NAME = "mul-long/2addr"; 14 | 15 | MulLong2Addr(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public MulLong2Addr(int left, int right) { 20 | super(left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addMul(NumericType.LONG, A, A, B); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/NegDouble.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | public class NegDouble extends Format12x { 9 | 10 | public static final int OPCODE = 0x80; 11 | public static final String NAME = "NegDouble"; 12 | public static final String SMALI_NAME = "neg-double"; 13 | 14 | /*package*/ NegDouble(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public NegDouble(int dest, int source) { 19 | super(dest, source); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addNeg(NumericType.DOUBLE, A, B); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/NegFloat.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class NegFloat extends Format12x { 10 | 11 | public static final int OPCODE = 0x7f; 12 | public static final String NAME = "NegFloat"; 13 | public static final String SMALI_NAME = "neg-float"; 14 | 15 | /*package*/ NegFloat(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public NegFloat(int dest, int source) { 20 | super(dest, source); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addNeg(NumericType.FLOAT, A, B); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/NegInt.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class NegInt extends Format12x { 10 | 11 | public static final int OPCODE = 0x7b; 12 | public static final String NAME = "NegInt"; 13 | public static final String SMALI_NAME = "neg-int"; 14 | 15 | /*package*/ NegInt(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public NegInt(int dest, int source) { 20 | super(dest, source); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addNeg(NumericType.INT, A, B); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/NegLong.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | public class NegLong extends Format12x { 9 | 10 | public static final int OPCODE = 0x7d; 11 | public static final String NAME = "NegLong"; 12 | public static final String SMALI_NAME = "neg-long"; 13 | 14 | /*package*/ NegLong(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public NegLong(int dest, int source) { 19 | super(dest, source); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addNeg(NumericType.LONG, A, B); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/NotInt.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class NotInt extends Format12x { 10 | 11 | public static final int OPCODE = 0x7c; 12 | public static final String NAME = "NotInt"; 13 | public static final String SMALI_NAME = "not-int"; 14 | 15 | NotInt(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public NotInt(int dest, int source) { 20 | super(dest, source); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addNot(NumericType.INT, A, B); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/NotLong.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | public class NotLong extends Format12x { 9 | 10 | public static final int OPCODE = 0x7e; 11 | public static final String NAME = "NotLong"; 12 | public static final String SMALI_NAME = "not-long"; 13 | 14 | NotLong(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public NotLong(int dest, int source) { 19 | super(dest, source); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addNot(NumericType.LONG, A, B); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/OrInt.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | public class OrInt extends Format23x { 9 | 10 | public static final int OPCODE = 0x96; 11 | public static final String NAME = "OrInt"; 12 | public static final String SMALI_NAME = "or-int"; 13 | 14 | OrInt(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public OrInt(int dest, int left, int right) { 19 | super(dest, left, right); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addOr(NumericType.INT, AA, BB, CC); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/OrInt2Addr.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class OrInt2Addr extends Format12x { 10 | 11 | public static final int OPCODE = 0xb6; 12 | public static final String NAME = "OrInt2Addr"; 13 | public static final String SMALI_NAME = "or-int/2addr"; 14 | 15 | OrInt2Addr(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public OrInt2Addr(int left, int right) { 20 | super(left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addOr(NumericType.INT, A, A, B); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/OrIntLit16.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class OrIntLit16 extends Format22s { 10 | 11 | public static final int OPCODE = 0xd6; 12 | public static final String NAME = "OrIntLit16"; 13 | public static final String SMALI_NAME = "or-int/lit16"; 14 | 15 | OrIntLit16(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public OrIntLit16(int dest, int register, int constant) { 20 | super(dest, register, constant); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addOrLiteral(NumericType.INT, A, B, CCCC); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/OrIntLit8.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class OrIntLit8 extends Format22b { 10 | 11 | public static final int OPCODE = 0xde; 12 | public static final String NAME = "OrIntLit8"; 13 | public static final String SMALI_NAME = "or-int/lit8"; 14 | 15 | OrIntLit8(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public OrIntLit8(int dest, int register, int constant) { 20 | super(dest, register, constant); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addOrLiteral(NumericType.INT, AA, BB, CC); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/OrLong.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | public class OrLong extends Format23x { 9 | 10 | public static final int OPCODE = 0xA1; 11 | public static final String NAME = "OrLong"; 12 | public static final String SMALI_NAME = "or-long"; 13 | 14 | OrLong(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public OrLong(int dest, int left, int right) { 19 | super(dest, left, right); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addOr(NumericType.LONG, AA, BB, CC); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/OrLong2Addr.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class OrLong2Addr extends Format12x { 10 | 11 | public static final int OPCODE = 0xc1; 12 | public static final String NAME = "OrLong2Addr"; 13 | public static final String SMALI_NAME = "or-long/2addr"; 14 | 15 | OrLong2Addr(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public OrLong2Addr(int left, int right) { 20 | super(left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addOr(NumericType.LONG, A, A, B); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/RemDouble.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class RemDouble extends Format23x { 10 | 11 | public static final int OPCODE = 0xaf; 12 | public static final String NAME = "RemDouble"; 13 | public static final String SMALI_NAME = "rem-double"; 14 | 15 | RemDouble(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public RemDouble(int dest, int left, int right) { 20 | super(dest, left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addRem(NumericType.DOUBLE, AA, BB, CC); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/RemDouble2Addr.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | public class RemDouble2Addr extends Format12x { 9 | 10 | public static final int OPCODE = 0xcf; 11 | public static final String NAME = "RemDouble2Addr"; 12 | public static final String SMALI_NAME = "rem-double/2addr"; 13 | 14 | RemDouble2Addr(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public RemDouble2Addr(int left, int right) { 19 | super(left, right); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addRem(NumericType.DOUBLE, A, A, B); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/RemFloat.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | public class RemFloat extends Format23x { 9 | 10 | public static final int OPCODE = 0xaA; 11 | public static final String NAME = "RemFloat"; 12 | public static final String SMALI_NAME = "rem-float"; 13 | 14 | RemFloat(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public RemFloat(int dest, int left, int right) { 19 | super(dest, left, right); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addRem(NumericType.FLOAT, AA, BB, CC); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/RemFloat2Addr.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | public class RemFloat2Addr extends Format12x { 9 | 10 | public static final int OPCODE = 0xca; 11 | public static final String NAME = "RemFloat2Addr"; 12 | public static final String SMALI_NAME = "rem-float/2addr"; 13 | 14 | RemFloat2Addr(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public RemFloat2Addr(int left, int right) { 19 | super(left, right); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addRem(NumericType.FLOAT, A, A, B); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/RemInt.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class RemInt extends Format23x { 10 | 11 | public static final int OPCODE = 0x94; 12 | public static final String NAME = "RemInt"; 13 | public static final String SMALI_NAME = "rem-int"; 14 | 15 | RemInt(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public RemInt(int dest, int left, int right) { 20 | super(dest, left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addRem(NumericType.INT, AA, BB, CC); 38 | } 39 | 40 | @Override 41 | public boolean canThrow() { 42 | return true; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/RemInt2Addr.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class RemInt2Addr extends Format12x { 10 | 11 | public static final int OPCODE = 0xb4; 12 | public static final String NAME = "RemInt2Addr"; 13 | public static final String SMALI_NAME = "rem-int/2addr"; 14 | 15 | RemInt2Addr(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public RemInt2Addr(int left, int right) { 20 | super(left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addRem(NumericType.INT, A, A, B); 38 | } 39 | 40 | @Override 41 | public boolean canThrow() { 42 | return true; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/RemLong.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class RemLong extends Format23x { 10 | 11 | public static final int OPCODE = 0x9f; 12 | public static final String NAME = "RemLong"; 13 | public static final String SMALI_NAME = "rem-long"; 14 | 15 | RemLong(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public RemLong(int dest, int left, int right) { 20 | super(dest, left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addRem(NumericType.LONG, AA, BB, CC); 38 | } 39 | 40 | @Override 41 | public boolean canThrow() { 42 | return true; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/Return.java: -------------------------------------------------------------------------------- 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.conversion.IRBuilder; 8 | 9 | public class Return extends Format11x { 10 | 11 | public static final int OPCODE = 0xf; 12 | public static final String NAME = "Return"; 13 | public static final String SMALI_NAME = "return"; 14 | 15 | Return(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public Return(int AA) { 20 | super(AA); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public int[] getTargets() { 37 | return EXIT_TARGET; 38 | } 39 | 40 | @Override 41 | public void buildIR(IRBuilder builder) { 42 | builder.addReturn(MoveType.SINGLE, AA); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/ReturnObject.java: -------------------------------------------------------------------------------- 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.conversion.IRBuilder; 8 | 9 | public class ReturnObject extends Format11x { 10 | 11 | public static final int OPCODE = 0x11; 12 | public static final String NAME = "ReturnObject"; 13 | public static final String SMALI_NAME = "return-object"; 14 | 15 | ReturnObject(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public ReturnObject(int AA) { 20 | super(AA); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public int[] getTargets() { 37 | return EXIT_TARGET; 38 | } 39 | 40 | @Override 41 | public void buildIR(IRBuilder builder) { 42 | builder.addReturn(MoveType.OBJECT, AA); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/ReturnVoid.java: -------------------------------------------------------------------------------- 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.conversion.IRBuilder; 7 | 8 | public class ReturnVoid extends Format10x { 9 | 10 | public static final int OPCODE = 0xe; 11 | public static final String NAME = "ReturnVoid"; 12 | public static final String SMALI_NAME = "return-void"; 13 | 14 | ReturnVoid(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public ReturnVoid() {} 19 | 20 | public String getName() { 21 | return NAME; 22 | } 23 | 24 | public String getSmaliName() { 25 | return SMALI_NAME; 26 | } 27 | 28 | public int getOpcode() { 29 | return OPCODE; 30 | } 31 | 32 | @Override 33 | public int[] getTargets() { 34 | return EXIT_TARGET; 35 | } 36 | 37 | @Override 38 | public void buildIR(IRBuilder builder) { 39 | builder.addReturn(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/ReturnWide.java: -------------------------------------------------------------------------------- 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.conversion.IRBuilder; 8 | 9 | public class ReturnWide extends Format11x { 10 | 11 | public static final int OPCODE = 0x10; 12 | public static final String NAME = "ReturnWide"; 13 | public static final String SMALI_NAME = "return-wide"; 14 | 15 | ReturnWide(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public ReturnWide(int AA) { 20 | super(AA); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public int[] getTargets() { 37 | return EXIT_TARGET; 38 | } 39 | 40 | @Override 41 | public void buildIR(IRBuilder builder) { 42 | builder.addReturn(MoveType.WIDE, AA); 43 | } 44 | } -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/RsubInt.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class RsubInt extends Format22s { 10 | 11 | public static final int OPCODE = 0xd1; 12 | public static final String NAME = "RsubInt"; 13 | public static final String SMALI_NAME = "rsub-int"; 14 | 15 | RsubInt(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public RsubInt(int dest, int register, int constant) { 20 | super(dest, register, constant); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addRsubLiteral(NumericType.INT, A, B, CCCC); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/RsubIntLit8.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | public class RsubIntLit8 extends Format22b { 9 | 10 | public static final int OPCODE = 0xd9; 11 | public static final String NAME = "RsubIntLit8"; 12 | public static final String SMALI_NAME = "rsub-int/lit8"; 13 | 14 | RsubIntLit8(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public RsubIntLit8(int dest, int register, int constant) { 19 | super(dest, register, constant); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addRsubLiteral(NumericType.INT, AA, BB, CC); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/ShlInt.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class ShlInt extends Format23x { 10 | 11 | public static final int OPCODE = 0x98; 12 | public static final String NAME = "ShlInt"; 13 | public static final String SMALI_NAME = "shl-int"; 14 | 15 | ShlInt(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public ShlInt(int dest, int left, int right) { 20 | super(dest, left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addShl(NumericType.INT, AA, BB, CC); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/ShlInt2Addr.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class ShlInt2Addr extends Format12x { 10 | 11 | public static final int OPCODE = 0xb8; 12 | public static final String NAME = "ShlInt2Addr"; 13 | public static final String SMALI_NAME = "shl-int/2addr"; 14 | 15 | ShlInt2Addr(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public ShlInt2Addr(int left, int right) { 20 | super(left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addShl(NumericType.INT, A, A, B); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/ShlIntLit8.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | public class ShlIntLit8 extends Format22b { 9 | 10 | public static final int OPCODE = 0xe0; 11 | public static final String NAME = "ShlIntLit8"; 12 | public static final String SMALI_NAME = "shl-int/lit8"; 13 | 14 | ShlIntLit8(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public ShlIntLit8(int dest, int register, int constant) { 19 | super(dest, register, constant); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addShlLiteral(NumericType.INT, AA, BB, CC); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/ShlLong.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class ShlLong extends Format23x { 10 | 11 | public static final int OPCODE = 0xA3; 12 | public static final String NAME = "ShlLong"; 13 | public static final String SMALI_NAME = "shl-long"; 14 | 15 | ShlLong(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public ShlLong(int dest, int left, int right) { 20 | super(dest, left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addShl(NumericType.LONG, AA, BB, CC); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/ShlLong2Addr.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class ShlLong2Addr extends Format12x { 10 | 11 | public static final int OPCODE = 0xc3; 12 | public static final String NAME = "ShlLong2Addr"; 13 | public static final String SMALI_NAME = "shl-long/2addr"; 14 | 15 | ShlLong2Addr(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public ShlLong2Addr(int left, int right) { 20 | super(left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addShl(NumericType.LONG, A, A, B); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/ShrInt.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class ShrInt extends Format23x { 10 | 11 | public static final int OPCODE = 0x99; 12 | public static final String NAME = "ShrInt"; 13 | public static final String SMALI_NAME = "shr-int"; 14 | 15 | ShrInt(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public ShrInt(int dest, int left, int right) { 20 | super(dest, left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addShr(NumericType.INT, AA, BB, CC); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/ShrInt2Addr.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class ShrInt2Addr extends Format12x { 10 | 11 | public static final int OPCODE = 0xb9; 12 | public static final String NAME = "ShrInt2Addr"; 13 | public static final String SMALI_NAME = "shr-int/2addr"; 14 | 15 | ShrInt2Addr(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public ShrInt2Addr(int left, int right) { 20 | super(left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addShr(NumericType.INT, A, A, B); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/ShrIntLit8.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class ShrIntLit8 extends Format22b { 10 | 11 | public static final int OPCODE = 0xe1; 12 | public static final String NAME = "ShrIntLit8"; 13 | public static final String SMALI_NAME = "shr-int/lit8"; 14 | 15 | ShrIntLit8(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public ShrIntLit8(int dest, int register, int constant) { 20 | super(dest, register, constant); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addShrLiteral(NumericType.INT, AA, BB, CC); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/ShrLong.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class ShrLong extends Format23x { 10 | 11 | public static final int OPCODE = 0xA4; 12 | public static final String NAME = "ShrLong"; 13 | public static final String SMALI_NAME = "shr-long"; 14 | 15 | ShrLong(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public ShrLong(int dest, int left, int right) { 20 | super(dest, left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addShr(NumericType.LONG, AA, BB, CC); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/ShrLong2Addr.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class ShrLong2Addr extends Format12x { 10 | 11 | public static final int OPCODE = 0xc4; 12 | public static final String NAME = "ShrLong2Addr"; 13 | public static final String SMALI_NAME = "shr-long/2addr"; 14 | 15 | ShrLong2Addr(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public ShrLong2Addr(int left, int right) { 20 | super(left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addShr(NumericType.LONG, A, A, B); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/SubDouble.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class SubDouble extends Format23x { 10 | 11 | public static final int OPCODE = 0xac; 12 | public static final String NAME = "SubDouble"; 13 | public static final String SMALI_NAME = "sub-double"; 14 | 15 | SubDouble(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public SubDouble(int dest, int left, int right) { 20 | super(dest, left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addSub(NumericType.DOUBLE, AA, BB, CC); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/SubDouble2Addr.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class SubDouble2Addr extends Format12x { 10 | 11 | public static final int OPCODE = 0xcc; 12 | public static final String NAME = "SubDouble2Addr"; 13 | public static final String SMALI_NAME = "sub-double/2addr"; 14 | 15 | SubDouble2Addr(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public SubDouble2Addr(int left, int right) { 20 | super(left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addSub(NumericType.DOUBLE, A, A, B); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/SubFloat.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class SubFloat extends Format23x { 10 | 11 | public static final int OPCODE = 0xA7; 12 | public static final String NAME = "SubFloat"; 13 | public static final String SMALI_NAME = "sub-float"; 14 | 15 | SubFloat(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public SubFloat(int dest, int left, int right) { 20 | super(dest, left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addSub(NumericType.FLOAT, AA, BB, CC); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/SubFloat2Addr.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class SubFloat2Addr extends Format12x { 10 | 11 | public static final int OPCODE = 0xc7; 12 | public static final String NAME = "SubFloat2Addr"; 13 | public static final String SMALI_NAME = "sub-float/2addr"; 14 | 15 | SubFloat2Addr(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public SubFloat2Addr(int left, int right) { 20 | super(left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addSub(NumericType.FLOAT, A, A, B); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/SubInt.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class SubInt extends Format23x { 10 | 11 | public static final int OPCODE = 0x91; 12 | public static final String NAME = "SubInt"; 13 | public static final String SMALI_NAME = "sub-int"; 14 | 15 | SubInt(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public SubInt(int dest, int left, int right) { 20 | super(dest, left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addSub(NumericType.INT, AA, BB, CC); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/SubInt2Addr.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | public class SubInt2Addr extends Format12x { 9 | 10 | public static final int OPCODE = 0xb1; 11 | public static final String NAME = "SubInt2Addr"; 12 | public static final String SMALI_NAME = "sub-int/2addr"; 13 | 14 | SubInt2Addr(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public SubInt2Addr(int left, int right) { 19 | super(left, right); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addSub(NumericType.INT, A, A, B); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/SubLong.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class SubLong extends Format23x { 10 | 11 | public static final int OPCODE = 0x9c; 12 | public static final String NAME = "SubLong"; 13 | public static final String SMALI_NAME = "sub-long"; 14 | 15 | SubLong(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public SubLong(int dest, int left, int right) { 20 | super(dest, left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addSub(NumericType.LONG, AA, BB, CC); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/SubLong2Addr.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | public class SubLong2Addr extends Format12x { 9 | 10 | public static final int OPCODE = 0xbc; 11 | public static final String NAME = "SubLong2Addr"; 12 | public static final String SMALI_NAME = "sub-long/2addr"; 13 | 14 | SubLong2Addr(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public SubLong2Addr(int left, int right) { 19 | super(left, right); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addSub(NumericType.LONG, A, A, B); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/SwitchPayload.java: -------------------------------------------------------------------------------- 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 | 5 | package com.android.tools.r8.code; 6 | 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public abstract class SwitchPayload extends Nop { 10 | SwitchPayload(int high, BytecodeStream stream) { 11 | super(high, stream); 12 | } 13 | 14 | public SwitchPayload() { 15 | } 16 | 17 | public abstract int[] keys(); 18 | public abstract int numberOfKeys(); 19 | public abstract int[] switchTargetOffsets(); 20 | 21 | @Override 22 | public boolean isSwitchPayload() { 23 | return true; 24 | } 25 | 26 | @Override 27 | public void buildIR(IRBuilder builder) { 28 | // Switch payloads are not represented in the IR. 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/Throw.java: -------------------------------------------------------------------------------- 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.conversion.IRBuilder; 7 | 8 | public class Throw extends Format11x { 9 | 10 | public static final int OPCODE = 0x27; 11 | public static final String NAME = "Throw"; 12 | public static final String SMALI_NAME = "throw"; 13 | 14 | Throw(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public Throw(int AA) { 19 | super(AA); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addThrow(AA); 37 | } 38 | 39 | @Override 40 | public boolean canThrow() { 41 | return true; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/UshrInt.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class UshrInt extends Format23x { 10 | 11 | public static final int OPCODE = 0x9A; 12 | public static final String NAME = "UshrInt"; 13 | public static final String SMALI_NAME = "ushr-int"; 14 | 15 | UshrInt(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public UshrInt(int dest, int left, int right) { 20 | super(dest, left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addUshr(NumericType.INT, AA, BB, CC); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/UshrInt2Addr.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class UshrInt2Addr extends Format12x { 10 | 11 | public static final int OPCODE = 0xba; 12 | public static final String NAME = "UshrInt2Addr"; 13 | public static final String SMALI_NAME = "ushr-int/2addr"; 14 | 15 | UshrInt2Addr(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public UshrInt2Addr(int left, int right) { 20 | super(left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addUshr(NumericType.INT, A, A, B); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/UshrIntLit8.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class UshrIntLit8 extends Format22b { 10 | 11 | public static final int OPCODE = 0xe2; 12 | public static final String NAME = "UshrIntLit8"; 13 | public static final String SMALI_NAME = "ushr-int/lit8"; 14 | 15 | UshrIntLit8(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public UshrIntLit8(int dest, int register, int constant) { 20 | super(dest, register, constant); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addUshrLiteral(NumericType.INT, AA, BB, CC); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/UshrLong.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | public class UshrLong extends Format23x { 9 | 10 | public static final int OPCODE = 0xa5; 11 | public static final String NAME = "UshrLong"; 12 | public static final String SMALI_NAME = "ushr-long"; 13 | 14 | UshrLong(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public UshrLong(int dest, int left, int right) { 19 | super(dest, left, right); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addUshr(NumericType.LONG, AA, BB, CC); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/UshrLong2Addr.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class UshrLong2Addr extends Format12x { 10 | 11 | public static final int OPCODE = 0xc5; 12 | public static final String NAME = "UshrLong2Addr"; 13 | public static final String SMALI_NAME = "ushr-long/2addr"; 14 | 15 | UshrLong2Addr(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public UshrLong2Addr(int left, int right) { 20 | super(left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addUshr(NumericType.LONG, A, A, B); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/XorInt.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class XorInt extends Format23x { 10 | 11 | public static final int OPCODE = 0x97; 12 | public static final String NAME = "XorInt"; 13 | public static final String SMALI_NAME = "xor-int"; 14 | 15 | XorInt(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public XorInt(int dest, int left, int right) { 20 | super(dest, left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addXor(NumericType.INT, AA, BB, CC); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/XorInt2Addr.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | public class XorInt2Addr extends Format12x { 9 | 10 | public static final int OPCODE = 0xb7; 11 | public static final String NAME = "XorInt2Addr"; 12 | public static final String SMALI_NAME = "xor-int/2addr"; 13 | 14 | XorInt2Addr(int high, BytecodeStream stream) { 15 | super(high, stream); 16 | } 17 | 18 | public XorInt2Addr(int left, int right) { 19 | super(left, right); 20 | } 21 | 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | public String getSmaliName() { 27 | return SMALI_NAME; 28 | } 29 | 30 | public int getOpcode() { 31 | return OPCODE; 32 | } 33 | 34 | @Override 35 | public void buildIR(IRBuilder builder) { 36 | builder.addXor(NumericType.INT, A, A, B); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/XorIntLit16.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class XorIntLit16 extends Format22s { 10 | 11 | public static final int OPCODE = 0xd7; 12 | public static final String NAME = "XorIntLit16"; 13 | public static final String SMALI_NAME = "xor-int/lit16"; 14 | 15 | XorIntLit16(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public XorIntLit16(int dest, int register, int constant) { 20 | super(dest, register, constant); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addXorLiteral(NumericType.INT, A, B, CCCC); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/XorIntLit8.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class XorIntLit8 extends Format22b { 10 | 11 | public static final int OPCODE = 0xdf; 12 | public static final String NAME = "XorIntLit8"; 13 | public static final String SMALI_NAME = "xor-int/lit8"; 14 | 15 | XorIntLit8(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public XorIntLit8(int dest, int register, int constant) { 20 | super(dest, register, constant); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addXorLiteral(NumericType.INT, AA, BB, CC); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/XorLong.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class XorLong extends Format23x { 10 | 11 | public static final int OPCODE = 0xA2; 12 | public static final String NAME = "XorLong"; 13 | public static final String SMALI_NAME = "xor-long"; 14 | 15 | XorLong(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public XorLong(int dest, int left, int right) { 20 | super(dest, left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addXor(NumericType.LONG, AA, BB, CC); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/code/XorLong2Addr.java: -------------------------------------------------------------------------------- 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.NumericType; 7 | import com.android.tools.r8.ir.conversion.IRBuilder; 8 | 9 | public class XorLong2Addr extends Format12x { 10 | 11 | public static final int OPCODE = 0xc2; 12 | public static final String NAME = "XorLong2Addr"; 13 | public static final String SMALI_NAME = "xor-long/2addr"; 14 | 15 | XorLong2Addr(int high, BytecodeStream stream) { 16 | super(high, stream); 17 | } 18 | 19 | public XorLong2Addr(int left, int right) { 20 | super(left, right); 21 | } 22 | 23 | public String getName() { 24 | return NAME; 25 | } 26 | 27 | public String getSmaliName() { 28 | return SMALI_NAME; 29 | } 30 | 31 | public int getOpcode() { 32 | return OPCODE; 33 | } 34 | 35 | @Override 36 | public void buildIR(IRBuilder builder) { 37 | builder.addXor(NumericType.LONG, A, A, B); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/compatdx/CompatDxCommandBuilder.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, 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 | 5 | package com.android.tools.r8.compatdx; 6 | 7 | import com.android.tools.r8.D8Command; 8 | 9 | public class CompatDxCommandBuilder extends D8Command.Builder { 10 | CompatDxCommandBuilder() { 11 | super(true); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/errors/CompilationError.java: -------------------------------------------------------------------------------- 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.errors; 5 | 6 | /** 7 | * Exception to signal an compilation error. 8 | * 9 | * This is always an expected error and considered a user input issue. 10 | * A user-understandable message must be provided. 11 | */ 12 | public class CompilationError extends RuntimeException { 13 | 14 | public CompilationError(String message) { 15 | super(message); 16 | } 17 | 18 | public CompilationError(String message, Throwable cause) { 19 | super(message, cause); 20 | } 21 | } -------------------------------------------------------------------------------- /src/com/android/tools/r8/errors/InternalCompilerError.java: -------------------------------------------------------------------------------- 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.errors; 5 | 6 | /** 7 | * Exception to signal an unexpected state internally to the compiler. 8 | * 9 | * Exceptions of this type always represent an bug in the compiler. 10 | * For expected errors, such as invalid input, the compiler should generate a CompilationError. 11 | */ 12 | public class InternalCompilerError extends IllegalStateException { 13 | 14 | public InternalCompilerError() { 15 | } 16 | 17 | public InternalCompilerError(String s) { 18 | super(s); 19 | } 20 | 21 | public InternalCompilerError(String message, Throwable cause) { 22 | super(message, cause); 23 | } 24 | 25 | public InternalCompilerError(Throwable cause) { 26 | super(cause); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/errors/InvalidDebugInfoException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, 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.errors; 5 | 6 | public class InvalidDebugInfoException extends InternalCompilerError { 7 | public InvalidDebugInfoException(String message) { 8 | super(message); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/errors/Unimplemented.java: -------------------------------------------------------------------------------- 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.errors; 5 | 6 | /** 7 | * Exception to signal that a not-yet-implemented code path has been hit. 8 | */ 9 | public class Unimplemented extends RuntimeException { 10 | 11 | public Unimplemented() { 12 | } 13 | 14 | public Unimplemented(String message) { 15 | super(message); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/errors/Unreachable.java: -------------------------------------------------------------------------------- 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.errors; 5 | 6 | /** 7 | * Exception to signal an expected unreachable code path. 8 | */ 9 | public class Unreachable extends InternalCompilerError { 10 | 11 | public Unreachable() { 12 | } 13 | 14 | public Unreachable(String s) { 15 | super(s); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/graph/Descriptor.java: -------------------------------------------------------------------------------- 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.graph; 5 | 6 | public abstract class Descriptor 7 | extends IndexedDexItem implements PresortedComparable { 8 | 9 | public abstract boolean match(T entry); 10 | 11 | public abstract DexType getHolder(); 12 | } 13 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/graph/KeyedDexItem.java: -------------------------------------------------------------------------------- 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.graph; 5 | 6 | public abstract class KeyedDexItem> extends DexItem { 7 | 8 | public abstract T getKey(); 9 | 10 | @Override 11 | public final boolean equals(Object other) { 12 | if (other == this) { 13 | return true; 14 | } 15 | return (other.getClass() == getClass()) && ((KeyedDexItem) other).getKey().equals(getKey()); 16 | } 17 | 18 | @Override 19 | public final int hashCode() { 20 | return getKey().hashCode(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/graph/Presorted.java: -------------------------------------------------------------------------------- 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.graph; 5 | 6 | /** 7 | * Interface for capturing presorted behavior for Dex items. 8 | */ 9 | public interface Presorted { 10 | 11 | void setSortedIndex(int sortedIndex); 12 | 13 | int getSortedIndex(); 14 | 15 | int sortedCompareTo(int other); 16 | } 17 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/graph/PresortedComparable.java: -------------------------------------------------------------------------------- 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.graph; 5 | 6 | import com.android.tools.r8.naming.NamingLens; 7 | 8 | public interface PresortedComparable extends Presorted, Comparable { 9 | // Slow comparison methods that make no use of indices for comparisons. These are used 10 | // for sorting operations when reading dex files. 11 | int slowCompareTo(T other); 12 | int slowCompareTo(T other, NamingLens namingLens); 13 | // Layered comparison methods that make use of indices for subpart comparisons. These rely 14 | // on subparts already being sorted and having indices assigned. 15 | int layeredCompareTo(T other, NamingLens namingLens); 16 | 17 | > int slowCompare(T a, T b) ; 18 | } 19 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/graph/UseRegistry.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, 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.graph; 5 | 6 | public abstract class UseRegistry { 7 | 8 | public abstract boolean registerInvokeVirtual(DexMethod method); 9 | 10 | public abstract boolean registerInvokeDirect(DexMethod method); 11 | 12 | public abstract boolean registerInvokeStatic(DexMethod method); 13 | 14 | public abstract boolean registerInvokeInterface(DexMethod method); 15 | 16 | public abstract boolean registerInvokeSuper(DexMethod method); 17 | 18 | public abstract boolean registerInstanceFieldWrite(DexField field); 19 | 20 | public abstract boolean registerInstanceFieldRead(DexField field); 21 | 22 | public abstract boolean registerNewInstance(DexType type); 23 | 24 | public abstract boolean registerStaticFieldRead(DexField field); 25 | 26 | public abstract boolean registerStaticFieldWrite(DexField field); 27 | 28 | public abstract boolean registerTypeReference(DexType type); 29 | } 30 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/ir/code/ConstInstruction.java: -------------------------------------------------------------------------------- 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.ir.code; 5 | 6 | import com.android.tools.r8.graph.AppInfoWithSubtyping; 7 | import com.android.tools.r8.graph.DexType; 8 | import com.android.tools.r8.ir.optimize.Inliner.Constraint; 9 | 10 | public abstract class ConstInstruction extends Instruction { 11 | 12 | public ConstInstruction(Value out) { 13 | super(out); 14 | } 15 | 16 | @Override 17 | public ConstInstruction getOutConstantConstInstruction() { 18 | return this; 19 | } 20 | 21 | @Override 22 | public boolean isConstInstruction() { 23 | return true; 24 | } 25 | 26 | @Override 27 | public ConstInstruction asConstInstruction() { 28 | return this; 29 | } 30 | 31 | @Override 32 | public Constraint inliningConstraint(AppInfoWithSubtyping info, DexType holder) { 33 | return Constraint.ALWAYS; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/ir/code/NextUntilIterator.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, 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.ir.code; 5 | 6 | import java.util.Iterator; 7 | import java.util.function.Predicate; 8 | 9 | public interface NextUntilIterator extends Iterator { 10 | 11 | /** 12 | * Continue to call {@link #next} while {@code predicate} tests {@code false}. 13 | * 14 | * @returns the item that matched the predicate or {@code null} if all items fail 15 | * the predicate test 16 | */ 17 | T nextUntil(Predicate predicate); 18 | } 19 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/ir/code/SingleConstant.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, 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 | 5 | package com.android.tools.r8.ir.code; 6 | 7 | public interface SingleConstant { 8 | 9 | int decodedValue(); 10 | } 11 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/ir/code/ValueNumberGenerator.java: -------------------------------------------------------------------------------- 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.ir.code; 5 | 6 | public class ValueNumberGenerator { 7 | private int nextValueNumber = 0; 8 | 9 | public int next() { 10 | return nextValueNumber++; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/ir/code/WideConstant.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, 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 | 5 | package com.android.tools.r8.ir.code; 6 | 7 | public interface WideConstant { 8 | 9 | long decodedValue(); 10 | } 11 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/ir/conversion/OptimizationFeedback.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, 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 | 5 | package com.android.tools.r8.ir.conversion; 6 | 7 | import com.android.tools.r8.graph.DexEncodedMethod; 8 | import com.android.tools.r8.ir.optimize.Inliner.Constraint; 9 | 10 | public interface OptimizationFeedback { 11 | void methodReturnsArgument(DexEncodedMethod method, int argument); 12 | void methodReturnsConstant(DexEncodedMethod method, long value); 13 | void methodNeverReturnsNull(DexEncodedMethod method); 14 | void markProcessed(DexEncodedMethod method, Constraint state); 15 | } 16 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/ir/conversion/OptimizationFeedbackDirect.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, 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 | 5 | package com.android.tools.r8.ir.conversion; 6 | 7 | import com.android.tools.r8.graph.DexEncodedMethod; 8 | import com.android.tools.r8.ir.optimize.Inliner.Constraint; 9 | 10 | public class OptimizationFeedbackDirect implements OptimizationFeedback { 11 | 12 | @Override 13 | public void methodReturnsArgument(DexEncodedMethod method, int argument) { 14 | method.markReturnsArgument(argument); 15 | } 16 | 17 | @Override 18 | public void methodReturnsConstant(DexEncodedMethod method, long value) { 19 | method.markReturnsConstant(value); 20 | } 21 | 22 | @Override 23 | public void methodNeverReturnsNull(DexEncodedMethod method) { 24 | method.markNeverReturnsNull(); 25 | } 26 | 27 | @Override 28 | public void markProcessed(DexEncodedMethod method, Constraint state) { 29 | method.markProcessed(state); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/ir/conversion/OptimizationFeedbackIgnore.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, 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 | 5 | package com.android.tools.r8.ir.conversion; 6 | 7 | import com.android.tools.r8.graph.DexEncodedMethod; 8 | import com.android.tools.r8.ir.optimize.Inliner.Constraint; 9 | 10 | public class OptimizationFeedbackIgnore implements OptimizationFeedback { 11 | 12 | @Override 13 | public void methodReturnsArgument(DexEncodedMethod method, int argument) {} 14 | 15 | @Override 16 | public void methodReturnsConstant(DexEncodedMethod method, long value) {} 17 | 18 | @Override 19 | public void methodNeverReturnsNull(DexEncodedMethod method) {} 20 | 21 | @Override 22 | public void markProcessed(DexEncodedMethod method, Constraint state) {} 23 | } 24 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/ir/regalloc/LiveRange.java: -------------------------------------------------------------------------------- 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.ir.regalloc; 5 | 6 | class LiveRange { 7 | 8 | public final static LiveRange INFINITE = new LiveRange(0, Integer.MAX_VALUE); 9 | 10 | public int start; // inclusive 11 | public int end; // exclusive 12 | 13 | public LiveRange(int start, int end) { 14 | this.start = start; 15 | this.end = end; 16 | } 17 | 18 | @Override 19 | public String toString() { 20 | return "[" + start + ", " + end + "["; 21 | } 22 | 23 | public boolean isInfinite() { 24 | return this == INFINITE; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/ir/regalloc/RegisterAllocator.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, 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.ir.regalloc; 5 | 6 | import com.android.tools.r8.ir.code.Value; 7 | 8 | public interface RegisterAllocator { 9 | void allocateRegisters(boolean debug); 10 | int registersUsed(); 11 | int getRegisterForValue(Value value, int instructionNumber); 12 | boolean argumentValueUsesHighRegister(Value value, int instructionNumber); 13 | int getArgumentOrAllocateRegisterForValue(Value value, int instructionNumber); 14 | } 15 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/naming/signature/GenericSignatureAction.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, 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 | 5 | package com.android.tools.r8.naming.signature; 6 | 7 | /** 8 | * Actions triggered by the generic signature parser. 9 | */ 10 | public interface GenericSignatureAction { 11 | 12 | public void parsedSymbol(char symbol); 13 | 14 | public void parsedIdentifier(String identifier); 15 | 16 | public T parsedTypeName(String name); 17 | 18 | public T parsedInnerTypeName(T enclosingType, String name); 19 | 20 | public void start(); 21 | 22 | public void stop(); 23 | } 24 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/shaking/ProguardClassType.java: -------------------------------------------------------------------------------- 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.shaking; 5 | 6 | import com.android.tools.r8.errors.Unreachable; 7 | 8 | public enum ProguardClassType { 9 | ANNOTATION_INTERFACE, 10 | CLASS, 11 | ENUM, 12 | INTERFACE; 13 | 14 | @Override 15 | public String toString() { 16 | switch (this) { 17 | case ANNOTATION_INTERFACE: return "@interface"; 18 | case CLASS: return "class"; 19 | case ENUM: return "enum"; 20 | case INTERFACE: return "interface"; 21 | default: 22 | throw new Unreachable("Invalid proguard class type '" + this + "'"); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/shaking/ProguardConfigurationSource.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, 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 | 5 | package com.android.tools.r8.shaking; 6 | 7 | import java.io.IOException; 8 | import java.nio.file.Path; 9 | 10 | public interface ProguardConfigurationSource { 11 | String get() throws IOException; 12 | Path getBaseDirectory(); 13 | String getName(); 14 | } 15 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/shaking/ProguardConfigurationSourceStrings.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, 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 | 5 | package com.android.tools.r8.shaking; 6 | 7 | import java.io.IOException; 8 | import java.nio.file.Path; 9 | import java.nio.file.Paths; 10 | import java.util.List; 11 | import joptsimple.internal.Strings; 12 | 13 | public class ProguardConfigurationSourceStrings implements ProguardConfigurationSource { 14 | private final List config; 15 | 16 | public ProguardConfigurationSourceStrings(List config) { 17 | this.config = config; 18 | } 19 | 20 | public String get() throws IOException{ 21 | return Strings.join(config, "\n"); 22 | } 23 | 24 | public Path getBaseDirectory() { 25 | return Paths.get("."); 26 | } 27 | 28 | public String getName() { 29 | return ""; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/shaking/ProguardKeepRuleType.java: -------------------------------------------------------------------------------- 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.shaking; 5 | 6 | import com.android.tools.r8.errors.Unreachable; 7 | 8 | public enum ProguardKeepRuleType { 9 | KEEP, 10 | KEEP_CLASS_MEMBERS, 11 | KEEP_CLASSES_WITH_MEMBERS; 12 | 13 | @Override 14 | public String toString() { 15 | switch (this) { 16 | case KEEP: 17 | return "keep"; 18 | case KEEP_CLASS_MEMBERS: 19 | return "keepclassmembers"; 20 | case KEEP_CLASSES_WITH_MEMBERS: 21 | return "keepclasseswithmembers"; 22 | default: 23 | throw new Unreachable("Unknown ProguardKeepRuleType."); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/shaking/ProguardMemberType.java: -------------------------------------------------------------------------------- 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.shaking; 5 | 6 | public enum ProguardMemberType { 7 | // Please keep the order so fields are before methods 8 | FIELD, 9 | ALL_FIELDS, 10 | ALL, 11 | ALL_METHODS, 12 | INIT, 13 | CONSTRUCTOR, 14 | METHOD; 15 | 16 | public boolean includesFields() { 17 | return ordinal() <= ALL.ordinal(); 18 | } 19 | 20 | public boolean includesMethods() { 21 | return ordinal() >= ALL.ordinal(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/shaking/ProguardRuleParserException.java: -------------------------------------------------------------------------------- 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.shaking; 5 | 6 | public class ProguardRuleParserException extends Exception { 7 | public ProguardRuleParserException(String message, String snippet) { 8 | this(message, snippet, null); 9 | } 10 | 11 | public ProguardRuleParserException(String message, String snippet, Throwable cause) { 12 | super(message + " at " + snippet, cause); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/utils/FieldSignatureEquivalence.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, 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.utils; 5 | 6 | import com.android.tools.r8.graph.DexField; 7 | import com.google.common.base.Equivalence; 8 | 9 | /** 10 | * Implements an equivalence on {@link DexField} that does not take the holder into account. 11 | * 12 | *

Useful when comparing method implementations by their signature only. 13 | */ 14 | public class FieldSignatureEquivalence extends Equivalence { 15 | 16 | private static final FieldSignatureEquivalence THEINSTANCE = new FieldSignatureEquivalence(); 17 | 18 | private FieldSignatureEquivalence() { 19 | } 20 | 21 | public static FieldSignatureEquivalence get() { 22 | return THEINSTANCE; 23 | } 24 | 25 | @Override 26 | protected boolean doEquivalent(DexField a, DexField b) { 27 | return a.name.equals(b.name) && a.type.equals(b.type); 28 | } 29 | 30 | @Override 31 | protected int doHash(DexField field) { 32 | return field.name.hashCode() * 31 + field.type.hashCode(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/utils/ListUtils.java: -------------------------------------------------------------------------------- 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 | 5 | package com.android.tools.r8.utils; 6 | 7 | import java.util.ArrayList; 8 | import java.util.Collection; 9 | import java.util.List; 10 | import java.util.function.Function; 11 | 12 | public class ListUtils { 13 | 14 | public static List map(Collection list, Function fn) { 15 | List result = new ArrayList<>(list.size()); 16 | for (S element : list) { 17 | result.add(fn.apply(element)); 18 | } 19 | return result; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/utils/OffOrAuto.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, 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 | 5 | package com.android.tools.r8.utils; 6 | 7 | import joptsimple.ValueConversionException; 8 | import joptsimple.ValueConverter; 9 | 10 | public enum OffOrAuto { 11 | Off, Auto; 12 | 13 | static final ValueConverter CONVERTER = new ValueConverter() { 14 | @Override 15 | public OffOrAuto convert(String input) { 16 | try { 17 | input = Character.toUpperCase(input.charAt(0)) + input.substring(1).toLowerCase(); 18 | return Enum.valueOf(OffOrAuto.class, input); 19 | } catch (Exception e) { 20 | throw new ValueConversionException("Value must be one of: " + valuePattern()); 21 | } 22 | } 23 | 24 | @Override 25 | public Class valueType() { 26 | return OffOrAuto.class; 27 | } 28 | 29 | @Override 30 | public String valuePattern() { 31 | return "off|auto"; 32 | } 33 | }; 34 | } 35 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/utils/OneShotByteResource.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, 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.utils; 5 | 6 | import com.android.tools.r8.Resource; 7 | import java.io.ByteArrayInputStream; 8 | import java.io.IOException; 9 | import java.io.InputStream; 10 | import java.util.Set; 11 | 12 | class OneShotByteResource extends Resource { 13 | 14 | private byte[] bytes; 15 | private final Set classDescriptors; 16 | 17 | OneShotByteResource(Kind kind, byte[] bytes, Set classDescriptors) { 18 | super(kind); 19 | assert bytes != null; 20 | this.bytes = bytes; 21 | this.classDescriptors = classDescriptors; 22 | } 23 | 24 | @Override 25 | public Set getClassDescriptors() { 26 | return classDescriptors; 27 | } 28 | 29 | @Override 30 | public InputStream getStream() throws IOException { 31 | assert bytes != null; 32 | InputStream result = new ByteArrayInputStream(bytes); 33 | bytes = null; 34 | return result; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/com/android/tools/r8/utils/OutputMode.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, 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.utils; 5 | 6 | import com.android.tools.r8.Resource; 7 | import java.util.Set; 8 | 9 | /** Defines way the output is formed. */ 10 | public enum OutputMode { 11 | Indexed { 12 | @Override 13 | String getOutputPath(Resource resource, int index) { 14 | return index == 0 ? "classes.dex" : ("classes" + (index + 1) + ".dex"); 15 | } 16 | }, 17 | FilePerClass { 18 | @Override 19 | String getOutputPath(Resource resource, int index) { 20 | Set classDescriptors = resource.getClassDescriptors(); 21 | assert classDescriptors != null; 22 | assert classDescriptors.size() == 1; 23 | String classDescriptor = classDescriptors.iterator().next(); 24 | assert DescriptorUtils.isClassDescriptor(classDescriptor); 25 | return classDescriptor.substring(1, classDescriptor.length() - 1) + ".dex"; 26 | } 27 | }; 28 | 29 | abstract String getOutputPath(Resource resource, int index); 30 | } 31 | --------------------------------------------------------------------------------