""" RISC-V settings. """ from __future__ import absolute_import from cdsl.settings import SettingGroup, BoolSetting from cdsl.predicates import And import base.settings as shared from .defs import ISA ISA.settings = SettingGroup('riscv', parent=shared.group) supports_m = BoolSetting("CPU supports the 'M' extension (mul/div)") supports_a = BoolSetting("CPU supports the 'A' extension (atomics)") supports_f = BoolSetting("CPU supports the 'F' extension (float)") supports_d = BoolSetting("CPU supports the 'D' extension (double)") enable_m = BoolSetting( "Enable the use of 'M' instructions if available", default=True) use_m = And(supports_m, enable_m) use_a = And(supports_a, shared.enable_atomics) use_f = And(supports_f, shared.enable_float) use_d = And(supports_d, shared.enable_float) full_float = And(shared.enable_simd, supports_f, supports_d) ISA.settings.close(globals())
""" ARM64 settings. """ from __future__ import absolute_import from cdsl.settings import SettingGroup import base.settings as shared from .defs import ISA ISA.settings = SettingGroup('arm64', parent=shared.group) ISA.settings.close(globals())
""" Intel settings. """ from __future__ import absolute_import from cdsl.settings import SettingGroup import base.settings as shared from .defs import ISA ISA.settings = SettingGroup('intel', parent=shared.group) ISA.settings.close(globals())
""" x86 settings. """ from __future__ import absolute_import from cdsl.settings import SettingGroup, BoolSetting, Preset from cdsl.predicates import And, Not import base.settings as shared from .defs import ISA ISA.settings = SettingGroup('x86', parent=shared.group) # The has_* settings here correspond to CPUID bits. # CPUID.01H:ECX has_sse3 = BoolSetting("SSE3: CPUID.01H:ECX.SSE3[bit 0]") has_ssse3 = BoolSetting("SSSE3: CPUID.01H:ECX.SSSE3[bit 9]") has_sse41 = BoolSetting("SSE4.1: CPUID.01H:ECX.SSE4_1[bit 19]") has_sse42 = BoolSetting("SSE4.2: CPUID.01H:ECX.SSE4_2[bit 20]") has_popcnt = BoolSetting("POPCNT: CPUID.01H:ECX.POPCNT[bit 23]") has_avx = BoolSetting("AVX: CPUID.01H:ECX.AVX[bit 28]") # CPUID.(EAX=07H, ECX=0H):EBX has_bmi1 = BoolSetting("BMI1: CPUID.(EAX=07H, ECX=0H):EBX.BMI1[bit 3]") has_bmi2 = BoolSetting("BMI2: CPUID.(EAX=07H, ECX=0H):EBX.BMI2[bit 8]") # CPUID.EAX=80000001H:ECX has_lzcnt = BoolSetting("LZCNT: CPUID.EAX=80000001H:ECX.LZCNT[bit 5]") # The use_* settings here are used to determine if a feature can be used. use_sse41 = And(has_sse41)
""" Cretonne shared settings. This module defines settings relevant for all code generators. """ from __future__ import absolute_import from cdsl.settings import SettingGroup, BoolSetting, EnumSetting, NumSetting group = SettingGroup('shared') opt_level = EnumSetting( """ Optimization level: - default: Very profitable optimizations enabled, none slow. - best: Enable all optimizations - fastest: Optimize for compile time by disabling most optimizations. """, 'default', 'best', 'fastest') enable_verifier = BoolSetting(""" Run the Cretonne IL verifier at strategic times during compilation. This makes compilation slower but catches many bugs. The verifier is disabled by default, except when reading Cretonne IL from a text file. """) is_64bit = BoolSetting("Enable 64-bit code generation") return_at_end = BoolSetting(""" Generate functions with at most a single return instruction at the end of the function.
""" Cretonne shared settings. This module defines settings are are relevant for all code generators. """ from __future__ import absolute_import from cdsl.settings import SettingGroup, BoolSetting, EnumSetting group = SettingGroup('shared') opt_level = EnumSetting( """ Optimization level: - default: Very profitable optimizations enabled, none slow. - best: Enable all optimizations - fastest: Optimize for compile time by disabling most optimizations. """, 'default', 'best', 'fastest') is_64bit = BoolSetting("Enable 64-bit code generation") enable_float = BoolSetting( """Enable the use of floating-point instructions""", default=True) enable_simd = BoolSetting( """Enable the use of SIMD instructions.""", default=True) enable_atomics = BoolSetting(