1 /* 2 * Copyright 2011-2012, The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef _FRAMEWORKS_COMPILE_SLANG_SLANG_VERSION_H_ // NOLINT 18 #define _FRAMEWORKS_COMPILE_SLANG_SLANG_VERSION_H_ 19 20 #include <climits> 21 22 #define RS_DEVELOPMENT_API UINT_MAX 23 24 // API levels used by the standard Android SDK. 25 // MR -> Maintenance Release 26 // HC -> Honeycomb 27 // ICS -> Ice Cream Sandwich 28 // JB -> Jelly Bean 29 // KK -> KitKat 30 // M -> Marshmallow 31 enum SlangTargetAPI { 32 SLANG_MINIMUM_TARGET_API = 11, 33 SLANG_HC_TARGET_API = 11, 34 SLANG_HC_MR1_TARGET_API = 12, 35 SLANG_HC_MR2_TARGET_API = 13, 36 SLANG_ICS_TARGET_API = 14, 37 SLANG_ICS_MR1_TARGET_API = 15, 38 SLANG_JB_TARGET_API = 16, 39 SLANG_JB_MR1_TARGET_API = 17, 40 SLANG_JB_MR2_TARGET_API = 18, 41 SLANG_KK_TARGET_API = 19, 42 SLANG_L_TARGET_API = 21, 43 SLANG_M_TARGET_API = 23, 44 SLANG_N_TARGET_API = 24, 45 SLANG_N_MR1_TARGET_API = 25, 46 SLANG_O_TARGET_API = 26, 47 SLANG_O_MR1_TARGET_API = 27, 48 SLANG_P_TARGET_API = 28, 49 SLANG_Q_TARGET_API = 29, 50 SLANG_R_TARGET_API = 30, 51 SLANG_S_TARGET_API = 31, 52 SLANG_S_V2_TARGET_API = 32, 53 SLANG_T_TARGET_API = 33, 54 SLANG_MAXIMUM_TARGET_API = RS_VERSION, 55 // The maximum API level that is acceptable for the "-target-api" commandline option. 56 SLANG_MAXIMUM_CMDLINE_TARGET_API = SLANG_T_TARGET_API, 57 SLANG_DEVELOPMENT_TARGET_API = RS_DEVELOPMENT_API 58 }; 59 // Note that RS_VERSION is defined at build time (see Android.mk for details). 60 61 // API levels where particular features exist. 62 // . Open (feature appears at a particular level and continues to exist): 63 // SLANG_FEAT_FOO_API 64 // . Closed (feature exists only through a particular range of API levels): 65 // SLANG_FEAT_BAR_API_MIN, SLANG_FEAT_BAR_API_MAX 66 enum SlangFeatureAPI { 67 SLANG_FEATURE_GENERAL_REDUCTION_API = SLANG_N_TARGET_API, 68 SLANG_FEATURE_GENERAL_REDUCTION_HALTER_API = SLANG_DEVELOPMENT_TARGET_API, 69 SLANG_FEATURE_SINGLE_SOURCE_API = SLANG_N_TARGET_API, 70 }; 71 72 // SlangVersion refers to the released compiler version, for which 73 // certain behaviors could change. 74 // 75 // The SlangVersion is recorded in the generated bitcode. A bitcode 76 // consumer (for example: runtime, driver, bcc) is expected to use 77 // this version number as follows: 78 // 79 // If version number is at least $VERSION, then I can assume that 80 // $PROPERTY holds. 81 // 82 // However, a bitcode consumer is not obligated to act on this 83 // information (for example, the consumer may be too old to know about 84 // that version number). So slang must not change its behavior for 85 // $VERSION in such a way that a backend needs to know about $VERSION 86 // in order to behave properly. 87 // 88 // For example: 89 // 90 // If version number is at least N_STRUCT_EXPLICIT_PADDING, then I 91 // can assume that no field of any struct is followed by implicit 92 // padding. 93 // 94 // bcc can take advantage of this (by turning off analyses and 95 // transformations that are needed because of implicit padding), but 96 // slang must still generate code that works properly with a bcc 97 // that is too old to know about the N_STRUCT_EXPLICIT_PADDING 98 // guarantee. 99 // 100 // Note that we CANNOT say 101 // 102 // If version number is at least $VERSION_LO but lower than 103 // $VERSION_HI, then I can assume that $PROPERTY holds. 104 // 105 // because a bitcode consumer might know about $VERSION_LO (where it 106 // could start taking advantage of $PROPERTY) without knowing about 107 // $VERSION_HI (where it would have to stop taking advantage of 108 // $PROPERTY). 109 namespace SlangVersion { 110 enum { 111 LEGACY = 0, 112 ICS = 1400, 113 JB = 1600, 114 JB_MR1 = 1700, 115 JB_MR2 = 1800, 116 KK = 1900, 117 KK_P1 = 1901, 118 L = 2100, 119 M = 2300, 120 M_RS_OBJECT = 2310, 121 N = 2400, 122 N_STRUCT_EXPLICIT_PADDING = 2410, 123 CURRENT = N_STRUCT_EXPLICIT_PADDING 124 }; 125 } // namespace SlangVersion 126 127 #endif // _FRAMEWORKS_COMPILE_SLANG_SLANG_VERSION_H_ NOLINT 128