LLVM API Documentation

RuntimeLibcalls.h
Go to the documentation of this file.
00001 //===-- CodeGen/RuntimeLibcalls.h - Runtime Library Calls -------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file defines the enum representing the list of runtime library calls
00011 // the backend may emit during code generation, and also some helper functions.
00012 //
00013 //===----------------------------------------------------------------------===//
00014 
00015 #ifndef LLVM_CODEGEN_RUNTIMELIBCALLS_H
00016 #define LLVM_CODEGEN_RUNTIMELIBCALLS_H
00017 
00018 #include "llvm/CodeGen/ValueTypes.h"
00019 
00020 namespace llvm {
00021 namespace RTLIB {
00022   /// RTLIB::Libcall enum - This enum defines all of the runtime library calls
00023   /// the backend can emit.  The various long double types cannot be merged,
00024   /// because 80-bit library functions use "xf" and 128-bit use "tf".
00025   ///
00026   /// When adding PPCF128 functions here, note that their names generally need
00027   /// to be overridden for Darwin with the xxx$LDBL128 form.  See
00028   /// PPCISelLowering.cpp.
00029   ///
00030   enum Libcall {
00031     // Integer
00032     SHL_I16,
00033     SHL_I32,
00034     SHL_I64,
00035     SHL_I128,
00036     SRL_I16,
00037     SRL_I32,
00038     SRL_I64,
00039     SRL_I128,
00040     SRA_I16,
00041     SRA_I32,
00042     SRA_I64,
00043     SRA_I128,
00044     MUL_I8,
00045     MUL_I16,
00046     MUL_I32,
00047     MUL_I64,
00048     MUL_I128,
00049     MULO_I32,
00050     MULO_I64,
00051     MULO_I128,
00052     SDIV_I8,
00053     SDIV_I16,
00054     SDIV_I32,
00055     SDIV_I64,
00056     SDIV_I128,
00057     UDIV_I8,
00058     UDIV_I16,
00059     UDIV_I32,
00060     UDIV_I64,
00061     UDIV_I128,
00062     SREM_I8,
00063     SREM_I16,
00064     SREM_I32,
00065     SREM_I64,
00066     SREM_I128,
00067     UREM_I8,
00068     UREM_I16,
00069     UREM_I32,
00070     UREM_I64,
00071     UREM_I128,
00072     SDIVREM_I8,
00073     SDIVREM_I16,
00074     SDIVREM_I32,
00075     SDIVREM_I64,
00076     SDIVREM_I128,
00077     UDIVREM_I8,
00078     UDIVREM_I16,
00079     UDIVREM_I32,
00080     UDIVREM_I64,
00081     UDIVREM_I128,
00082     NEG_I32,
00083     NEG_I64,
00084 
00085     // FLOATING POINT
00086     ADD_F32,
00087     ADD_F64,
00088     ADD_F80,
00089     ADD_F128,
00090     ADD_PPCF128,
00091     SUB_F32,
00092     SUB_F64,
00093     SUB_F80,
00094     SUB_F128,
00095     SUB_PPCF128,
00096     MUL_F32,
00097     MUL_F64,
00098     MUL_F80,
00099     MUL_F128,
00100     MUL_PPCF128,
00101     DIV_F32,
00102     DIV_F64,
00103     DIV_F80,
00104     DIV_F128,
00105     DIV_PPCF128,
00106     REM_F32,
00107     REM_F64,
00108     REM_F80,
00109     REM_F128,
00110     REM_PPCF128,
00111     FMA_F32,
00112     FMA_F64,
00113     FMA_F80,
00114     FMA_F128,
00115     FMA_PPCF128,
00116     POWI_F32,
00117     POWI_F64,
00118     POWI_F80,
00119     POWI_F128,
00120     POWI_PPCF128,
00121     SQRT_F32,
00122     SQRT_F64,
00123     SQRT_F80,
00124     SQRT_F128,
00125     SQRT_PPCF128,
00126     LOG_F32,
00127     LOG_F64,
00128     LOG_F80,
00129     LOG_F128,
00130     LOG_PPCF128,
00131     LOG2_F32,
00132     LOG2_F64,
00133     LOG2_F80,
00134     LOG2_F128,
00135     LOG2_PPCF128,
00136     LOG10_F32,
00137     LOG10_F64,
00138     LOG10_F80,
00139     LOG10_F128,
00140     LOG10_PPCF128,
00141     EXP_F32,
00142     EXP_F64,
00143     EXP_F80,
00144     EXP_F128,
00145     EXP_PPCF128,
00146     EXP2_F32,
00147     EXP2_F64,
00148     EXP2_F80,
00149     EXP2_F128,
00150     EXP2_PPCF128,
00151     SIN_F32,
00152     SIN_F64,
00153     SIN_F80,
00154     SIN_F128,
00155     SIN_PPCF128,
00156     COS_F32,
00157     COS_F64,
00158     COS_F80,
00159     COS_F128,
00160     COS_PPCF128,
00161     SINCOS_F32,
00162     SINCOS_F64,
00163     SINCOS_F80,
00164     SINCOS_F128,
00165     SINCOS_PPCF128,
00166     POW_F32,
00167     POW_F64,
00168     POW_F80,
00169     POW_F128,
00170     POW_PPCF128,
00171     CEIL_F32,
00172     CEIL_F64,
00173     CEIL_F80,
00174     CEIL_F128,
00175     CEIL_PPCF128,
00176     TRUNC_F32,
00177     TRUNC_F64,
00178     TRUNC_F80,
00179     TRUNC_F128,
00180     TRUNC_PPCF128,
00181     RINT_F32,
00182     RINT_F64,
00183     RINT_F80,
00184     RINT_F128,
00185     RINT_PPCF128,
00186     NEARBYINT_F32,
00187     NEARBYINT_F64,
00188     NEARBYINT_F80,
00189     NEARBYINT_F128,
00190     NEARBYINT_PPCF128,
00191     ROUND_F32,
00192     ROUND_F64,
00193     ROUND_F80,
00194     ROUND_F128,
00195     ROUND_PPCF128,
00196     FLOOR_F32,
00197     FLOOR_F64,
00198     FLOOR_F80,
00199     FLOOR_F128,
00200     FLOOR_PPCF128,
00201     COPYSIGN_F32,
00202     COPYSIGN_F64,
00203     COPYSIGN_F80,
00204     COPYSIGN_F128,
00205     COPYSIGN_PPCF128,
00206 
00207     // CONVERSION
00208     FPEXT_F64_F128,
00209     FPEXT_F32_F128,
00210     FPEXT_F32_F64,
00211     FPEXT_F16_F32,
00212     FPROUND_F32_F16,
00213     FPROUND_F64_F16,
00214     FPROUND_F80_F16,
00215     FPROUND_F128_F16,
00216     FPROUND_PPCF128_F16,
00217     FPROUND_F64_F32,
00218     FPROUND_F80_F32,
00219     FPROUND_F128_F32,
00220     FPROUND_PPCF128_F32,
00221     FPROUND_F80_F64,
00222     FPROUND_F128_F64,
00223     FPROUND_PPCF128_F64,
00224     FPTOSINT_F32_I8,
00225     FPTOSINT_F32_I16,
00226     FPTOSINT_F32_I32,
00227     FPTOSINT_F32_I64,
00228     FPTOSINT_F32_I128,
00229     FPTOSINT_F64_I8,
00230     FPTOSINT_F64_I16,
00231     FPTOSINT_F64_I32,
00232     FPTOSINT_F64_I64,
00233     FPTOSINT_F64_I128,
00234     FPTOSINT_F80_I32,
00235     FPTOSINT_F80_I64,
00236     FPTOSINT_F80_I128,
00237     FPTOSINT_F128_I32,
00238     FPTOSINT_F128_I64,
00239     FPTOSINT_F128_I128,
00240     FPTOSINT_PPCF128_I32,
00241     FPTOSINT_PPCF128_I64,
00242     FPTOSINT_PPCF128_I128,
00243     FPTOUINT_F32_I8,
00244     FPTOUINT_F32_I16,
00245     FPTOUINT_F32_I32,
00246     FPTOUINT_F32_I64,
00247     FPTOUINT_F32_I128,
00248     FPTOUINT_F64_I8,
00249     FPTOUINT_F64_I16,
00250     FPTOUINT_F64_I32,
00251     FPTOUINT_F64_I64,
00252     FPTOUINT_F64_I128,
00253     FPTOUINT_F80_I32,
00254     FPTOUINT_F80_I64,
00255     FPTOUINT_F80_I128,
00256     FPTOUINT_F128_I32,
00257     FPTOUINT_F128_I64,
00258     FPTOUINT_F128_I128,
00259     FPTOUINT_PPCF128_I32,
00260     FPTOUINT_PPCF128_I64,
00261     FPTOUINT_PPCF128_I128,
00262     SINTTOFP_I32_F32,
00263     SINTTOFP_I32_F64,
00264     SINTTOFP_I32_F80,
00265     SINTTOFP_I32_F128,
00266     SINTTOFP_I32_PPCF128,
00267     SINTTOFP_I64_F32,
00268     SINTTOFP_I64_F64,
00269     SINTTOFP_I64_F80,
00270     SINTTOFP_I64_F128,
00271     SINTTOFP_I64_PPCF128,
00272     SINTTOFP_I128_F32,
00273     SINTTOFP_I128_F64,
00274     SINTTOFP_I128_F80,
00275     SINTTOFP_I128_F128,
00276     SINTTOFP_I128_PPCF128,
00277     UINTTOFP_I32_F32,
00278     UINTTOFP_I32_F64,
00279     UINTTOFP_I32_F80,
00280     UINTTOFP_I32_F128,
00281     UINTTOFP_I32_PPCF128,
00282     UINTTOFP_I64_F32,
00283     UINTTOFP_I64_F64,
00284     UINTTOFP_I64_F80,
00285     UINTTOFP_I64_F128,
00286     UINTTOFP_I64_PPCF128,
00287     UINTTOFP_I128_F32,
00288     UINTTOFP_I128_F64,
00289     UINTTOFP_I128_F80,
00290     UINTTOFP_I128_F128,
00291     UINTTOFP_I128_PPCF128,
00292 
00293     // COMPARISON
00294     OEQ_F32,
00295     OEQ_F64,
00296     OEQ_F128,
00297     UNE_F32,
00298     UNE_F64,
00299     UNE_F128,
00300     OGE_F32,
00301     OGE_F64,
00302     OGE_F128,
00303     OLT_F32,
00304     OLT_F64,
00305     OLT_F128,
00306     OLE_F32,
00307     OLE_F64,
00308     OLE_F128,
00309     OGT_F32,
00310     OGT_F64,
00311     OGT_F128,
00312     UO_F32,
00313     UO_F64,
00314     UO_F128,
00315     O_F32,
00316     O_F64,
00317     O_F128,
00318 
00319     // MEMORY
00320     MEMCPY,
00321     MEMSET,
00322     MEMMOVE,
00323 
00324     // EXCEPTION HANDLING
00325     UNWIND_RESUME,
00326 
00327     // Family ATOMICs
00328     SYNC_VAL_COMPARE_AND_SWAP_1,
00329     SYNC_VAL_COMPARE_AND_SWAP_2,
00330     SYNC_VAL_COMPARE_AND_SWAP_4,
00331     SYNC_VAL_COMPARE_AND_SWAP_8,
00332     SYNC_VAL_COMPARE_AND_SWAP_16,
00333     SYNC_LOCK_TEST_AND_SET_1,
00334     SYNC_LOCK_TEST_AND_SET_2,
00335     SYNC_LOCK_TEST_AND_SET_4,
00336     SYNC_LOCK_TEST_AND_SET_8,
00337     SYNC_LOCK_TEST_AND_SET_16,
00338     SYNC_FETCH_AND_ADD_1,
00339     SYNC_FETCH_AND_ADD_2,
00340     SYNC_FETCH_AND_ADD_4,
00341     SYNC_FETCH_AND_ADD_8,
00342     SYNC_FETCH_AND_ADD_16,
00343     SYNC_FETCH_AND_SUB_1,
00344     SYNC_FETCH_AND_SUB_2,
00345     SYNC_FETCH_AND_SUB_4,
00346     SYNC_FETCH_AND_SUB_8,
00347     SYNC_FETCH_AND_SUB_16,
00348     SYNC_FETCH_AND_AND_1,
00349     SYNC_FETCH_AND_AND_2,
00350     SYNC_FETCH_AND_AND_4,
00351     SYNC_FETCH_AND_AND_8,
00352     SYNC_FETCH_AND_AND_16,
00353     SYNC_FETCH_AND_OR_1,
00354     SYNC_FETCH_AND_OR_2,
00355     SYNC_FETCH_AND_OR_4,
00356     SYNC_FETCH_AND_OR_8,
00357     SYNC_FETCH_AND_OR_16,
00358     SYNC_FETCH_AND_XOR_1,
00359     SYNC_FETCH_AND_XOR_2,
00360     SYNC_FETCH_AND_XOR_4,
00361     SYNC_FETCH_AND_XOR_8,
00362     SYNC_FETCH_AND_XOR_16,
00363     SYNC_FETCH_AND_NAND_1,
00364     SYNC_FETCH_AND_NAND_2,
00365     SYNC_FETCH_AND_NAND_4,
00366     SYNC_FETCH_AND_NAND_8,
00367     SYNC_FETCH_AND_NAND_16,
00368     SYNC_FETCH_AND_MAX_1,
00369     SYNC_FETCH_AND_MAX_2,
00370     SYNC_FETCH_AND_MAX_4,
00371     SYNC_FETCH_AND_MAX_8,
00372     SYNC_FETCH_AND_MAX_16,
00373     SYNC_FETCH_AND_UMAX_1,
00374     SYNC_FETCH_AND_UMAX_2,
00375     SYNC_FETCH_AND_UMAX_4,
00376     SYNC_FETCH_AND_UMAX_8,
00377     SYNC_FETCH_AND_UMAX_16,
00378     SYNC_FETCH_AND_MIN_1,
00379     SYNC_FETCH_AND_MIN_2,
00380     SYNC_FETCH_AND_MIN_4,
00381     SYNC_FETCH_AND_MIN_8,
00382     SYNC_FETCH_AND_MIN_16,
00383     SYNC_FETCH_AND_UMIN_1,
00384     SYNC_FETCH_AND_UMIN_2,
00385     SYNC_FETCH_AND_UMIN_4,
00386     SYNC_FETCH_AND_UMIN_8,
00387     SYNC_FETCH_AND_UMIN_16,
00388 
00389     // Stack Protector Fail.
00390     STACKPROTECTOR_CHECK_FAIL,
00391 
00392     UNKNOWN_LIBCALL
00393   };
00394 
00395   /// getFPEXT - Return the FPEXT_*_* value for the given types, or
00396   /// UNKNOWN_LIBCALL if there is none.
00397   Libcall getFPEXT(EVT OpVT, EVT RetVT);
00398 
00399   /// getFPROUND - Return the FPROUND_*_* value for the given types, or
00400   /// UNKNOWN_LIBCALL if there is none.
00401   Libcall getFPROUND(EVT OpVT, EVT RetVT);
00402 
00403   /// getFPTOSINT - Return the FPTOSINT_*_* value for the given types, or
00404   /// UNKNOWN_LIBCALL if there is none.
00405   Libcall getFPTOSINT(EVT OpVT, EVT RetVT);
00406 
00407   /// getFPTOUINT - Return the FPTOUINT_*_* value for the given types, or
00408   /// UNKNOWN_LIBCALL if there is none.
00409   Libcall getFPTOUINT(EVT OpVT, EVT RetVT);
00410 
00411   /// getSINTTOFP - Return the SINTTOFP_*_* value for the given types, or
00412   /// UNKNOWN_LIBCALL if there is none.
00413   Libcall getSINTTOFP(EVT OpVT, EVT RetVT);
00414 
00415   /// getUINTTOFP - Return the UINTTOFP_*_* value for the given types, or
00416   /// UNKNOWN_LIBCALL if there is none.
00417   Libcall getUINTTOFP(EVT OpVT, EVT RetVT);
00418 }
00419 }
00420 
00421 #endif