Clement Courbet | 44b4c54 | 2018-06-19 11:28:59 +0000 | [diff] [blame] | 1 | //===-- Target.h ------------------------------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | /// |
| 10 | /// \file |
| 11 | /// |
| 12 | /// Classes that handle the creation of target-specific objects. This is |
| 13 | /// similar to llvm::Target/TargetRegistry. |
| 14 | /// |
| 15 | //===----------------------------------------------------------------------===// |
| 16 | |
| 17 | #ifndef LLVM_TOOLS_LLVM_EXEGESIS_TARGET_H |
| 18 | #define LLVM_TOOLS_LLVM_EXEGESIS_TARGET_H |
| 19 | |
| 20 | #include "llvm/ADT/Triple.h" |
| 21 | |
| 22 | namespace exegesis { |
| 23 | |
| 24 | class ExegesisTarget { |
| 25 | public: |
| 26 | // Returns the ExegesisTarget for the given triple or nullptr if the target |
| 27 | // does not exist. |
| 28 | static const ExegesisTarget* lookup(llvm::StringRef TT); |
| 29 | // Registers a target. Not thread safe. |
| 30 | static void registerTarget(ExegesisTarget *T); |
| 31 | |
Roman Lebedev | 3de9664 | 2018-06-19 11:58:10 +0000 | [diff] [blame^] | 32 | virtual ~ExegesisTarget(); |
Clement Courbet | 44b4c54 | 2018-06-19 11:28:59 +0000 | [diff] [blame] | 33 | |
| 34 | private: |
| 35 | virtual bool matchesArch(llvm::Triple::ArchType Arch) const = 0; |
| 36 | const ExegesisTarget* Next = nullptr; |
| 37 | }; |
| 38 | |
| 39 | } // namespace exegesis |
| 40 | |
| 41 | #endif // LLVM_TOOLS_LLVM_EXEGESIS_TARGET_H |