target.h (1780B)
1 // This file is part of AsmJit project <https://asmjit.com> 2 // 3 // See <asmjit/core.h> or LICENSE.md for license and copyright information 4 // SPDX-License-Identifier: Zlib 5 6 #ifndef ASMJIT_CORE_TARGET_H_INCLUDED 7 #define ASMJIT_CORE_TARGET_H_INCLUDED 8 9 #include "../core/archtraits.h" 10 #include "../core/cpuinfo.h" 11 #include "../core/func.h" 12 13 ASMJIT_BEGIN_NAMESPACE 14 15 //! \addtogroup asmjit_core 16 //! \{ 17 18 //! Target is an abstract class that describes a machine code target. 19 class ASMJIT_VIRTAPI Target { 20 public: 21 ASMJIT_BASE_CLASS(Target) 22 ASMJIT_NONCOPYABLE(Target) 23 24 //! Target environment information. 25 Environment _environment; 26 //! Target CPU features. 27 CpuFeatures _cpu_features; 28 //! Target CPU hints. 29 CpuHints _cpu_hints; 30 31 //! \name Construction & Destruction 32 //! \{ 33 34 //! Creates a `Target` instance. 35 ASMJIT_API Target() noexcept; 36 //! Destroys the `Target` instance. 37 ASMJIT_API virtual ~Target() noexcept; 38 39 //! \} 40 41 //! \name Accessors 42 //! \{ 43 44 //! Returns target's environment. 45 [[nodiscard]] 46 ASMJIT_INLINE_NODEBUG const Environment& environment() const noexcept { return _environment; } 47 48 //! Returns the target architecture. 49 [[nodiscard]] 50 ASMJIT_INLINE_NODEBUG Arch arch() const noexcept { return _environment.arch(); } 51 52 //! Returns the target sub-architecture. 53 [[nodiscard]] 54 ASMJIT_INLINE_NODEBUG SubArch sub_arch() const noexcept { return _environment.sub_arch(); } 55 56 [[nodiscard]] 57 //! Returns target CPU features. 58 ASMJIT_INLINE_NODEBUG const CpuFeatures& cpu_features() const noexcept { return _cpu_features; } 59 60 [[nodiscard]] 61 //! Returns target CPU hints. 62 ASMJIT_INLINE_NODEBUG CpuHints cpu_hints() const noexcept { return _cpu_hints; } 63 64 //! \} 65 }; 66 67 //! \} 68 69 ASMJIT_END_NAMESPACE 70 71 #endif // ASMJIT_CORE_TARGET_H_INCLUDED