int_lib.h revision 2d1fdb26e458c4ddc04155c1d421bced3ba90cd0
1/* ===-- int_lib.h - configuration header for compiler-rt -----------------=== 2 * 3 * The LLVM Compiler Infrastructure 4 * 5 * This file is dual licensed under the MIT and the University of Illinois Open 6 * Source Licenses. See LICENSE.TXT for details. 7 * 8 * ===----------------------------------------------------------------------=== 9 * 10 * This file is a configuration header for compiler-rt. 11 * This file is not part of the interface of this library. 12 * 13 * ===----------------------------------------------------------------------=== 14 */ 15 16#ifndef INT_LIB_H 17#define INT_LIB_H 18 19/* Assumption: Signed integral is 2's complement. */ 20/* Assumption: Right shift of signed negative is arithmetic shift. */ 21/* Assumption: Endianness is little or big (not mixed). */ 22 23/* ABI macro definitions */ 24 25/* 26 * TODO define this appropriately for targets that require explicit export 27 * declarations (i.e. Windows) 28 */ 29#define COMPILER_RT_EXPORT 30 31#if __ARM_EABI__ 32# define ARM_EABI_FNALIAS(aeabi_name, name) \ 33 void __aeabi_##aeabi_name() __attribute__((alias("__" #name))); 34# define COMPILER_RT_ABI COMPILER_RT_EXPORT __attribute__((pcs("aapcs"))) 35#else 36# define ARM_EABI_FNALIAS(aeabi_name, name) 37# define COMPILER_RT_ABI COMPILER_RT_EXPORT 38#endif 39 40#if defined(__NetBSD__) && (defined(_KERNEL) || defined(_STANDALONE)) 41/* 42 * Kernel and boot environment can't use normal headers, 43 * so use the equivalent system headers. 44 */ 45# include <machine/limits.h> 46# include <sys/stdint.h> 47# include <sys/types.h> 48#else 49/* Include the standard compiler builtin headers we use functionality from. */ 50# include <limits.h> 51# include <stdint.h> 52# include <stdbool.h> 53# include <float.h> 54#endif 55 56/* Include the commonly used internal type definitions. */ 57#include "int_types.h" 58 59/* Include internal utility function declarations. */ 60#include "int_util.h" 61 62COMPILER_RT_ABI si_int __paritysi2(si_int a); 63COMPILER_RT_ABI si_int __paritydi2(di_int a); 64 65COMPILER_RT_ABI di_int __divdi3(di_int a, di_int b); 66COMPILER_RT_ABI si_int __divsi3(si_int a, si_int b); 67COMPILER_RT_ABI su_int __udivsi3(su_int n, su_int d); 68 69COMPILER_RT_ABI su_int __udivmodsi4(su_int a, su_int b, su_int* rem); 70COMPILER_RT_ABI du_int __udivmoddi4(du_int a, du_int b, du_int* rem); 71#ifdef CRT_HAS_128BIT 72COMPILER_RT_ABI si_int __clzti2(ti_int a); 73COMPILER_RT_ABI tu_int __udivmodti4(tu_int a, tu_int b, tu_int* rem); 74#endif 75 76#endif /* INT_LIB_H */ 77