[WebAssembly] Factor out a TypeToString function, since we need it in multiple places.
[oota-llvm.git] / lib / Target / WebAssembly / WebAssemblyTargetObjectFile.h
1 //===-- WebAssemblyTargetObjectFile.h - WebAssembly Object Info -*- 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 /// \brief This file declares the WebAssembly-specific subclass of
12 /// TargetLoweringObjectFile.
13 ///
14 //===----------------------------------------------------------------------===//
15
16 #ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYTARGETOBJECTFILE_H
17 #define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYTARGETOBJECTFILE_H
18
19 #include "llvm/Target/TargetLoweringObjectFile.h"
20
21 namespace llvm {
22
23 class GlobalVariable;
24
25 class WebAssemblyTargetObjectFile final : public TargetLoweringObjectFile {
26 public:
27   WebAssemblyTargetObjectFile() {
28     TextSection = nullptr;
29     DataSection = nullptr;
30     BSSSection = nullptr;
31     ReadOnlySection = nullptr;
32
33     StaticCtorSection = nullptr;
34     StaticDtorSection = nullptr;
35     LSDASection = nullptr;
36     EHFrameSection = nullptr;
37     DwarfAbbrevSection = nullptr;
38     DwarfInfoSection = nullptr;
39     DwarfLineSection = nullptr;
40     DwarfFrameSection = nullptr;
41     DwarfPubTypesSection = nullptr;
42     DwarfDebugInlineSection = nullptr;
43     DwarfStrSection = nullptr;
44     DwarfLocSection = nullptr;
45     DwarfARangesSection = nullptr;
46     DwarfRangesSection = nullptr;
47   }
48
49   MCSection *getSectionForConstant(const DataLayout &DL, SectionKind Kind,
50                                    const Constant *C) const override {
51     return ReadOnlySection;
52   }
53
54   MCSection *getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
55                                       Mangler &Mang,
56                                       const TargetMachine &TM) const override {
57     return DataSection;
58   }
59
60   MCSection *SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
61                                     Mangler &Mang,
62                                     const TargetMachine &TM) const override;
63 };
64
65 } // end namespace llvm
66
67 #endif