Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 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 | |
Benoit Lamarche | df98e68 | 2017-08-23 18:25:23 +0200 | [diff] [blame] | 6 | import com.android.tools.r8.ApiLevelException; |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 7 | import com.android.tools.r8.dex.IndexedItemCollection; |
| 8 | import com.android.tools.r8.dex.MixedSectionCollection; |
| 9 | import com.android.tools.r8.errors.Unreachable; |
| 10 | import com.android.tools.r8.ir.code.IRCode; |
| 11 | import com.android.tools.r8.ir.optimize.Outliner.OutlineCode; |
| 12 | import com.android.tools.r8.naming.ClassNameMapper; |
| 13 | import com.android.tools.r8.utils.InternalOptions; |
| 14 | |
Lars Bak | 7114375 | 2017-08-16 13:28:44 +0200 | [diff] [blame] | 15 | public abstract class Code extends CachedHashValueDexItem { |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 16 | |
Benoit Lamarche | df98e68 | 2017-08-23 18:25:23 +0200 | [diff] [blame] | 17 | public abstract IRCode buildIR(DexEncodedMethod encodedMethod, InternalOptions options) |
| 18 | throws ApiLevelException; |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 19 | |
| 20 | public abstract void registerReachableDefinitions(UseRegistry registry); |
| 21 | |
Benoit Lamarche | 2aae320 | 2017-10-11 11:01:06 +0200 | [diff] [blame] | 22 | @Override |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 23 | public abstract String toString(); |
| 24 | |
Ian Zerny | 4cd9db1 | 2017-06-23 13:46:28 +0200 | [diff] [blame] | 25 | public abstract String toString(DexEncodedMethod method, ClassNameMapper naming); |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 26 | |
Ian Zerny | 282ffa8 | 2017-10-30 12:19:02 +0100 | [diff] [blame] | 27 | public boolean isCfCode() { |
| 28 | return false; |
| 29 | } |
| 30 | |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 31 | public boolean isDexCode() { |
| 32 | return false; |
| 33 | } |
| 34 | |
| 35 | public boolean isJarCode() { |
| 36 | return false; |
| 37 | } |
| 38 | |
| 39 | public boolean isOutlineCode() { |
| 40 | return false; |
| 41 | } |
| 42 | |
Stephan Herhut | 7fa3d1b | 2017-08-04 13:30:15 +0200 | [diff] [blame] | 43 | public int estimatedSizeForInlining() { |
| 44 | return Integer.MAX_VALUE; |
| 45 | } |
| 46 | |
Ian Zerny | 282ffa8 | 2017-10-30 12:19:02 +0100 | [diff] [blame] | 47 | public CfCode asCfCode() { |
| 48 | throw new Unreachable(getClass().getCanonicalName() + ".asCfCode()"); |
| 49 | } |
| 50 | |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 51 | public DexCode asDexCode() { |
Denis Vnukov | fc2be5e | 2017-07-14 08:15:09 -0700 | [diff] [blame] | 52 | throw new Unreachable(getClass().getCanonicalName() + ".asDexCode()"); |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 53 | } |
| 54 | |
| 55 | public JarCode asJarCode() { |
Denis Vnukov | fc2be5e | 2017-07-14 08:15:09 -0700 | [diff] [blame] | 56 | throw new Unreachable(getClass().getCanonicalName() + ".asJarCode()"); |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 57 | } |
| 58 | |
| 59 | public OutlineCode asOutlineCode() { |
Denis Vnukov | fc2be5e | 2017-07-14 08:15:09 -0700 | [diff] [blame] | 60 | throw new Unreachable(getClass().getCanonicalName() + ".asOutlineCode()"); |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 61 | } |
| 62 | |
| 63 | @Override |
| 64 | void collectIndexedItems(IndexedItemCollection collection) { |
| 65 | throw new Unreachable(); |
| 66 | } |
| 67 | |
| 68 | @Override |
| 69 | void collectMixedSectionItems(MixedSectionCollection collection) { |
| 70 | throw new Unreachable(); |
| 71 | } |
| 72 | } |