Home | History | Annotate | Download | only in CodeGen
      1 //===-- CodeGen/RuntimeLibcall.h - Runtime Library Calls --------*- C++ -*-===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 //
     10 // This file defines the enum representing the list of runtime library calls
     11 // the backend may emit during code generation, and also some helper functions.
     12 //
     13 //===----------------------------------------------------------------------===//
     14 
     15 #ifndef LLVM_CODEGEN_RUNTIMELIBCALLS_H
     16 #define LLVM_CODEGEN_RUNTIMELIBCALLS_H
     17 
     18 #include "llvm/CodeGen/ValueTypes.h"
     19 
     20 namespace llvm {
     21 namespace RTLIB {
     22   /// RTLIB::Libcall enum - This enum defines all of the runtime library calls
     23   /// the backend can emit.  The various long double types cannot be merged,
     24   /// because 80-bit library functions use "xf" and 128-bit use "tf".
     25   ///
     26   /// When adding PPCF128 functions here, note that their names generally need
     27   /// to be overridden for Darwin with the xxx$LDBL128 form.  See
     28   /// PPCISelLowering.cpp.
     29   ///
     30   enum Libcall {
     31     // Integer
     32     SHL_I16,
     33     SHL_I32,
     34     SHL_I64,
     35     SHL_I128,
     36     SRL_I16,
     37     SRL_I32,
     38     SRL_I64,
     39     SRL_I128,
     40     SRA_I16,
     41     SRA_I32,
     42     SRA_I64,
     43     SRA_I128,
     44     MUL_I8,
     45     MUL_I16,
     46     MUL_I32,
     47     MUL_I64,
     48     MUL_I128,
     49     MULO_I32,
     50     MULO_I64,
     51     MULO_I128,
     52     SDIV_I8,
     53     SDIV_I16,
     54     SDIV_I32,
     55     SDIV_I64,
     56     SDIV_I128,
     57     UDIV_I8,
     58     UDIV_I16,
     59     UDIV_I32,
     60     UDIV_I64,
     61     UDIV_I128,
     62     SREM_I8,
     63     SREM_I16,
     64     SREM_I32,
     65     SREM_I64,
     66     SREM_I128,
     67     UREM_I8,
     68     UREM_I16,
     69     UREM_I32,
     70     UREM_I64,
     71     UREM_I128,
     72     SDIVREM_I8,
     73     SDIVREM_I16,
     74     SDIVREM_I32,
     75     SDIVREM_I64,
     76     SDIVREM_I128,
     77     UDIVREM_I8,
     78     UDIVREM_I16,
     79     UDIVREM_I32,
     80     UDIVREM_I64,
     81     UDIVREM_I128,
     82     NEG_I32,
     83     NEG_I64,
     84 
     85     // FLOATING POINT
     86     ADD_F32,
     87     ADD_F64,
     88     ADD_F80,
     89     ADD_F128,
     90     ADD_PPCF128,
     91     SUB_F32,
     92     SUB_F64,
     93     SUB_F80,
     94     SUB_F128,
     95     SUB_PPCF128,
     96     MUL_F32,
     97     MUL_F64,
     98     MUL_F80,
     99     MUL_F128,
    100     MUL_PPCF128,
    101     DIV_F32,
    102     DIV_F64,
    103     DIV_F80,
    104     DIV_F128,
    105     DIV_PPCF128,
    106     REM_F32,
    107     REM_F64,
    108     REM_F80,
    109     REM_F128,
    110     REM_PPCF128,
    111     FMA_F32,
    112     FMA_F64,
    113     FMA_F80,
    114     FMA_F128,
    115     FMA_PPCF128,
    116     POWI_F32,
    117     POWI_F64,
    118     POWI_F80,
    119     POWI_F128,
    120     POWI_PPCF128,
    121     SQRT_F32,
    122     SQRT_F64,
    123     SQRT_F80,
    124     SQRT_F128,
    125     SQRT_PPCF128,
    126     LOG_F32,
    127     LOG_F64,
    128     LOG_F80,
    129     LOG_F128,
    130     LOG_PPCF128,
    131     LOG2_F32,
    132     LOG2_F64,
    133     LOG2_F80,
    134     LOG2_F128,
    135     LOG2_PPCF128,
    136     LOG10_F32,
    137     LOG10_F64,
    138     LOG10_F80,
    139     LOG10_F128,
    140     LOG10_PPCF128,
    141     EXP_F32,
    142     EXP_F64,
    143     EXP_F80,
    144     EXP_F128,
    145     EXP_PPCF128,
    146     EXP2_F32,
    147     EXP2_F64,
    148     EXP2_F80,
    149     EXP2_F128,
    150     EXP2_PPCF128,
    151     SIN_F32,
    152     SIN_F64,
    153     SIN_F80,
    154     SIN_F128,
    155     SIN_PPCF128,
    156     COS_F32,
    157     COS_F64,
    158     COS_F80,
    159     COS_F128,
    160     COS_PPCF128,
    161     SINCOS_F32,
    162     SINCOS_F64,
    163     SINCOS_F80,
    164     SINCOS_F128,
    165     SINCOS_PPCF128,
    166     POW_F32,
    167     POW_F64,
    168     POW_F80,
    169     POW_F128,
    170     POW_PPCF128,
    171     CEIL_F32,
    172     CEIL_F64,
    173     CEIL_F80,
    174     CEIL_F128,
    175     CEIL_PPCF128,
    176     TRUNC_F32,
    177     TRUNC_F64,
    178     TRUNC_F80,
    179     TRUNC_F128,
    180     TRUNC_PPCF128,
    181     RINT_F32,
    182     RINT_F64,
    183     RINT_F80,
    184     RINT_F128,
    185     RINT_PPCF128,
    186     NEARBYINT_F32,
    187     NEARBYINT_F64,
    188     NEARBYINT_F80,
    189     NEARBYINT_F128,
    190     NEARBYINT_PPCF128,
    191     FLOOR_F32,
    192     FLOOR_F64,
    193     FLOOR_F80,
    194     FLOOR_F128,
    195     FLOOR_PPCF128,
    196     COPYSIGN_F32,
    197     COPYSIGN_F64,
    198     COPYSIGN_F80,
    199     COPYSIGN_F128,
    200     COPYSIGN_PPCF128,
    201 
    202     // CONVERSION
    203     FPEXT_F64_F128,
    204     FPEXT_F32_F128,
    205     FPEXT_F32_F64,
    206     FPEXT_F16_F32,
    207     FPROUND_F32_F16,
    208     FPROUND_F64_F32,
    209     FPROUND_F80_F32,
    210     FPROUND_F128_F32,
    211     FPROUND_PPCF128_F32,
    212     FPROUND_F80_F64,
    213     FPROUND_F128_F64,
    214     FPROUND_PPCF128_F64,
    215     FPTOSINT_F32_I8,
    216     FPTOSINT_F32_I16,
    217     FPTOSINT_F32_I32,
    218     FPTOSINT_F32_I64,
    219     FPTOSINT_F32_I128,
    220     FPTOSINT_F64_I8,
    221     FPTOSINT_F64_I16,
    222     FPTOSINT_F64_I32,
    223     FPTOSINT_F64_I64,
    224     FPTOSINT_F64_I128,
    225     FPTOSINT_F80_I32,
    226     FPTOSINT_F80_I64,
    227     FPTOSINT_F80_I128,
    228     FPTOSINT_F128_I32,
    229     FPTOSINT_F128_I64,
    230     FPTOSINT_F128_I128,
    231     FPTOSINT_PPCF128_I32,
    232     FPTOSINT_PPCF128_I64,
    233     FPTOSINT_PPCF128_I128,
    234     FPTOUINT_F32_I8,
    235     FPTOUINT_F32_I16,
    236     FPTOUINT_F32_I32,
    237     FPTOUINT_F32_I64,
    238     FPTOUINT_F32_I128,
    239     FPTOUINT_F64_I8,
    240     FPTOUINT_F64_I16,
    241     FPTOUINT_F64_I32,
    242     FPTOUINT_F64_I64,
    243     FPTOUINT_F64_I128,
    244     FPTOUINT_F80_I32,
    245     FPTOUINT_F80_I64,
    246     FPTOUINT_F80_I128,
    247     FPTOUINT_F128_I32,
    248     FPTOUINT_F128_I64,
    249     FPTOUINT_F128_I128,
    250     FPTOUINT_PPCF128_I32,
    251     FPTOUINT_PPCF128_I64,
    252     FPTOUINT_PPCF128_I128,
    253     SINTTOFP_I32_F32,
    254     SINTTOFP_I32_F64,
    255     SINTTOFP_I32_F80,
    256     SINTTOFP_I32_F128,
    257     SINTTOFP_I32_PPCF128,
    258     SINTTOFP_I64_F32,
    259     SINTTOFP_I64_F64,
    260     SINTTOFP_I64_F80,
    261     SINTTOFP_I64_F128,
    262     SINTTOFP_I64_PPCF128,
    263     SINTTOFP_I128_F32,
    264     SINTTOFP_I128_F64,
    265     SINTTOFP_I128_F80,
    266     SINTTOFP_I128_F128,
    267     SINTTOFP_I128_PPCF128,
    268     UINTTOFP_I32_F32,
    269     UINTTOFP_I32_F64,
    270     UINTTOFP_I32_F80,
    271     UINTTOFP_I32_F128,
    272     UINTTOFP_I32_PPCF128,
    273     UINTTOFP_I64_F32,
    274     UINTTOFP_I64_F64,
    275     UINTTOFP_I64_F80,
    276     UINTTOFP_I64_F128,
    277     UINTTOFP_I64_PPCF128,
    278     UINTTOFP_I128_F32,
    279     UINTTOFP_I128_F64,
    280     UINTTOFP_I128_F80,
    281     UINTTOFP_I128_F128,
    282     UINTTOFP_I128_PPCF128,
    283 
    284     // COMPARISON
    285     OEQ_F32,
    286     OEQ_F64,
    287     OEQ_F128,
    288     UNE_F32,
    289     UNE_F64,
    290     UNE_F128,
    291     OGE_F32,
    292     OGE_F64,
    293     OGE_F128,
    294     OLT_F32,
    295     OLT_F64,
    296     OLT_F128,
    297     OLE_F32,
    298     OLE_F64,
    299     OLE_F128,
    300     OGT_F32,
    301     OGT_F64,
    302     OGT_F128,
    303     UO_F32,
    304     UO_F64,
    305     UO_F128,
    306     O_F32,
    307     O_F64,
    308     O_F128,
    309 
    310     // MEMORY
    311     MEMCPY,
    312     MEMSET,
    313     MEMMOVE,
    314 
    315     // EXCEPTION HANDLING
    316     UNWIND_RESUME,
    317 
    318     // Family ATOMICs
    319     SYNC_VAL_COMPARE_AND_SWAP_1,
    320     SYNC_VAL_COMPARE_AND_SWAP_2,
    321     SYNC_VAL_COMPARE_AND_SWAP_4,
    322     SYNC_VAL_COMPARE_AND_SWAP_8,
    323     SYNC_LOCK_TEST_AND_SET_1,
    324     SYNC_LOCK_TEST_AND_SET_2,
    325     SYNC_LOCK_TEST_AND_SET_4,
    326     SYNC_LOCK_TEST_AND_SET_8,
    327     SYNC_FETCH_AND_ADD_1,
    328     SYNC_FETCH_AND_ADD_2,
    329     SYNC_FETCH_AND_ADD_4,
    330     SYNC_FETCH_AND_ADD_8,
    331     SYNC_FETCH_AND_SUB_1,
    332     SYNC_FETCH_AND_SUB_2,
    333     SYNC_FETCH_AND_SUB_4,
    334     SYNC_FETCH_AND_SUB_8,
    335     SYNC_FETCH_AND_AND_1,
    336     SYNC_FETCH_AND_AND_2,
    337     SYNC_FETCH_AND_AND_4,
    338     SYNC_FETCH_AND_AND_8,
    339     SYNC_FETCH_AND_OR_1,
    340     SYNC_FETCH_AND_OR_2,
    341     SYNC_FETCH_AND_OR_4,
    342     SYNC_FETCH_AND_OR_8,
    343     SYNC_FETCH_AND_XOR_1,
    344     SYNC_FETCH_AND_XOR_2,
    345     SYNC_FETCH_AND_XOR_4,
    346     SYNC_FETCH_AND_XOR_8,
    347     SYNC_FETCH_AND_NAND_1,
    348     SYNC_FETCH_AND_NAND_2,
    349     SYNC_FETCH_AND_NAND_4,
    350     SYNC_FETCH_AND_NAND_8,
    351 
    352     UNKNOWN_LIBCALL
    353   };
    354 
    355   /// getFPEXT - Return the FPEXT_*_* value for the given types, or
    356   /// UNKNOWN_LIBCALL if there is none.
    357   Libcall getFPEXT(EVT OpVT, EVT RetVT);
    358 
    359   /// getFPROUND - Return the FPROUND_*_* value for the given types, or
    360   /// UNKNOWN_LIBCALL if there is none.
    361   Libcall getFPROUND(EVT OpVT, EVT RetVT);
    362 
    363   /// getFPTOSINT - Return the FPTOSINT_*_* value for the given types, or
    364   /// UNKNOWN_LIBCALL if there is none.
    365   Libcall getFPTOSINT(EVT OpVT, EVT RetVT);
    366 
    367   /// getFPTOUINT - Return the FPTOUINT_*_* value for the given types, or
    368   /// UNKNOWN_LIBCALL if there is none.
    369   Libcall getFPTOUINT(EVT OpVT, EVT RetVT);
    370 
    371   /// getSINTTOFP - Return the SINTTOFP_*_* value for the given types, or
    372   /// UNKNOWN_LIBCALL if there is none.
    373   Libcall getSINTTOFP(EVT OpVT, EVT RetVT);
    374 
    375   /// getUINTTOFP - Return the UINTTOFP_*_* value for the given types, or
    376   /// UNKNOWN_LIBCALL if there is none.
    377   Libcall getUINTTOFP(EVT OpVT, EVT RetVT);
    378 }
    379 }
    380 
    381 #endif
    382