Edit

kc3-lang/angle/src/compiler/translator/ImmutableString_ESSL_autogen.cpp

Branch :

  • Show log

    Commit

  • Author : Tobin Ehlis
    Date : 2019-11-15 14:40:31
    Hash : 240befe5
    Message : Add support for gl_HelperInvocation Added HelperInvocation to builtin_variables.json, regenerate the codegen portions of compiler, and plumb support for HelperInvocation through the rest of the compiler. Skipping some fails on Android and Swiftshader for this initial change and will debug/fix those issues in a follow-on. Bug: angleproject:4110 Change-Id: I781a2782ace84200bc615a2cc26b908a62e2aa26 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1922061 Commit-Queue: Tobin Ehlis <tobine@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>

  • src/compiler/translator/ImmutableString_ESSL_autogen.cpp
  • // GENERATED FILE - DO NOT EDIT.
    // Generated by gen_builtin_symbols.py using data from builtin_variables.json and
    // builtin_function_declarations.txt.
    //
    // Copyright 2019 The ANGLE Project Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style license that can be
    // found in the LICENSE file.
    //
    // ImmutableString_ESSL_autogen.cpp: Wrapper for static or pool allocated char arrays, that are
    // guaranteed to be valid and unchanged for the duration of the compilation. Implements
    // mangledNameHash using perfect hash function from gen_builtin_symbols.py
    
    #include "compiler/translator/ImmutableString.h"
    
    std::ostream &operator<<(std::ostream &os, const sh::ImmutableString &str)
    {
        return os.write(str.data(), str.length());
    }
    
    #if defined(_MSC_VER)
    #    pragma warning(disable : 4309)  // truncation of constant value
    #endif
    
    namespace
    {
    
    constexpr int mangledkT1[] = {179, 465, 780,  37,   427,  988,  839,  569,  1032, 221,
                                  251, 467, 1589, 703,  528,  1241, 1408, 255,  1521, 1362,
                                  620, 967, 982,  1547, 1602, 1192, 277,  1199, 294,  822,
                                  265, 167, 1299, 1659, 1357, 205,  530};
    constexpr int mangledkT2[] = {329,  825,  1399, 348, 282, 1332, 1006, 1217, 826, 518,
                                  1610, 399,  1114, 534, 22,  873,  1193, 1375, 859, 17,
                                  546,  1240, 208,  558, 123, 1357, 861,  60,   341, 939,
                                  181,  1606, 1280, 498, 336, 1172, 198};
    constexpr int mangledkG[]  = {
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    694,  0,    1575, 742,
        0,    1479, 0,    0,    0,    0,    0,    0,    0,    562,  0,    724,  0,    0,    0,    0,
        1657, 438,  0,    0,    41,   0,    1403, 124,  1031, 0,    377,  0,    986,  0,    0,    42,
        565,  1283, 0,    0,    1300, 0,    0,    176,  0,    0,    0,    994,  0,    349,  0,    1423,
        0,    0,    342,  0,    0,    0,    0,    1480, 0,    0,    1004, 197,  0,    0,    0,    0,
        10,   0,    0,    0,    0,    1528, 0,    0,    1412, 0,    0,    0,    0,    0,    144,  0,
        0,    0,    1101, 0,    1489, 0,    0,    0,    1222, 978,  0,    32,   1600, 1093, 931,  0,
        953,  622,  0,    0,    0,    0,    258,  0,    0,    0,    361,  0,    880,  0,    1457, 0,
        755,  0,    0,    0,    0,    0,    0,    0,    1298, 1484, 24,   0,    633,  0,    714,  489,
        0,    523,  0,    555,  1126, 37,   0,    0,    0,    0,    0,    546,  174,  0,    394,  1034,
        0,    543,  1629, 375,  0,    593,  0,    0,    0,    0,    0,    0,    0,    1185, 0,    0,
        0,    262,  583,  0,    0,    0,    1651, 0,    0,    0,    645,  0,    271,  0,    587,  0,
        1573, 544,  1610, 1546, 0,    0,    693,  1293, 0,    294,  0,    1480, 0,    1663, 0,    1518,
        0,    0,    621,  0,    1507, 480,  698,  34,   1263, 43,   766,  869,  859,  0,    0,    182,
        0,    1418, 545,  146,  0,    0,    0,    0,    598,  0,    0,    1624, 0,    325,  0,    0,
        530,  1257, 556,  778,  1608, 0,    54,   0,    0,    0,    1102, 0,    539,  0,    1578, 0,
        0,    51,   0,    0,    491,  375,  1226, 0,    0,    924,  0,    0,    0,    0,    1460, 718,
        0,    0,    0,    1479, 1633, 0,    0,    1114, 1346, 164,  0,    171,  0,    0,    0,    732,
        0,    0,    0,    167,  0,    0,    534,  196,  1160, 0,    0,    1186, 0,    972,  403,  403,
        267,  0,    784,  1230, 0,    1273, 0,    561,  0,    0,    0,    390,  0,    541,  1178, 241,
        136,  241,  1021, 0,    317,  0,    357,  151,  329,  0,    37,   0,    1060, 0,    103,  0,
        0,    312,  0,    0,    0,    0,    0,    0,    0,    596,  0,    0,    0,    794,  0,    836,
        0,    907,  81,   1158, 742,  0,    173,  0,    0,    0,    0,    0,    0,    84,   907,  580,
        0,    0,    0,    462,  0,    25,   687,  0,    0,    373,  0,    0,    0,    0,    0,    1118,
        416,  372,  1124, 527,  0,    0,    670,  493,  954,  1173, 0,    0,    0,    1045, 0,    0,
        0,    155,  0,    899,  0,    0,    37,   915,  190,  1622, 1262, 683,  666,  0,    63,   32,
        934,  1018, 1081, 0,    0,    603,  368,  0,    169,  1264, 1549, 0,    0,    0,    0,    0,
        0,    0,    0,    0,    1408, 0,    522,  775,  0,    0,    949,  224,  1516, 1094, 1199, 645,
        0,    37,   1614, 0,    452,  0,    0,    0,    0,    0,    0,    0,    183,  907,  1266, 1304,
        528,  0,    393,  0,    0,    0,    0,    839,  813,  0,    1032, 0,    0,    1628, 1056, 0,
        0,    0,    365,  0,    291,  1581, 0,    588,  0,    0,    1071, 821,  0,    0,    127,  81,
        0,    0,    0,    0,    1591, 0,    1388, 1570, 1292, 0,    57,   0,    330,  1620, 0,    1240,
        155,  0,    608,  0,    0,    0,    0,    493,  0,    0,    0,    193,  745,  827,  636,  0,
        0,    0,    661,  0,    0,    661,  585,  1587, 0,    0,    1562, 0,    0,    651,  0,    1394,
        0,    320,  0,    1636, 998,  1285, 901,  1593, 0,    0,    0,    0,    0,    0,    262,  1207,
        0,    0,    1663, 1396, 26,   928,  0,    842,  1464, 1271, 648,  0,    934,  856,  0,    418,
        1036, 0,    0,    22,   641,  0,    0,    0,    1181, 174,  1443, 0,    1343, 0,    472,  367,
        134,  0,    1098, 122,  0,    0,    0,    0,    152,  832,  509,  927,  0,    0,    0,    0,
        1284, 0,    0,    0,    0,    0,    1031, 227,  1149, 635,  898,  1026, 7,    723,  232,  282,
        0,    1091, 0,    0,    776,  473,  0,    0,    383,  1098, 466,  0,    0,    407,  82,   518,
        0,    630,  0,    0,    0,    629,  459,  528,  1243, 0,    1164, 1485, 320,  563,  0,    0,
        382,  1500, 681,  207,  0,    735,  0,    0,    0,    464,  356,  1286, 0,    0,    1048, 1019,
        0,    416,  0,    0,    0,    8,    0,    0,    0,    0,    0,    0,    251,  0,    1594, 81,
        1530, 1485, 178,  1282, 18,   463,  0,    0,    195,  1289, 21,   1350, 0,    0,    447,  0,
        1429, 1218, 1596, 0,    1538, 1668, 0,    0,    0,    0,    0,    0,    23,   0,    434,  788,
        0,    864,  0,    0,    0,    1367, 0,    69,   0,    0,    85,   776,  0,    1229, 1524, 1000,
        748,  1593, 1454, 284,  99,   770,  344,  0,    0,    1580, 0,    885,  0,    872,  656,  0,
        246,  731,  122,  592,  0,    675,  216,  186,  1125, 794,  209,  204,  444,  0,    0,    810,
        254,  1043, 0,    1201, 490,  0,    0,    1566, 0,    0,    0,    0,    0,    824,  0,    279,
        141,  0,    0,    0,    767,  0,    645,  0,    0,    637,  0,    398,  0,    1491, 289,  563,
        1441, 600,  1526, 0,    0,    0,    0,    1440, 0,    511,  0,    0,    0,    413,  0,    1654,
        0,    754,  46,   1485, 461,  0,    889,  887,  1532, 0,    504,  335,  854,  0,    1551, 1434,
        0,    226,  1648, 1093, 154,  1249, 0,    1494, 115,  0,    0,    0,    270,  0,    1022, 0,
        0,    556,  0,    362,  416,  420,  964,  995,  34,   1590, 198,  236,  0,    0,    192,  0,
        694,  0,    273,  0,    0,    0,    0,    0,    0,    193,  0,    0,    883,  364,  294,  0,
        0,    642,  0,    202,  0,    0,    572,  635,  0,    0,    980,  704,  0,    1415, 1454, 809,
        0,    963,  1384, 825,  1200, 1660, 0,    0,    1123, 1336, 19,   649,  540,  1472, 1615, 1473,
        0,    1075, 0,    526,  0,    0,    0,    411,  0,    728,  0,    0,    0,    1080, 206,  467,
        760,  0,    0,    0,    362,  397,  755,  0,    0,    0,    251,  376,  1566, 557,  0,    0,
        76,   0,    0,    936,  396,  379,  137,  632,  0,    1012, 733,  0,    522,  0,    0,    0,
        0,    914,  0,    0,    1291, 0,    123,  641,  369,  724,  775,  0,    663,  348,  846,  1457,
        881,  514,  0,    773,  0,    0,    0,    462,  1198, 0,    1242, 0,    0,    0,    573,  922,
        0,    70,   1315, 526,  497,  128,  0,    851,  0,    0,    293,  1426, 0,    0,    44,   625,
        1062, 0,    0,    241,  0,    0,    1505, 0,    1539, 206,  0,    1352, 0,    0,    0,    1174,
        359,  1665, 224,  0,    536,  1582, 586,  0,    697,  249,  0,    0,    99,   1304, 1230, 0,
        0,    231,  0,    977,  0,    352,  0,    0,    312,  0,    0,    139,  0,    0,    1523, 930,
        0,    1027, 1014, 0,    0,    1599, 1644, 0,    0,    11,   217,  410,  0,    280,  68,   337,
        1072, 115,  0,    841,  1210, 333,  0,    1118, 1527, 0,    221,  471,  0,    394,  77,   0,
        14,   272,  1226, 1178, 0,    276,  0,    245,  732,  0,    0,    923,  0,    863,  757,  1200,
        250,  679,  0,    0,    0,    778,  8,    0,    1640, 861,  224,  0,    475,  38,   1049, 1547,
        1439, 854,  0,    1236, 1359, 338,  190,  0,    1387, 130,  1042, 1232, 0,    903,  305,  716,
        529,  1177, 1627, 84,   1591, 596,  520,  0,    0,    0,    58,   0,    179,  0,    0,    187,
        0,    0,    0,    0,    1056, 1135, 0,    1485, 0,    705,  368,  0,    943,  1303, 804,  399,
        487,  0,    1315, 1494, 653,  0,    0,    308,  306,  690,  909,  1004, 1244, 0,    197,  1117,
        983,  903,  405,  0,    230,  391,  111,  1398, 0,    853,  148,  469,  517,  0,    616,  594,
        407,  787,  4,    938,  0,    0,    1580, 0,    707,  0,    0,    0,    0,    0,    336,  682,
        0,    280,  0,    0,    934,  917,  1062, 0,    0,    1476, 246,  141,  0,    1491, 554,  52,
        0,    307,  478,  0,    718,  80,   0,    101,  881,  455,  1587, 1548, 0,    82,   1408, 886,
        78,   67,   708,  275,  791,  0,    0,    0,    0,    542,  1664, 660,  895,  0,    0,    0,
        464,  1503, 1453, 0,    0,    1254, 135,  0,    141,  1383, 94,   0,    0,    0,    0,    1643,
        1196, 0,    568,  796,  1622, 0,    1509, 0,    0,    779,  499,  1198, 429,  0,    1343, 400,
        591,  374,  1409, 0,    147,  0,    0,    1182, 0,    40,   742,  1200, 98,   1395, 195,  0,
        126,  206,  0,    295,  355,  1058, 313,  167,  465,  788,  838,  0,    960,  0,    35,   0,
        551,  1481, 131,  243,  575,  0,    0,    448,  0,    510,  929,  0,    0,    588,  542,  1549,
        1528, 1552, 0,    141,  877,  283,  0,    1024, 369,  0,    0,    0,    1078, 154,  1564, 978,
        755,  0,    1492, 888,  1638, 32,   662,  606,  532,  796,  0,    0,    1378, 0,    928,  501,
        553,  287,  0,    0,    0,    1280, 887,  1036, 1403, 0,    0,    1047, 757,  0,    1333, 107,
        115,  0,    0,    282,  1285, 933,  1355, 0,    837,  926,  840,  511,  688,  1045, 679,  1085,
        298,  509,  0,    1311, 0,    280,  0,    386,  403,  1517, 0,    0,    120,  786,  1161, 345,
        1647, 1316, 485,  0,    763,  1000, 415,  1433, 0,    517,  773,  0,    324,  53,   554,  1124,
        935,  144,  1468, 1480, 627,  1341, 1618, 1439, 1406, 120,  46,   916,  0,    0,    1667, 0,
        1620, 1113, 81,   443,  0,    0,    0,    1276, 0,    0,    609,  0,    239,  0,    0,    0,
        1147, 1452, 285,  0,    0,    747,  1312, 366,  681,  0,    395,  792,  0,    80,   0,    1498,
        1209, 0,    0,    0,    0,    927,  0,    1190, 241,  1245, 1544, 217,  1063, 0,    1357, 47,
        0,    41,   743,  822,  629,  495,  0,    1327, 277,  273,  133,  124,  0,    224,  189,  0,
        0,    0,    153,  0,    654,  81,   0,    465,  0,    0,    868,  1036, 530,  769,  574,  0,
        752,  0,    180,  105,  440,  1325, 0,    0,    0,    1122, 918,  0,    0,    863,  0,    741,
        1452, 0,    0,    437,  0,    0,    604,  1647, 44,   278,  1184, 406,  140,  1507, 275,  874,
        0,    0,    308,  0,    63,   0,    378,  588,  801,  1075, 1188, 150,  0,    407,  187,  0,
        393,  17,   673,  0,    496,  305,  0,    1415, 1419, 0,    0,    0,    1057, 725,  15,   455,
        0,    0,    0,    0,    0,    0,    791,  834,  488,  1485, 0,    1135, 973,  0,    0,    240,
        1035, 0,    644,  445,  657,  1383, 0,    670,  849,  0,    0,    0,    982,  0,    135,  675,
        758,  565,  354,  0,    725,  0,    0,    1095, 131,  0,    0,    0,    595,  1289, 667,  0,
        333,  1072, 1619, 0,    622,  855,  826,  921};
    
    int MangledHashG(const char *key, const int *T)
    {
        int sum = 0;
    
        for (int i = 0; key[i] != '\0'; i++)
        {
            sum += T[i] * key[i];
            sum %= 1672;
        }
        return mangledkG[sum];
    }
    
    int MangledPerfectHash(const char *key)
    {
        if (strlen(key) > 37)
            return 0;
    
        return (MangledHashG(key, mangledkT1) + MangledHashG(key, mangledkT2)) % 1672;
    }
    
    constexpr int unmangledkT1[] = {277, 59,  31,  44,  197, 182, 56,  205, 196, 115, 78,  90, 14,
                                    17,  268, 111, 200, 47,  166, 160, 180, 146, 157, 131, 29, 198};
    constexpr int unmangledkT2[] = {65, 240, 118, 268, 65,  272, 67, 89,  124, 39,  161, 140, 164,
                                    62, 37,  125, 263, 194, 237, 86, 191, 157, 254, 179, 95,  256};
    constexpr int unmangledkG[]  = {
        0,   0,   0,   0,   0,   0,   0,   0,   0,   84,  0,   0,   0,   0,   0,   0,   161, 182,
        0,   158, 0,   0,   0,   51,  0,   0,   0,   0,   0,   0,   26,  111, 0,   0,   106, 0,
        0,   0,   255, 64,  27,  0,   0,   0,   0,   3,   7,   64,  146, 0,   0,   0,   182, 166,
        260, 0,   121, 0,   79,  0,   0,   24,  248, 212, 84,  0,   285, 0,   19,  192, 0,   7,
        33,  0,   0,   0,   0,   0,   137, 0,   0,   46,  0,   32,  20,  0,   0,   234, 0,   0,
        0,   0,   36,  0,   0,   191, 44,  0,   0,   0,   0,   104, 21,  89,  0,   0,   31,  0,
        166, 143, 9,   0,   161, 87,  0,   10,  63,  72,  76,  0,   0,   0,   236, 83,  0,   0,
        129, 0,   0,   7,   0,   0,   125, 0,   43,  0,   179, 0,   92,  0,   81,  268, 0,   0,
        0,   0,   182, 250, 228, 0,   18,  128, 0,   54,  0,   0,   94,  51,  59,  0,   0,   0,
        0,   37,  155, 48,  0,   0,   176, 17,  0,   0,   0,   76,  169, 38,  41,  0,   136, 285,
        0,   192, 0,   0,   135, 251, 0,   0,   105, 0,   98,  139, 228, 0,   0,   64,  0,   206,
        0,   0,   198, 0,   168, 76,  0,   0,   200, 0,   6,   97,  87,  193, 0,   30,  0,   57,
        0,   0,   63,  0,   60,  78,  1,   118, 73,  67,  0,   225, 49,  0,   0,   42,  260, 142,
        0,   264, 28,  4,   67,  286, 260, 0,   0,   19,  46,  111, 21,  14,  85,  0,   195, 77,
        0,   0,   279, 0,   145, 0,   20,  286, 101, 70,  133, 63,  55,  245, 68,  25,  24,  52,
        38,  0,   34,  94,  0,   70,  243, 0,   0,   225, 126, 283, 11,  0,   35,  0,   61};
    
    int UnmangledHashG(const char *key, const int *T)
    {
        int sum = 0;
    
        for (int i = 0; key[i] != '\0'; i++)
        {
            sum += T[i] * key[i];
            sum %= 287;
        }
        return unmangledkG[sum];
    }
    
    int UnmangledPerfectHash(const char *key)
    {
        if (strlen(key) > 26)
            return 0;
    
        return (UnmangledHashG(key, unmangledkT1) + UnmangledHashG(key, unmangledkT2)) % 287;
    }
    
    }  // namespace
    
    namespace sh
    {
    
    template <>
    const size_t ImmutableString::FowlerNollVoHash<4>::kFnvPrime = 16777619u;
    
    template <>
    const size_t ImmutableString::FowlerNollVoHash<4>::kFnvOffsetBasis = 0x811c9dc5u;
    
    template <>
    const size_t ImmutableString::FowlerNollVoHash<8>::kFnvPrime =
        static_cast<size_t>(1099511628211ull);
    
    template <>
    const size_t ImmutableString::FowlerNollVoHash<8>::kFnvOffsetBasis =
        static_cast<size_t>(0xcbf29ce484222325ull);
    
    uint32_t ImmutableString::mangledNameHash() const
    {
        return MangledPerfectHash(data());
    }
    
    uint32_t ImmutableString::unmangledNameHash() const
    {
        return UnmangledPerfectHash(data());
    }
    
    }  // namespace sh