15460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao//===- TargetSelect.h -----------------------------------------------------===//
25460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao//
35460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao//                     The MCLinker Project
45460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao//
55460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao// This file is distributed under the University of Illinois Open Source
65460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao// License. See LICENSE.TXT for details.
75460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao//
85460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao//===----------------------------------------------------------------------===//
937b74a387bb3993387029859c2d9d051c41c724eStephen Hines#ifndef MCLD_SUPPORT_TARGETSELECT_H_
1037b74a387bb3993387029859c2d9d051c41c724eStephen Hines#define MCLD_SUPPORT_TARGETSELECT_H_
115460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
125460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liaoextern "C" {
1337b74a387bb3993387029859c2d9d051c41c724eStephen Hines// Declare all of the target-initialization functions that are available.
1422add6ff3426df1a85089fe6a6e1597ee3b6f300Shih-wei Liao#define MCLD_TARGET(TargetName) void MCLDInitialize##TargetName##LDTargetInfo();
1537b74a387bb3993387029859c2d9d051c41c724eStephen Hines#include "mcld/Config/Targets.def"  // NOLINT [build/include] [4]
165460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
1737b74a387bb3993387029859c2d9d051c41c724eStephen Hines// Declare all of the available emulators.
1822add6ff3426df1a85089fe6a6e1597ee3b6f300Shih-wei Liao#define MCLD_TARGET(TargetName) void MCLDInitialize##TargetName##Emulation();
1937b74a387bb3993387029859c2d9d051c41c724eStephen Hines#include "mcld/Config/Targets.def"  // NOLINT [build/include] [4]
2022add6ff3426df1a85089fe6a6e1597ee3b6f300Shih-wei Liao
2137b74a387bb3993387029859c2d9d051c41c724eStephen Hines// Declare all of the available target-specific linker
2222add6ff3426df1a85089fe6a6e1597ee3b6f300Shih-wei Liao#define MCLD_LINKER(TargetName) void MCLDInitialize##TargetName##LDBackend();
2337b74a387bb3993387029859c2d9d051c41c724eStephen Hines#include "mcld/Config/Linkers.def"  // NOLINT [build/include] [4]
2437b74a387bb3993387029859c2d9d051c41c724eStephen Hines
2537b74a387bb3993387029859c2d9d051c41c724eStephen Hines// Declare all of the available target-specific diagnostic line infomation
2637b74a387bb3993387029859c2d9d051c41c724eStephen Hines#define MCLD_LINKER(TargetName) \
2737b74a387bb3993387029859c2d9d051c41c724eStephen Hines  void MCLDInitialize##TargetName##DiagnosticLineInfo();
2837b74a387bb3993387029859c2d9d051c41c724eStephen Hines#include "mcld/Config/Linkers.def"  // NOLINT [build/include] [4]
2937b74a387bb3993387029859c2d9d051c41c724eStephen Hines
3037b74a387bb3993387029859c2d9d051c41c724eStephen Hines}  // extern "C"
3137b74a387bb3993387029859c2d9d051c41c724eStephen Hines
3237b74a387bb3993387029859c2d9d051c41c724eStephen Hinesnamespace mcld {
3337b74a387bb3993387029859c2d9d051c41c724eStephen Hines/// InitializeAllTargetInfos - The main program should call this function if
3437b74a387bb3993387029859c2d9d051c41c724eStephen Hines/// it wants access to all available targets that MCLD is configured to
3537b74a387bb3993387029859c2d9d051c41c724eStephen Hines/// support, to make them available via the TargetRegistry.
3637b74a387bb3993387029859c2d9d051c41c724eStephen Hines///
3737b74a387bb3993387029859c2d9d051c41c724eStephen Hines/// It is legal for a client to make multiple calls to this function.
3837b74a387bb3993387029859c2d9d051c41c724eStephen Hinesinline void InitializeAllTargetInfos() {
3922add6ff3426df1a85089fe6a6e1597ee3b6f300Shih-wei Liao#define MCLD_TARGET(TargetName) MCLDInitialize##TargetName##LDTargetInfo();
4037b74a387bb3993387029859c2d9d051c41c724eStephen Hines#include "mcld/Config/Targets.def"  // NOLINT [build/include] [4]
4137b74a387bb3993387029859c2d9d051c41c724eStephen Hines}
425460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
4337b74a387bb3993387029859c2d9d051c41c724eStephen Hines/// InitializeAllTargets - The main program should call this function if it
4437b74a387bb3993387029859c2d9d051c41c724eStephen Hines/// wants access to all available target machines that MCLD is configured to
4537b74a387bb3993387029859c2d9d051c41c724eStephen Hines/// support, to make them available via the TargetRegistry.
4637b74a387bb3993387029859c2d9d051c41c724eStephen Hines///
4737b74a387bb3993387029859c2d9d051c41c724eStephen Hines/// It is legal for a client to make multiple calls to this function.
4837b74a387bb3993387029859c2d9d051c41c724eStephen Hinesinline void InitializeAllTargets() {
4937b74a387bb3993387029859c2d9d051c41c724eStephen Hines  mcld::InitializeAllTargetInfos();
505460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
5122add6ff3426df1a85089fe6a6e1597ee3b6f300Shih-wei Liao#define MCLD_TARGET(TargetName) MCLDInitialize##TargetName##LDBackend();
5237b74a387bb3993387029859c2d9d051c41c724eStephen Hines#include "mcld/Config/Targets.def"  // NOLINT [build/include] [4]
5337b74a387bb3993387029859c2d9d051c41c724eStephen Hines}
54affc150dc44fab1911775a49636d0ce85333b634Zonr Chang
5537b74a387bb3993387029859c2d9d051c41c724eStephen Hines/// InitializeAllEmulations - The main program should call this function if
5637b74a387bb3993387029859c2d9d051c41c724eStephen Hines/// it wants all emulations to be configured to support. This function makes
5737b74a387bb3993387029859c2d9d051c41c724eStephen Hines/// all emulations available via the TargetRegistry.
5837b74a387bb3993387029859c2d9d051c41c724eStephen Hinesinline void InitializeAllEmulations() {
5922add6ff3426df1a85089fe6a6e1597ee3b6f300Shih-wei Liao#define MCLD_TARGET(TargetName) MCLDInitialize##TargetName##Emulation();
6037b74a387bb3993387029859c2d9d051c41c724eStephen Hines#include "mcld/Config/Targets.def"  // NOLINT [build/include] [4]
6137b74a387bb3993387029859c2d9d051c41c724eStephen Hines}
625460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
6337b74a387bb3993387029859c2d9d051c41c724eStephen Hines/// InitializeMsgHandler - The main program should call this function if it
6437b74a387bb3993387029859c2d9d051c41c724eStephen Hines/// wants to print linker-specific messages. To make them available via the
6537b74a387bb3993387029859c2d9d051c41c724eStephen Hines/// TargetRegistry.
6637b74a387bb3993387029859c2d9d051c41c724eStephen Hinesinline void InitializeAllDiagnostics() {
6737b74a387bb3993387029859c2d9d051c41c724eStephen Hines#define MCLD_LINKER(TargetName) \
6837b74a387bb3993387029859c2d9d051c41c724eStephen Hines  MCLDInitialize##TargetName##DiagnosticLineInfo();
6937b74a387bb3993387029859c2d9d051c41c724eStephen Hines#include "mcld/Config/Linkers.def"  // NOLINT [build/include] [4]
7037b74a387bb3993387029859c2d9d051c41c724eStephen Hines}
715460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
7237b74a387bb3993387029859c2d9d051c41c724eStephen Hines}  // namespace mcld
735460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
7437b74a387bb3993387029859c2d9d051c41c724eStephen Hines#endif  // MCLD_SUPPORT_TARGETSELECT_H_
75