14a4bf92a8add68629a7e6e59ef81c3c3fe603a75Stephen Hines/* 25e3b677a3041c86a7f860238dd1f5ff9d111b507Stephen Hines * Copyright 2011-2012, The Android Open Source Project 34a4bf92a8add68629a7e6e59ef81c3c3fe603a75Stephen Hines * 44a4bf92a8add68629a7e6e59ef81c3c3fe603a75Stephen Hines * Licensed under the Apache License, Version 2.0 (the "License"); 54a4bf92a8add68629a7e6e59ef81c3c3fe603a75Stephen Hines * you may not use this file except in compliance with the License. 64a4bf92a8add68629a7e6e59ef81c3c3fe603a75Stephen Hines * You may obtain a copy of the License at 74a4bf92a8add68629a7e6e59ef81c3c3fe603a75Stephen Hines * 84a4bf92a8add68629a7e6e59ef81c3c3fe603a75Stephen Hines * http://www.apache.org/licenses/LICENSE-2.0 94a4bf92a8add68629a7e6e59ef81c3c3fe603a75Stephen Hines * 104a4bf92a8add68629a7e6e59ef81c3c3fe603a75Stephen Hines * Unless required by applicable law or agreed to in writing, software 114a4bf92a8add68629a7e6e59ef81c3c3fe603a75Stephen Hines * distributed under the License is distributed on an "AS IS" BASIS, 124a4bf92a8add68629a7e6e59ef81c3c3fe603a75Stephen Hines * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 134a4bf92a8add68629a7e6e59ef81c3c3fe603a75Stephen Hines * See the License for the specific language governing permissions and 144a4bf92a8add68629a7e6e59ef81c3c3fe603a75Stephen Hines * limitations under the License. 154a4bf92a8add68629a7e6e59ef81c3c3fe603a75Stephen Hines */ 164a4bf92a8add68629a7e6e59ef81c3c3fe603a75Stephen Hines 174cc499d6e5ec602309501873449c938af61170b2Stephen Hines#ifndef _FRAMEWORKS_COMPILE_SLANG_SLANG_VERSION_H_ // NOLINT 184cc499d6e5ec602309501873449c938af61170b2Stephen Hines#define _FRAMEWORKS_COMPILE_SLANG_SLANG_VERSION_H_ 194a4bf92a8add68629a7e6e59ef81c3c3fe603a75Stephen Hines 20c9454afec1649846512993d0ef65a9f868976bb4Chris Wailes#include <climits> 21c9454afec1649846512993d0ef65a9f868976bb4Chris Wailes 22c9454afec1649846512993d0ef65a9f868976bb4Chris Wailes#define RS_DEVELOPMENT_API UINT_MAX 239e3aa07a4456aad52920e0a7464954fe67cdbe01Chris Wailes 244a4bf92a8add68629a7e6e59ef81c3c3fe603a75Stephen Hines// API levels used by the standard Android SDK. 259b044ec938fd56355012851890c63974c8042c9fStephen Hines// MR -> Maintenance Release 269b044ec938fd56355012851890c63974c8042c9fStephen Hines// HC -> Honeycomb 279b044ec938fd56355012851890c63974c8042c9fStephen Hines// ICS -> Ice Cream Sandwich 2841cc61093619da4e99581d0aef4487ce2751812eStephen Hines// JB -> Jelly Bean 290f2a2397df53a1bb74609abe3c27719bc7e3c328Jean-Luc Brouillet// KK -> KitKat 301623659165bb24d733a40124e929cfd42aa917e3David Gross// M -> Marshmallow 319b044ec938fd56355012851890c63974c8042c9fStephen Hinesenum SlangTargetAPI { 329b044ec938fd56355012851890c63974c8042c9fStephen Hines SLANG_MINIMUM_TARGET_API = 11, 339b044ec938fd56355012851890c63974c8042c9fStephen Hines SLANG_HC_TARGET_API = 11, 349b044ec938fd56355012851890c63974c8042c9fStephen Hines SLANG_HC_MR1_TARGET_API = 12, 359b044ec938fd56355012851890c63974c8042c9fStephen Hines SLANG_HC_MR2_TARGET_API = 13, 369b044ec938fd56355012851890c63974c8042c9fStephen Hines SLANG_ICS_TARGET_API = 14, 379b044ec938fd56355012851890c63974c8042c9fStephen Hines SLANG_ICS_MR1_TARGET_API = 15, 3841cc61093619da4e99581d0aef4487ce2751812eStephen Hines SLANG_JB_TARGET_API = 16, 39fe2b93dc9e7d4f193fe6d8c050e849f012ab0754Stephen Hines SLANG_JB_MR1_TARGET_API = 17, 409221935c8a5cb48a53d7d316bbe0d860baf4a22eStephen Hines SLANG_JB_MR2_TARGET_API = 18, 414f673191448c2a76c7dc5d18ff45bb7954968ea6Stephen Hines SLANG_KK_TARGET_API = 19, 42d80e58b259c2febc4907aed4aca9d88d43bdd1a1David Gross SLANG_L_TARGET_API = 21, 43bd0a7ddceac6c135ea975cefbac73877a1f9dae7Stephen Hines SLANG_M_TARGET_API = 23, 4413dba25ad988da71201c1331b34f56e2d01bcf96Yang Ni SLANG_N_TARGET_API = 24, 45db0457ef7558c5965d363e7d71e279dae1ad90abMiao Wang SLANG_N_MR1_TARGET_API = 25, 4638d179cec358bd910586d6672cf2ebea6d8283c2Miao Wang SLANG_O_TARGET_API = 26, 47f0cee34637b4aea3af6c9f5f8635601d895f7c09Miao Wang SLANG_O_MR1_TARGET_API = 27, 48f0cee34637b4aea3af6c9f5f8635601d895f7c09Miao Wang SLANG_P_TARGET_API = 28, 49c9454afec1649846512993d0ef65a9f868976bb4Chris Wailes SLANG_MAXIMUM_TARGET_API = RS_VERSION, 50c9454afec1649846512993d0ef65a9f868976bb4Chris Wailes SLANG_DEVELOPMENT_TARGET_API = RS_DEVELOPMENT_API 519b044ec938fd56355012851890c63974c8042c9fStephen Hines}; 524cc499d6e5ec602309501873449c938af61170b2Stephen Hines// Note that RS_VERSION is defined at build time (see Android.mk for details). 534a4bf92a8add68629a7e6e59ef81c3c3fe603a75Stephen Hines 541623659165bb24d733a40124e929cfd42aa917e3David Gross// API levels where particular features exist. 551623659165bb24d733a40124e929cfd42aa917e3David Gross// . Open (feature appears at a particular level and continues to exist): 561623659165bb24d733a40124e929cfd42aa917e3David Gross// SLANG_FEAT_FOO_API 571623659165bb24d733a40124e929cfd42aa917e3David Gross// . Closed (feature exists only through a particular range of API levels): 581623659165bb24d733a40124e929cfd42aa917e3David Gross// SLANG_FEAT_BAR_API_MIN, SLANG_FEAT_BAR_API_MAX 591623659165bb24d733a40124e929cfd42aa917e3David Grossenum SlangFeatureAPI { 6046a0334d8901576e20db68e15930a19f8f789cb8David Gross SLANG_FEATURE_GENERAL_REDUCTION_API = SLANG_N_TARGET_API, 6140bac5d72af8fe32ab3d0bb38aafb5c65d8d9dfaYang Ni SLANG_FEATURE_GENERAL_REDUCTION_HALTER_API = SLANG_DEVELOPMENT_TARGET_API, 6240bac5d72af8fe32ab3d0bb38aafb5c65d8d9dfaYang Ni SLANG_FEATURE_SINGLE_SOURCE_API = SLANG_N_TARGET_API, 631623659165bb24d733a40124e929cfd42aa917e3David Gross}; 641623659165bb24d733a40124e929cfd42aa917e3David Gross 6530e16415077e545002de44406dab47950593a6e3David Gross// SlangVersion refers to the released compiler version, for which 6630e16415077e545002de44406dab47950593a6e3David Gross// certain behaviors could change. 6730e16415077e545002de44406dab47950593a6e3David Gross// 6830e16415077e545002de44406dab47950593a6e3David Gross// The SlangVersion is recorded in the generated bitcode. A bitcode 6930e16415077e545002de44406dab47950593a6e3David Gross// consumer (for example: runtime, driver, bcc) is expected to use 7030e16415077e545002de44406dab47950593a6e3David Gross// this version number as follows: 7130e16415077e545002de44406dab47950593a6e3David Gross// 7230e16415077e545002de44406dab47950593a6e3David Gross// If version number is at least $VERSION, then I can assume that 7330e16415077e545002de44406dab47950593a6e3David Gross// $PROPERTY holds. 7430e16415077e545002de44406dab47950593a6e3David Gross// 7530e16415077e545002de44406dab47950593a6e3David Gross// However, a bitcode consumer is not obligated to act on this 7630e16415077e545002de44406dab47950593a6e3David Gross// information (for example, the consumer may be too old to know about 7730e16415077e545002de44406dab47950593a6e3David Gross// that version number). So slang must not change its behavior for 7830e16415077e545002de44406dab47950593a6e3David Gross// $VERSION in such a way that a backend needs to know about $VERSION 7930e16415077e545002de44406dab47950593a6e3David Gross// in order to behave properly. 8030e16415077e545002de44406dab47950593a6e3David Gross// 8130e16415077e545002de44406dab47950593a6e3David Gross// For example: 8230e16415077e545002de44406dab47950593a6e3David Gross// 8330e16415077e545002de44406dab47950593a6e3David Gross// If version number is at least N_STRUCT_EXPLICIT_PADDING, then I 8430e16415077e545002de44406dab47950593a6e3David Gross// can assume that no field of any struct is followed by implicit 8530e16415077e545002de44406dab47950593a6e3David Gross// padding. 8630e16415077e545002de44406dab47950593a6e3David Gross// 8730e16415077e545002de44406dab47950593a6e3David Gross// bcc can take advantage of this (by turning off analyses and 8830e16415077e545002de44406dab47950593a6e3David Gross// transformations that are needed because of implicit padding), but 8930e16415077e545002de44406dab47950593a6e3David Gross// slang must still generate code that works properly with a bcc 9030e16415077e545002de44406dab47950593a6e3David Gross// that is too old to know about the N_STRUCT_EXPLICIT_PADDING 9130e16415077e545002de44406dab47950593a6e3David Gross// guarantee. 9230e16415077e545002de44406dab47950593a6e3David Gross// 9330e16415077e545002de44406dab47950593a6e3David Gross// Note that we CANNOT say 9430e16415077e545002de44406dab47950593a6e3David Gross// 9530e16415077e545002de44406dab47950593a6e3David Gross// If version number is at least $VERSION_LO but lower than 9630e16415077e545002de44406dab47950593a6e3David Gross// $VERSION_HI, then I can assume that $PROPERTY holds. 9730e16415077e545002de44406dab47950593a6e3David Gross// 9830e16415077e545002de44406dab47950593a6e3David Gross// because a bitcode consumer might know about $VERSION_LO (where it 9930e16415077e545002de44406dab47950593a6e3David Gross// could start taking advantage of $PROPERTY) without knowing about 10030e16415077e545002de44406dab47950593a6e3David Gross// $VERSION_HI (where it would have to stop taking advantage of 10130e16415077e545002de44406dab47950593a6e3David Gross// $PROPERTY). 1025e3b677a3041c86a7f860238dd1f5ff9d111b507Stephen Hinesnamespace SlangVersion { 1035e3b677a3041c86a7f860238dd1f5ff9d111b507Stephen Hinesenum { 1045e3b677a3041c86a7f860238dd1f5ff9d111b507Stephen Hines LEGACY = 0, 1055e3b677a3041c86a7f860238dd1f5ff9d111b507Stephen Hines ICS = 1400, 10659e37365ee690a7c4e8182faab9eb2b029193f91Stephen Hines JB = 1600, 107fe2b93dc9e7d4f193fe6d8c050e849f012ab0754Stephen Hines JB_MR1 = 1700, 10850974740c0c5c52dd766264139a01702fbc138afStephen Hines JB_MR2 = 1800, 1094f673191448c2a76c7dc5d18ff45bb7954968ea6Stephen Hines KK = 1900, 11076110d5599d2bac880354b6df94930c0c63b5e4eStephen Hines KK_P1 = 1901, 11180bdb1aaa97c4f617a03fb86dcd1da3051f7efd7Stephen Hines L = 2100, 112bd0a7ddceac6c135ea975cefbac73877a1f9dae7Stephen Hines M = 2300, 113880d6ad5fc44e1291669de4b23b5910f7ca975dcStephen Hines M_RS_OBJECT = 2310, 11413dba25ad988da71201c1331b34f56e2d01bcf96Yang Ni N = 2400, 11571c95f75f20efd5eb9a17504d6be8ff59552232aDavid Gross N_STRUCT_EXPLICIT_PADDING = 2410, 11671c95f75f20efd5eb9a17504d6be8ff59552232aDavid Gross CURRENT = N_STRUCT_EXPLICIT_PADDING 1175e3b677a3041c86a7f860238dd1f5ff9d111b507Stephen Hines}; 1185e3b677a3041c86a7f860238dd1f5ff9d111b507Stephen Hines} // namespace SlangVersion 1195e3b677a3041c86a7f860238dd1f5ff9d111b507Stephen Hines 1204cc499d6e5ec602309501873449c938af61170b2Stephen Hines#endif // _FRAMEWORKS_COMPILE_SLANG_SLANG_VERSION_H_ NOLINT 121