1//===- TargetSelect.h -----------------------------------------------------===//
2//
3//                     The MCLinker Project
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9#ifndef MCLD_SUPPORT_TARGETSELECT_H_
10#define MCLD_SUPPORT_TARGETSELECT_H_
11
12extern "C" {
13// Declare all of the target-initialization functions that are available.
14#define MCLD_TARGET(TargetName) void MCLDInitialize##TargetName##LDTargetInfo();
15#include "mcld/Config/Targets.def"  // NOLINT [build/include] [4]
16
17// Declare all of the available emulators.
18#define MCLD_TARGET(TargetName) void MCLDInitialize##TargetName##Emulation();
19#include "mcld/Config/Targets.def"  // NOLINT [build/include] [4]
20
21// Declare all of the available target-specific linker
22#define MCLD_LINKER(TargetName) void MCLDInitialize##TargetName##LDBackend();
23#include "mcld/Config/Linkers.def"  // NOLINT [build/include] [4]
24
25// Declare all of the available target-specific diagnostic line infomation
26#define MCLD_LINKER(TargetName) \
27  void MCLDInitialize##TargetName##DiagnosticLineInfo();
28#include "mcld/Config/Linkers.def"  // NOLINT [build/include] [4]
29
30}  // extern "C"
31
32namespace mcld {
33/// InitializeAllTargetInfos - The main program should call this function if
34/// it wants access to all available targets that MCLD is configured to
35/// support, to make them available via the TargetRegistry.
36///
37/// It is legal for a client to make multiple calls to this function.
38inline void InitializeAllTargetInfos() {
39#define MCLD_TARGET(TargetName) MCLDInitialize##TargetName##LDTargetInfo();
40#include "mcld/Config/Targets.def"  // NOLINT [build/include] [4]
41}
42
43/// InitializeAllTargets - The main program should call this function if it
44/// wants access to all available target machines that MCLD is configured to
45/// support, to make them available via the TargetRegistry.
46///
47/// It is legal for a client to make multiple calls to this function.
48inline void InitializeAllTargets() {
49  mcld::InitializeAllTargetInfos();
50
51#define MCLD_TARGET(TargetName) MCLDInitialize##TargetName##LDBackend();
52#include "mcld/Config/Targets.def"  // NOLINT [build/include] [4]
53}
54
55/// InitializeAllEmulations - The main program should call this function if
56/// it wants all emulations to be configured to support. This function makes
57/// all emulations available via the TargetRegistry.
58inline void InitializeAllEmulations() {
59#define MCLD_TARGET(TargetName) MCLDInitialize##TargetName##Emulation();
60#include "mcld/Config/Targets.def"  // NOLINT [build/include] [4]
61}
62
63/// InitializeMsgHandler - The main program should call this function if it
64/// wants to print linker-specific messages. To make them available via the
65/// TargetRegistry.
66inline void InitializeAllDiagnostics() {
67#define MCLD_LINKER(TargetName) \
68  MCLDInitialize##TargetName##DiagnosticLineInfo();
69#include "mcld/Config/Linkers.def"  // NOLINT [build/include] [4]
70}
71
72}  // namespace mcld
73
74#endif  // MCLD_SUPPORT_TARGETSELECT_H_
75