Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / tools / lldb-server / SystemInitializerLLGS.cpp
blob4233252a84dfc72309b921f5d6454f61318d740d
1 //===-- SystemInitializerLLGS.cpp -------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "SystemInitializerLLGS.h"
11 #if defined(__APPLE__)
12 #include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h"
13 using HostObjectFile = ObjectFileMachO;
14 #elif defined(_WIN32)
15 #include "Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h"
16 using HostObjectFile = ObjectFilePECOFF;
17 #else
18 #include "Plugins/ObjectFile/ELF/ObjectFileELF.h"
19 using HostObjectFile = ObjectFileELF;
20 #endif
22 #if defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64)
23 #define LLDB_TARGET_ARM64
24 #endif
26 #if defined(__arm__) || defined(__arm) || defined(_ARM) || defined(_M_ARM) || \
27 defined(LLDB_TARGET_ARM64)
28 #define LLDB_TARGET_ARM
29 #include "Plugins/Instruction/ARM/EmulateInstructionARM.h"
30 #endif
32 #if defined(__loongarch__)
33 #define LLDB_TARGET_LoongArch
34 #include "Plugins/Instruction/LoongArch/EmulateInstructionLoongArch.h"
35 #endif
37 #if defined(__mips64__) || defined(mips64) || defined(__mips64) || \
38 defined(__MIPS64__) || defined(_M_MIPS64)
39 #define LLDB_TARGET_MIPS64
40 #include "Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h"
41 #endif
43 #if defined(__mips__) || defined(mips) || defined(__mips) || \
44 defined(__MIPS__) || defined(_M_MIPS) || defined(LLDB_TARGET_MIPS64)
45 #define LLDB_TARGET_MIPS
46 #include "Plugins/Instruction/MIPS/EmulateInstructionMIPS.h"
47 #endif
49 #if defined(__riscv)
50 #define LLDB_TARGET_RISCV
51 #include "Plugins/Instruction/RISCV/EmulateInstructionRISCV.h"
52 #endif
54 using namespace lldb_private;
56 llvm::Error SystemInitializerLLGS::Initialize() {
57 if (auto e = SystemInitializerCommon::Initialize())
58 return e;
60 HostObjectFile::Initialize();
62 #if defined(LLDB_TARGET_ARM) || defined(LLDB_TARGET_ARM64)
63 EmulateInstructionARM::Initialize();
64 #endif
65 #if defined(LLDB_TARGET_LoongArch)
66 EmulateInstructionLoongArch::Initialize();
67 #endif
68 #if defined(LLDB_TARGET_MIPS) || defined(LLDB_TARGET_MIPS64)
69 EmulateInstructionMIPS::Initialize();
70 #endif
71 #if defined(LLDB_TARGET_MIPS64)
72 EmulateInstructionMIPS64::Initialize();
73 #endif
74 #if defined(LLDB_TARGET_RISCV)
75 EmulateInstructionRISCV::Initialize();
76 #endif
78 return llvm::Error::success();
81 void SystemInitializerLLGS::Terminate() {
82 HostObjectFile::Terminate();
84 #if defined(LLDB_TARGET_ARM) || defined(LLDB_TARGET_ARM64)
85 EmulateInstructionARM::Terminate();
86 #endif
87 #if defined(LLDB_TARGET_LoongArch)
88 EmulateInstructionLoongArch::Terminate();
89 #endif
90 #if defined(LLDB_TARGET_MIPS) || defined(LLDB_TARGET_MIPS64)
91 EmulateInstructionMIPS::Terminate();
92 #endif
93 #if defined(LLDB_TARGET_MIPS64)
94 EmulateInstructionMIPS64::Terminate();
95 #endif
96 #if defined(LLDB_TARGET_RISCV)
97 EmulateInstructionRISCV::Terminate();
98 #endif
100 SystemInitializerCommon::Terminate();