brintos

brintos / llvm-project-archived public Read only

0
0
Text · 11.5 KiB · e2f91ad Raw
542 lines · plain
1declare_args() {2  # Skip the atomic builtin (should normally be provided by a shared library).3  compiler_rt_exclude_atomic_builtin = true4}5 6if (current_cpu == "x86" || current_cpu == "x64") {7  # long double is not 80 bits on Android or MSVC.8  long_double_is_80_bits = current_os != "android" && current_os != "win"9}10 11builtins_defines = []12 13# This is based on who sets HasFloat16 to true in clang/lib/Basic/Targets.14if (current_cpu == "arm" || current_cpu == "arm64" ||15    current_cpu == "hexagon" || current_cpu == "riscv" ||16    current_cpu == "riscv64" || current_cpu == "x64") {17  builtins_defines += [ "COMPILER_RT_HAS_FLOAT16" ]18}19 20builtins_sources = [21  "absvdi2.c",22  "absvsi2.c",23  "absvti2.c",24  "adddf3.c",25  "addsf3.c",26  "addvdi3.c",27  "addvsi3.c",28  "addvti3.c",29  "apple_versioning.c",30  "ashldi3.c",31  "ashlti3.c",32  "ashrdi3.c",33  "ashrti3.c",34  "bswapdi2.c",35  "bswapsi2.c",36  "clzdi2.c",37  "clzsi2.c",38  "clzti2.c",39  "cmpdi2.c",40  "cmpti2.c",41  "comparedf2.c",42  "comparesf2.c",43  "ctzdi2.c",44  "ctzsi2.c",45  "ctzti2.c",46  "divdc3.c",47  "divdf3.c",48  "divdi3.c",49  "divmoddi4.c",50  "divmodsi4.c",51  "divmodti4.c",52  "divsc3.c",53  "divsf3.c",54  "divsi3.c",55  "divti3.c",56  "extendhfdf2.c",57  "extendhfsf2.c",58  "extendsfdf2.c",59  "ffsdi2.c",60  "ffssi2.c",61  "ffsti2.c",62  "fixdfdi.c",63  "fixdfsi.c",64  "fixdfti.c",65  "fixsfdi.c",66  "fixsfsi.c",67  "fixsfti.c",68  "fixunsdfdi.c",69  "fixunsdfsi.c",70  "fixunsdfti.c",71  "fixunssfdi.c",72  "fixunssfsi.c",73  "fixunssfti.c",74  "floatdidf.c",75  "floatdisf.c",76  "floatsidf.c",77  "floatsisf.c",78  "floattidf.c",79  "floattisf.c",80  "floatundidf.c",81  "floatundisf.c",82  "floatunsidf.c",83  "floatunsisf.c",84  "floatuntidf.c",85  "floatuntisf.c",86  "fp_mode.c",87  "int_util.c",88  "lshrdi3.c",89  "lshrti3.c",90  "moddi3.c",91  "modsi3.c",92  "modti3.c",93  "muldc3.c",94  "muldf3.c",95  "muldi3.c",96  "mulodi4.c",97  "mulosi4.c",98  "muloti4.c",99  "mulsc3.c",100  "mulsf3.c",101  "multi3.c",102  "mulvdi3.c",103  "mulvsi3.c",104  "mulvti3.c",105  "negdf2.c",106  "negdi2.c",107  "negsf2.c",108  "negti2.c",109  "negvdi2.c",110  "negvsi2.c",111  "negvti2.c",112  "os_version_check.c",113  "paritydi2.c",114  "paritysi2.c",115  "parityti2.c",116  "popcountdi2.c",117  "popcountsi2.c",118  "popcountti2.c",119  "powidf2.c",120  "powisf2.c",121  "subdf3.c",122  "subsf3.c",123  "subvdi3.c",124  "subvsi3.c",125  "subvti3.c",126  "trampoline_setup.c",127  "truncdfhf2.c",128  "truncdfsf2.c",129  "truncsfhf2.c",130  "ucmpdi2.c",131  "ucmpti2.c",132  "udivdi3.c",133  "udivmoddi4.c",134  "udivmodsi4.c",135  "udivmodti4.c",136  "udivsi3.c",137  "udivti3.c",138  "umoddi3.c",139  "umodsi3.c",140  "umodti3.c",141 142  # This depends on unwind.h which is present in Clang headers. We should143  # reconsider this if we ever decide to support building builtins with144  # other compilers.145  "gcc_personality_v0.c",146]147 148if (current_os != "fuchsia") {149  builtins_sources += [ "clear_cache.c" ]150}151 152if (current_os != "fuchsia" && current_os != "baremetal") {153  builtins_sources += [154    "emutls.c",155    "enable_execute_stack.c",156    "eprintf.c",157  ]158}159 160if (current_os == "mac" || current_os == "ios") {161  builtins_sources += [162    "atomic_flag_clear.c",163    "atomic_flag_clear_explicit.c",164    "atomic_flag_test_and_set.c",165    "atomic_flag_test_and_set_explicit.c",166    "atomic_signal_fence.c",167    "atomic_thread_fence.c",168  ]169}170 171if ((current_cpu == "x64" && current_os != "win") || current_cpu == "arm64") {172  # GENERIC_TF_SOURCES173  builtins_sources += [174    "addtf3.c",175    "comparetf2.c",176    "divtc3.c",177    "divtf3.c",178    "extenddftf2.c",179    "extendhftf2.c",180    "extendsftf2.c",181    "fixtfdi.c",182    "fixtfsi.c",183    "fixtfti.c",184    "fixunstfdi.c",185    "fixunstfsi.c",186    "fixunstfti.c",187    "floatditf.c",188    "floatsitf.c",189    "floattitf.c",190    "floatunditf.c",191    "floatunsitf.c",192    "floatuntitf.c",193    "multc3.c",194    "multf3.c",195    "powitf2.c",196    "subtf3.c",197    "trunctfdf2.c",198    "trunctfhf2.c",199    "trunctfsf2.c",200  ]201}202 203if (current_cpu == "x86" || current_cpu == "x64") {204  builtins_sources -= [ "fp_mode.c" ]205  builtins_sources += [206    "cpu_model/x86.c",207    "extendbfsf2.c",208    "i386/fp_mode.c",209    "truncdfbf2.c",210    "truncsfbf2.c",211    "trunctfbf2.c",212    "truncxfbf2.c",213  ]214  if (long_double_is_80_bits) {215    builtins_sources += [216      "divxc3.c",217      "extendhfxf2.c",218      "extendxftf2.c",219      "fixunsxfdi.c",220      "fixunsxfsi.c",221      "fixunsxfti.c",222      "fixxfdi.c",223      "fixxfti.c",224      "floatdixf.c",225      "floattixf.c",226      "floatundixf.c",227      "floatuntixf.c",228      "mulxc3.c",229      "powixf2.c",230      "trunctfxf2.c",231      "truncxfhf2.c",232    ]233  }234}235if (current_cpu == "x86") {236  builtins_sources -= [237    "ashldi3.c",238    "ashrdi3.c",239    "divdi3.c",240    "floatdidf.c",241    "floatdisf.c",242    "floatundidf.c",243    "floatundisf.c",244    "lshrdi3.c",245    "moddi3.c",246    "muldi3.c",247    "udivdi3.c",248    "umoddi3.c",249  ]250  builtins_sources += [251    "i386/ashldi3.S",252    "i386/ashrdi3.S",253    "i386/divdi3.S",254    "i386/floatdidf.S",255    "i386/floatdisf.S",256    "i386/floatundidf.S",257    "i386/floatundisf.S",258    "i386/lshrdi3.S",259    "i386/moddi3.S",260    "i386/muldi3.S",261    "i386/udivdi3.S",262    "i386/umoddi3.S",263  ]264  if (long_double_is_80_bits) {265    builtins_sources -= [266      "floatdixf.c",267      "floatundixf.c",268    ]269    builtins_sources += [270      "i386/floatdixf.S",271      "i386/floatundixf.S",272    ]273  }274  if (current_os == "win") {275    builtins_sources += [276      "i386/chkstk.S",277      "i386/chkstk2.S",278    ]279  }280} else if (current_cpu == "x64") {281  builtins_sources -= [282    "floatdidf.c",283    "floatdisf.c",284    "floatundidf.c",285    "floatundisf.c",286  ]287  builtins_sources += [288    "x86_64/floatdidf.c",289    "x86_64/floatdisf.c",290    "x86_64/floatundidf.S",291    "x86_64/floatundisf.S",292  ]293  if (long_double_is_80_bits) {294    builtins_sources -= [295      "floatdixf.c",296      "floatundixf.c",297    ]298    builtins_sources += [299      "x86_64/floatdixf.c",300      "x86_64/floatundixf.S",301    ]302  }303  if (current_os == "win") {304    builtins_sources += [ "x86_64/chkstk.S" ]305  }306}307 308if (current_cpu == "arm") {309  if (current_os != "mingw") {310    builtins_sources -= [311      "bswapdi2.c",312      "bswapsi2.c",313      "clzdi2.c",314      "clzsi2.c",315      "comparesf2.c",316      "divmodsi4.c",317      "divsi3.c",318      "fp_mode.c",319      "modsi3.c",320      "udivmodsi4.c",321      "udivsi3.c",322      "umodsi3.c",323    ]324    builtins_sources += [325      "arm/aeabi_cdcmp.S",326      "arm/aeabi_cdcmpeq_check_nan.c",327      "arm/aeabi_cfcmp.S",328      "arm/aeabi_cfcmpeq_check_nan.c",329      "arm/aeabi_dcmp.S",330      "arm/aeabi_div0.c",331      "arm/aeabi_drsub.c",332      "arm/aeabi_fcmp.S",333      "arm/aeabi_frsub.c",334      "arm/aeabi_idivmod.S",335      "arm/aeabi_ldivmod.S",336      "arm/aeabi_memcmp.S",337      "arm/aeabi_memcpy.S",338      "arm/aeabi_memmove.S",339      "arm/aeabi_memset.S",340      "arm/aeabi_uidivmod.S",341      "arm/aeabi_uldivmod.S",342      "arm/bswapdi2.S",343      "arm/bswapsi2.S",344      "arm/clzdi2.S",345      "arm/clzsi2.S",346      "arm/comparesf2.S",347      "arm/divmodsi4.S",348      "arm/divsi3.S",349      "arm/fp_mode.c",350      "arm/modsi3.S",351      "arm/switch16.S",352      "arm/switch32.S",353      "arm/switch8.S",354      "arm/switchu8.S",355      "arm/sync_fetch_and_add_4.S",356      "arm/sync_fetch_and_add_8.S",357      "arm/sync_fetch_and_and_4.S",358      "arm/sync_fetch_and_and_8.S",359      "arm/sync_fetch_and_max_4.S",360      "arm/sync_fetch_and_max_8.S",361      "arm/sync_fetch_and_min_4.S",362      "arm/sync_fetch_and_min_8.S",363      "arm/sync_fetch_and_nand_4.S",364      "arm/sync_fetch_and_nand_8.S",365      "arm/sync_fetch_and_or_4.S",366      "arm/sync_fetch_and_or_8.S",367      "arm/sync_fetch_and_sub_4.S",368      "arm/sync_fetch_and_sub_8.S",369      "arm/sync_fetch_and_umax_4.S",370      "arm/sync_fetch_and_umax_8.S",371      "arm/sync_fetch_and_umin_4.S",372      "arm/sync_fetch_and_umin_8.S",373      "arm/sync_fetch_and_xor_4.S",374      "arm/sync_fetch_and_xor_8.S",375      "arm/sync_synchronize.S",376      "arm/udivmodsi4.S",377      "arm/udivsi3.S",378      "arm/umodsi3.S",379    ]380 381    if (current_os == "android") {382      builtins_sources += [383        "arm/adddf3vfp.S",384        "arm/addsf3vfp.S",385        "arm/divdf3vfp.S",386        "arm/divsf3vfp.S",387        "arm/eqdf2vfp.S",388        "arm/eqsf2vfp.S",389        "arm/extendsfdf2vfp.S",390        "arm/fixdfsivfp.S",391        "arm/fixsfsivfp.S",392        "arm/fixunsdfsivfp.S",393        "arm/fixunssfsivfp.S",394        "arm/floatsidfvfp.S",395        "arm/floatsisfvfp.S",396        "arm/floatunssidfvfp.S",397        "arm/floatunssisfvfp.S",398        "arm/gedf2vfp.S",399        "arm/gesf2vfp.S",400        "arm/gtdf2vfp.S",401        "arm/gtsf2vfp.S",402        "arm/ledf2vfp.S",403        "arm/lesf2vfp.S",404        "arm/ltdf2vfp.S",405        "arm/ltsf2vfp.S",406        "arm/muldf3vfp.S",407        "arm/mulsf3vfp.S",408        "arm/nedf2vfp.S",409        "arm/negdf2vfp.S",410        "arm/negsf2vfp.S",411        "arm/nesf2vfp.S",412        "arm/restore_vfp_d8_d15_regs.S",413        "arm/save_vfp_d8_d15_regs.S",414        "arm/subdf3vfp.S",415        "arm/subsf3vfp.S",416        "arm/truncdfsf2vfp.S",417        "arm/unorddf2vfp.S",418        "arm/unordsf2vfp.S",419      ]420    }421  } else {422    builtins_sources += [423      "arm/aeabi_idivmod.S",424      "arm/aeabi_ldivmod.S",425      "arm/aeabi_uidivmod.S",426      "arm/aeabi_uldivmod.S",427      "arm/chkstk.S",428    ]429  }430}431 432if (current_cpu == "arm64") {433  builtins_sources -= [ "fp_mode.c" ]434  builtins_sources += [435    "aarch64/emupac.cpp",436    "aarch64/fp_mode.c",437    "cpu_model/aarch64.c",438  ]439  if (current_os == "mingw") {440    builtins_sources += [ "aarch64/chkstk.S" ]441  }442}443 444if (current_cpu == "avr") {445  builtins_sources += [446    "avr/divmodhi4.S",447    "avr/divmodqi4.S",448    "avr/exit.S",449    "avr/mulhi3.S",450    "avr/mulqi3.S",451    "avr/udivmodhi4.S",452    "avr/udivmodqi4.S",453  ]454}455 456if (current_cpu == "hexagon") {457  builtins_sources += [458    "hexagon/common_entry_exit_abi1.S",459    "hexagon/common_entry_exit_abi2.S",460    "hexagon/common_entry_exit_legacy.S",461    "hexagon/dfaddsub.S",462    "hexagon/dfdiv.S",463    "hexagon/dffma.S",464    "hexagon/dfminmax.S",465    "hexagon/dfmul.S",466    "hexagon/dfsqrt.S",467    "hexagon/divdi3.S",468    "hexagon/divsi3.S",469    "hexagon/fastmath2_dlib_asm.S",470    "hexagon/fastmath2_ldlib_asm.S",471    "hexagon/fastmath_dlib_asm.S",472    "hexagon/memcpy_forward_vp4cp4n2.S",473    "hexagon/memcpy_likely_aligned.S",474    "hexagon/moddi3.S",475    "hexagon/modsi3.S",476    "hexagon/sfdiv_opt.S",477    "hexagon/sfsqrt_opt.S",478    "hexagon/udivdi3.S",479    "hexagon/udivmoddi4.S",480    "hexagon/udivmodsi4.S",481    "hexagon/udivsi3.S",482    "hexagon/umoddi3.S",483    "hexagon/umodsi3.S",484  ]485}486if (current_cpu == "loongarch" || current_cpu == "loongarch64") {487  builtins_sources -= [ "fp_mode.c" ]488  builtins_sources += [ "loongarch/fp_mode.c" ]489}490 491if (current_cpu == "ppc64") {492  builtins_sources += [493    "ppc/divtc3.c",494    "ppc/fixtfdi.c",495    "ppc/fixtfti.c",496    "ppc/fixunstfdi.c",497    "ppc/fixunstfti.c",498    "ppc/floatditf.c",499    "ppc/floattitf.c",500    "ppc/floatunditf.c",501    "ppc/gcc_qadd.c",502    "ppc/gcc_qdiv.c",503    "ppc/gcc_qmul.c",504    "ppc/gcc_qsub.c",505    "ppc/multc3.c",506  ]507}508 509if (current_cpu == "riscv" || current_cpu == "riscv64") {510  builtins_sources += [511    "cpu_model/riscv.c",512    "riscv/fp_mode.c",513    "riscv/restore.S",514    "riscv/save.S",515  ]516}517if (current_cpu == "riscv") {518  builtins_sources += [ "riscv/mulsi3.S" ]519}520 521if (current_cpu == "riscv64") {522  builtins_sources += [ "riscv/muldi3.S" ]523}524 525if (current_cpu == "ve") {526  builtins_sources += [527    "ve/grow_stack.S",528    "ve/grow_stack_align.S",529  ]530}531 532if (current_cpu == "wasm") {533  builtins_sources += [534    "wasm/__c_longjmp.S",535    "wasm/__cpp_exception.S",536  ]537}538 539if (!compiler_rt_exclude_atomic_builtin) {540  builtins_sources += [ "atomic.c" ]541}542