slang_version.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. #ifndef _FRAMEWORKS_COMPILE_SLANG_SLANG_VERSION_H_ // NOLINT
  17. #define _FRAMEWORKS_COMPILE_SLANG_SLANG_VERSION_H_
  18. #include <climits>
  19. #define RS_DEVELOPMENT_API UINT_MAX
  20. // API levels used by the standard Android SDK.
  21. // MR -> Maintenance Release
  22. // HC -> Honeycomb
  23. // ICS -> Ice Cream Sandwich
  24. // JB -> Jelly Bean
  25. // KK -> KitKat
  26. // M -> Marshmallow
  27. enum SlangTargetAPI {
  28. SLANG_MINIMUM_TARGET_API = 11,
  29. SLANG_HC_TARGET_API = 11,
  30. SLANG_HC_MR1_TARGET_API = 12,
  31. SLANG_HC_MR2_TARGET_API = 13,
  32. SLANG_ICS_TARGET_API = 14,
  33. SLANG_ICS_MR1_TARGET_API = 15,
  34. SLANG_JB_TARGET_API = 16,
  35. SLANG_JB_MR1_TARGET_API = 17,
  36. SLANG_JB_MR2_TARGET_API = 18,
  37. SLANG_KK_TARGET_API = 19,
  38. SLANG_L_TARGET_API = 21,
  39. SLANG_M_TARGET_API = 23,
  40. SLANG_N_TARGET_API = 24,
  41. SLANG_N_MR1_TARGET_API = 25,
  42. SLANG_O_TARGET_API = 26,
  43. SLANG_O_MR1_TARGET_API = 27,
  44. SLANG_P_TARGET_API = 28,
  45. SLANG_MAXIMUM_TARGET_API = RS_VERSION,
  46. SLANG_DEVELOPMENT_TARGET_API = RS_DEVELOPMENT_API
  47. };
  48. // Note that RS_VERSION is defined at build time (see Android.mk for details).
  49. // API levels where particular features exist.
  50. // . Open (feature appears at a particular level and continues to exist):
  51. // SLANG_FEAT_FOO_API
  52. // . Closed (feature exists only through a particular range of API levels):
  53. // SLANG_FEAT_BAR_API_MIN, SLANG_FEAT_BAR_API_MAX
  54. enum SlangFeatureAPI {
  55. SLANG_FEATURE_GENERAL_REDUCTION_API = SLANG_N_TARGET_API,
  56. SLANG_FEATURE_GENERAL_REDUCTION_HALTER_API = SLANG_DEVELOPMENT_TARGET_API,
  57. SLANG_FEATURE_SINGLE_SOURCE_API = SLANG_N_TARGET_API,
  58. };
  59. // SlangVersion refers to the released compiler version, for which
  60. // certain behaviors could change.
  61. //
  62. // The SlangVersion is recorded in the generated bitcode. A bitcode
  63. // consumer (for example: runtime, driver, bcc) is expected to use
  64. // this version number as follows:
  65. //
  66. // If version number is at least $VERSION, then I can assume that
  67. // $PROPERTY holds.
  68. //
  69. // However, a bitcode consumer is not obligated to act on this
  70. // information (for example, the consumer may be too old to know about
  71. // that version number). So slang must not change its behavior for
  72. // $VERSION in such a way that a backend needs to know about $VERSION
  73. // in order to behave properly.
  74. //
  75. // For example:
  76. //
  77. // If version number is at least N_STRUCT_EXPLICIT_PADDING, then I
  78. // can assume that no field of any struct is followed by implicit
  79. // padding.
  80. //
  81. // bcc can take advantage of this (by turning off analyses and
  82. // transformations that are needed because of implicit padding), but
  83. // slang must still generate code that works properly with a bcc
  84. // that is too old to know about the N_STRUCT_EXPLICIT_PADDING
  85. // guarantee.
  86. //
  87. // Note that we CANNOT say
  88. //
  89. // If version number is at least $VERSION_LO but lower than
  90. // $VERSION_HI, then I can assume that $PROPERTY holds.
  91. //
  92. // because a bitcode consumer might know about $VERSION_LO (where it
  93. // could start taking advantage of $PROPERTY) without knowing about
  94. // $VERSION_HI (where it would have to stop taking advantage of
  95. // $PROPERTY).
  96. namespace SlangVersion {
  97. enum {
  98. LEGACY = 0,
  99. ICS = 1400,
  100. JB = 1600,
  101. JB_MR1 = 1700,
  102. JB_MR2 = 1800,
  103. KK = 1900,
  104. KK_P1 = 1901,
  105. L = 2100,
  106. M = 2300,
  107. M_RS_OBJECT = 2310,
  108. N = 2400,
  109. N_STRUCT_EXPLICIT_PADDING = 2410,
  110. CURRENT = N_STRUCT_EXPLICIT_PADDING
  111. };
  112. } // namespace SlangVersion
  113. #endif // _FRAMEWORKS_COMPILE_SLANG_SLANG_VERSION_H_ NOLINT