annotate include/llvm/MC/MCContext.h @ 128:c347d3398279 default tip

fix
author mir3636
date Wed, 06 Dec 2017 14:37:17 +0900
parents 803732b1fca8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 //===- MCContext.h - Machine Code Context -----------------------*- C++ -*-===//
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 //
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 // The LLVM Compiler Infrastructure
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 //
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 // This file is distributed under the University of Illinois Open Source
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 // License. See LICENSE.TXT for details.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 //
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 //===----------------------------------------------------------------------===//
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 #ifndef LLVM_MC_MCCONTEXT_H
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 #define LLVM_MC_MCCONTEXT_H
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 #include "llvm/ADT/DenseMap.h"
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
14 #include "llvm/ADT/SetVector.h"
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 #include "llvm/ADT/SmallString.h"
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 #include "llvm/ADT/SmallVector.h"
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 #include "llvm/ADT/StringMap.h"
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
18 #include "llvm/ADT/StringRef.h"
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
19 #include "llvm/ADT/Twine.h"
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
20 #include "llvm/BinaryFormat/Dwarf.h"
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 #include "llvm/MC/MCDwarf.h"
100
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
22 #include "llvm/MC/MCSubtargetInfo.h"
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 #include "llvm/MC/SectionKind.h"
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 #include "llvm/Support/Allocator.h"
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 #include "llvm/Support/Compiler.h"
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 #include "llvm/Support/raw_ostream.h"
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
27 #include <algorithm>
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
28 #include <cassert>
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
29 #include <cstddef>
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
30 #include <cstdint>
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 #include <map>
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
32 #include <memory>
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
33 #include <string>
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
34 #include <utility>
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
35 #include <vector>
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
36
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 namespace llvm {
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
38
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
39 class CodeViewContext;
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 class MCAsmInfo;
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
41 class MCLabel;
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
42 class MCObjectFileInfo;
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
43 class MCRegisterInfo;
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 class MCSection;
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
45 class MCSectionCOFF;
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
46 class MCSectionELF;
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
47 class MCSectionMachO;
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
48 class MCSectionWasm;
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
49 class MCStreamer;
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 class MCSymbol;
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
51 class MCSymbolELF;
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
52 class MCSymbolWasm;
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 class SMLoc;
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
54 class SourceMgr;
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
55
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
56 /// Context object for machine code objects. This class owns all of the
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
57 /// sections that it creates.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 ///
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 class MCContext {
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 public:
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
61 using SymbolTable = StringMap<MCSymbol *, BumpPtrAllocator &>;
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
62
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 private:
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 /// The SourceMgr for this object, if any.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
65 const SourceMgr *SrcMgr;
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
66
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
67 /// The SourceMgr for inline assembly, if any.
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
68 SourceMgr *InlineSrcMgr;
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
69
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
70 /// The MCAsmInfo for this target.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 const MCAsmInfo *MAI;
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
72
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
73 /// The MCRegisterInfo for this target.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 const MCRegisterInfo *MRI;
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
75
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
76 /// The MCObjectFileInfo for this target.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 const MCObjectFileInfo *MOFI;
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
78
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
79 std::unique_ptr<CodeViewContext> CVContext;
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
80
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
81 /// Allocator object used for creating machine code objects.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 ///
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
83 /// We use a bump pointer allocator to avoid the need to track all allocated
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 /// objects.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 BumpPtrAllocator Allocator;
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
86
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
87 SpecificBumpPtrAllocator<MCSectionCOFF> COFFAllocator;
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
88 SpecificBumpPtrAllocator<MCSectionELF> ELFAllocator;
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
89 SpecificBumpPtrAllocator<MCSectionMachO> MachOAllocator;
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
90 SpecificBumpPtrAllocator<MCSectionWasm> WasmAllocator;
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
91
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
92 /// Bindings of names to symbols.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
93 SymbolTable Symbols;
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
94
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
95 /// A mapping from a local label number and an instance count to a symbol.
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
96 /// For example, in the assembly
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
97 /// 1:
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
98 /// 2:
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
99 /// 1:
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
100 /// We have three labels represented by the pairs (1, 0), (2, 0) and (1, 1)
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
101 DenseMap<std::pair<unsigned, unsigned>, MCSymbol *> LocalSymbols;
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
102
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
103 /// Keeps tracks of names that were used both for used declared and
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
104 /// artificial symbols. The value is "true" if the name has been used for a
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
105 /// non-section symbol (there can be at most one of those, plus an unlimited
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
106 /// number of section symbols with the same name).
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
107 StringMap<bool, BumpPtrAllocator &> UsedNames;
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
108
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
109 /// The next ID to dole out to an unnamed assembler temporary symbol with
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
110 /// a given prefix.
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
111 StringMap<unsigned> NextID;
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
112
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
113 /// Instances of directional local labels.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
114 DenseMap<unsigned, MCLabel *> Instances;
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
115 /// NextInstance() creates the next instance of the directional local label
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
116 /// for the LocalLabelVal and adds it to the map if needed.
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
117 unsigned NextInstance(unsigned LocalLabelVal);
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
118 /// GetInstance() gets the current instance of the directional local label
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
119 /// for the LocalLabelVal and adds it to the map if needed.
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
120 unsigned GetInstance(unsigned LocalLabelVal);
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
121
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
122 /// The file name of the log file from the environment variable
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
123 /// AS_SECURE_LOG_FILE. Which must be set before the .secure_log_unique
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
124 /// directive is used or it is an error.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
125 char *SecureLogFile;
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
126 /// The stream that gets written to for the .secure_log_unique directive.
100
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
127 std::unique_ptr<raw_fd_ostream> SecureLog;
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
128 /// Boolean toggled when .secure_log_unique / .secure_log_reset is seen to
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
129 /// catch errors if .secure_log_unique appears twice without
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
130 /// .secure_log_reset appearing between them.
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
131 bool SecureLogUsed = false;
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
132
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
133 /// The compilation directory to use for DW_AT_comp_dir.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
134 SmallString<128> CompilationDir;
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
135
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
136 /// The main file name if passed in explicitly.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
137 std::string MainFileName;
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
138
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
139 /// The dwarf file and directory tables from the dwarf .file directive.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
140 /// We now emit a line table for each compile unit. To reduce the prologue
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
141 /// size of each line table, the files and directories used by each compile
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
142 /// unit are separated.
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
143 std::map<unsigned, MCDwarfLineTable> MCDwarfLineTablesCUMap;
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
144
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
145 /// The current dwarf line information from the last dwarf .loc directive.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
146 MCDwarfLoc CurrentDwarfLoc;
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
147 bool DwarfLocSeen = false;
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
148
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
149 /// Generate dwarf debugging info for assembly source files.
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
150 bool GenDwarfForAssembly = false;
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
151
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
152 /// The current dwarf file number when generate dwarf debugging info for
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
153 /// assembly source files.
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
154 unsigned GenDwarfFileNumber = 0;
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
155
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
156 /// Sections for generating the .debug_ranges and .debug_aranges sections.
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
157 SetVector<MCSection *> SectionsForRanges;
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
158
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
159 /// The information gathered from labels that will have dwarf label
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
160 /// entries when generating dwarf assembly source files.
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
161 std::vector<MCGenDwarfLabelEntry> MCGenDwarfLabelEntries;
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
162
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
163 /// The string to embed in the debug information for the compile unit, if
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
164 /// non-empty.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
165 StringRef DwarfDebugFlags;
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
166
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
167 /// The string to embed in as the dwarf AT_producer for the compile unit, if
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
168 /// non-empty.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
169 StringRef DwarfDebugProducer;
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
170
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
171 /// The maximum version of dwarf that we should emit.
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
172 uint16_t DwarfVersion = 4;
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
173
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
174 /// Honor temporary labels, this is useful for debugging semantic
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
175 /// differences between temporary and non-temporary labels (primarily on
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
176 /// Darwin).
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
177 bool AllowTemporaryLabels = true;
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
178 bool UseNamesOnTempLabels = true;
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
179
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
180 /// The Compile Unit ID that we are currently processing.
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
181 unsigned DwarfCompileUnitID = 0;
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
182
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
183 struct ELFSectionKey {
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
184 std::string SectionName;
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
185 StringRef GroupName;
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
186 unsigned UniqueID;
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
187
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
188 ELFSectionKey(StringRef SectionName, StringRef GroupName,
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
189 unsigned UniqueID)
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
190 : SectionName(SectionName), GroupName(GroupName), UniqueID(UniqueID) {
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
191 }
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
192
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
193 bool operator<(const ELFSectionKey &Other) const {
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
194 if (SectionName != Other.SectionName)
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
195 return SectionName < Other.SectionName;
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
196 if (GroupName != Other.GroupName)
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
197 return GroupName < Other.GroupName;
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
198 return UniqueID < Other.UniqueID;
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
199 }
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
200 };
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
201
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
202 struct COFFSectionKey {
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
203 std::string SectionName;
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
204 StringRef GroupName;
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
205 int SelectionKey;
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
206 unsigned UniqueID;
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
207
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
208 COFFSectionKey(StringRef SectionName, StringRef GroupName,
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
209 int SelectionKey, unsigned UniqueID)
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
210 : SectionName(SectionName), GroupName(GroupName),
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
211 SelectionKey(SelectionKey), UniqueID(UniqueID) {}
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
212
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
213 bool operator<(const COFFSectionKey &Other) const {
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
214 if (SectionName != Other.SectionName)
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
215 return SectionName < Other.SectionName;
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
216 if (GroupName != Other.GroupName)
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
217 return GroupName < Other.GroupName;
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
218 if (SelectionKey != Other.SelectionKey)
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
219 return SelectionKey < Other.SelectionKey;
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
220 return UniqueID < Other.UniqueID;
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
221 }
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
222 };
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
223
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
224 struct WasmSectionKey {
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
225 std::string SectionName;
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
226 StringRef GroupName;
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
227 unsigned UniqueID;
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
228
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
229 WasmSectionKey(StringRef SectionName, StringRef GroupName,
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
230 unsigned UniqueID)
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
231 : SectionName(SectionName), GroupName(GroupName), UniqueID(UniqueID) {
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
232 }
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
233
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
234 bool operator<(const WasmSectionKey &Other) const {
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
235 if (SectionName != Other.SectionName)
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
236 return SectionName < Other.SectionName;
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
237 if (GroupName != Other.GroupName)
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
238 return GroupName < Other.GroupName;
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
239 return UniqueID < Other.UniqueID;
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
240 }
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
241 };
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
242
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
243 StringMap<MCSectionMachO *> MachOUniquingMap;
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
244 std::map<ELFSectionKey, MCSectionELF *> ELFUniquingMap;
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
245 std::map<COFFSectionKey, MCSectionCOFF *> COFFUniquingMap;
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
246 std::map<WasmSectionKey, MCSectionWasm *> WasmUniquingMap;
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
247 StringMap<bool> RelSecNames;
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
248
100
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
249 SpecificBumpPtrAllocator<MCSubtargetInfo> MCSubtargetAllocator;
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
250
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
251 /// Do automatic reset in destructor
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
252 bool AutoReset;
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
253
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
254 bool HadError = false;
100
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
255
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
256 MCSymbol *createSymbolImpl(const StringMapEntry<bool> *Name,
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
257 bool CanBeUnnamed);
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
258 MCSymbol *createSymbol(StringRef Name, bool AlwaysAddSuffix,
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
259 bool IsTemporary);
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
260
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
261 MCSymbol *getOrCreateDirectionalLocalSymbol(unsigned LocalLabelVal,
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
262 unsigned Instance);
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
263
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
264 MCSectionELF *createELFSectionImpl(StringRef Section, unsigned Type,
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
265 unsigned Flags, SectionKind K,
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
266 unsigned EntrySize,
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
267 const MCSymbolELF *Group,
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
268 unsigned UniqueID,
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
269 const MCSymbolELF *Associated);
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
270
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
271 public:
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
272 explicit MCContext(const MCAsmInfo *MAI, const MCRegisterInfo *MRI,
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
273 const MCObjectFileInfo *MOFI,
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
274 const SourceMgr *Mgr = nullptr, bool DoAutoReset = true);
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
275 MCContext(const MCContext &) = delete;
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
276 MCContext &operator=(const MCContext &) = delete;
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
277 ~MCContext();
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
278
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
279 const SourceMgr *getSourceManager() const { return SrcMgr; }
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
280
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
281 void setInlineSourceManager(SourceMgr *SM) { InlineSrcMgr = SM; }
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
282
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
283 const MCAsmInfo *getAsmInfo() const { return MAI; }
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
284
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
285 const MCRegisterInfo *getRegisterInfo() const { return MRI; }
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
286
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
287 const MCObjectFileInfo *getObjectFileInfo() const { return MOFI; }
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
288
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
289 CodeViewContext &getCVContext();
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
290
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
291 void setAllowTemporaryLabels(bool Value) { AllowTemporaryLabels = Value; }
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
292 void setUseNamesOnTempLabels(bool Value) { UseNamesOnTempLabels = Value; }
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
293
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
294 /// \name Module Lifetime Management
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
295 /// @{
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
296
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
297 /// reset - return object to right after construction state to prepare
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
298 /// to process a new module
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
299 void reset();
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
300
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
301 /// @}
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
302
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
303 /// \name Symbol Management
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
304 /// @{
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
305
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
306 /// Create and return a new linker temporary symbol with a unique but
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
307 /// unspecified name.
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
308 MCSymbol *createLinkerPrivateTempSymbol();
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
309
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
310 /// Create and return a new assembler temporary symbol with a unique but
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
311 /// unspecified name.
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
312 MCSymbol *createTempSymbol(bool CanBeUnnamed = true);
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
313
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
314 MCSymbol *createTempSymbol(const Twine &Name, bool AlwaysAddSuffix,
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
315 bool CanBeUnnamed = true);
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
316
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
317 /// Create the definition of a directional local symbol for numbered label
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
318 /// (used for "1:" definitions).
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
319 MCSymbol *createDirectionalLocalSymbol(unsigned LocalLabelVal);
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
320
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
321 /// Create and return a directional local symbol for numbered label (used
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
322 /// for "1b" or 1f" references).
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
323 MCSymbol *getDirectionalLocalSymbol(unsigned LocalLabelVal, bool Before);
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
324
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
325 /// Lookup the symbol inside with the specified \p Name. If it exists,
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
326 /// return it. If not, create a forward reference and return it.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
327 ///
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
328 /// \param Name - The symbol name, which must be unique across all symbols.
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
329 MCSymbol *getOrCreateSymbol(const Twine &Name);
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
330
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
331 /// Gets a symbol that will be defined to the final stack offset of a local
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
332 /// variable after codegen.
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
333 ///
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
334 /// \param Idx - The index of a local variable passed to @llvm.localescape.
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
335 MCSymbol *getOrCreateFrameAllocSymbol(StringRef FuncName, unsigned Idx);
83
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
336
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
337 MCSymbol *getOrCreateParentFrameOffsetSymbol(StringRef FuncName);
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
338
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
339 MCSymbol *getOrCreateLSDASymbol(StringRef FuncName);
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
340
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
341 /// Get the symbol for \p Name, or null.
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
342 MCSymbol *lookupSymbol(const Twine &Name) const;
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
343
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
344 /// Set value for a symbol.
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
345 void setSymbolValue(MCStreamer &Streamer, StringRef Sym, uint64_t Val);
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
346
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
347 /// getSymbols - Get a reference for the symbol table for clients that
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
348 /// want to, for example, iterate over all symbols. 'const' because we
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
349 /// still want any modifications to the table itself to use the MCContext
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
350 /// APIs.
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
351 const SymbolTable &getSymbols() const { return Symbols; }
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
352
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
353 /// @}
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
354
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
355 /// \name Section Management
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
356 /// @{
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
357
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
358 enum : unsigned {
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
359 /// Pass this value as the UniqueID during section creation to get the
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
360 /// generic section with the given name and characteristics. The usual
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
361 /// sections such as .text use this ID.
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
362 GenericSectionID = ~0U
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
363 };
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
364
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
365 /// Return the MCSection for the specified mach-o section. This requires
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
366 /// the operands to be valid.
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
367 MCSectionMachO *getMachOSection(StringRef Segment, StringRef Section,
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
368 unsigned TypeAndAttributes,
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
369 unsigned Reserved2, SectionKind K,
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
370 const char *BeginSymName = nullptr);
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
371
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
372 MCSectionMachO *getMachOSection(StringRef Segment, StringRef Section,
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
373 unsigned TypeAndAttributes, SectionKind K,
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
374 const char *BeginSymName = nullptr) {
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
375 return getMachOSection(Segment, Section, TypeAndAttributes, 0, K,
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
376 BeginSymName);
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
377 }
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
378
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
379 MCSectionELF *getELFSection(const Twine &Section, unsigned Type,
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
380 unsigned Flags) {
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
381 return getELFSection(Section, Type, Flags, 0, "");
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
382 }
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
383
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
384 MCSectionELF *getELFSection(const Twine &Section, unsigned Type,
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
385 unsigned Flags, unsigned EntrySize,
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
386 const Twine &Group) {
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
387 return getELFSection(Section, Type, Flags, EntrySize, Group, ~0);
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
388 }
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
389
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
390 MCSectionELF *getELFSection(const Twine &Section, unsigned Type,
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
391 unsigned Flags, unsigned EntrySize,
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
392 const Twine &Group, unsigned UniqueID) {
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
393 return getELFSection(Section, Type, Flags, EntrySize, Group, UniqueID,
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
394 nullptr);
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
395 }
83
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
396
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
397 MCSectionELF *getELFSection(const Twine &Section, unsigned Type,
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
398 unsigned Flags, unsigned EntrySize,
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
399 const Twine &Group, unsigned UniqueID,
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
400 const MCSymbolELF *Associated);
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
401
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
402 MCSectionELF *getELFSection(const Twine &Section, unsigned Type,
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
403 unsigned Flags, unsigned EntrySize,
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
404 const MCSymbolELF *Group, unsigned UniqueID,
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
405 const MCSymbolELF *Associated);
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
406
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
407 /// Get a section with the provided group identifier. This section is
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
408 /// named by concatenating \p Prefix with '.' then \p Suffix. The \p Type
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
409 /// describes the type of the section and \p Flags are used to further
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
410 /// configure this named section.
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
411 MCSectionELF *getELFNamedSection(const Twine &Prefix, const Twine &Suffix,
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
412 unsigned Type, unsigned Flags,
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
413 unsigned EntrySize = 0);
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
414
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
415 MCSectionELF *createELFRelSection(const Twine &Name, unsigned Type,
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
416 unsigned Flags, unsigned EntrySize,
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
417 const MCSymbolELF *Group,
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
418 const MCSectionELF *RelInfoSection);
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
419
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
420 void renameELFSection(MCSectionELF *Section, StringRef Name);
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
421
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
422 MCSectionELF *createELFGroupSection(const MCSymbolELF *Group);
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
423
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
424 MCSectionCOFF *getCOFFSection(StringRef Section, unsigned Characteristics,
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
425 SectionKind Kind, StringRef COMDATSymName,
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
426 int Selection,
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
427 unsigned UniqueID = GenericSectionID,
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
428 const char *BeginSymName = nullptr);
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
429
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
430 MCSectionCOFF *getCOFFSection(StringRef Section, unsigned Characteristics,
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
431 SectionKind Kind,
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
432 const char *BeginSymName = nullptr);
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
433
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
434 MCSectionCOFF *getCOFFSection(StringRef Section);
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
435
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
436 /// Gets or creates a section equivalent to Sec that is associated with the
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
437 /// section containing KeySym. For example, to create a debug info section
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
438 /// associated with an inline function, pass the normal debug info section
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
439 /// as Sec and the function symbol as KeySym.
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
440 MCSectionCOFF *
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
441 getAssociativeCOFFSection(MCSectionCOFF *Sec, const MCSymbol *KeySym,
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
442 unsigned UniqueID = GenericSectionID);
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
443
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
444 MCSectionWasm *getWasmSection(const Twine &Section, SectionKind K) {
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
445 return getWasmSection(Section, K, nullptr);
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
446 }
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
447
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
448 MCSectionWasm *getWasmSection(const Twine &Section, SectionKind K,
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
449 const char *BeginSymName) {
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
450 return getWasmSection(Section, K, "", ~0, BeginSymName);
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
451 }
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
452
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
453 MCSectionWasm *getWasmSection(const Twine &Section, SectionKind K,
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
454 const Twine &Group, unsigned UniqueID) {
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
455 return getWasmSection(Section, K, Group, UniqueID, nullptr);
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
456 }
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
457
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
458 MCSectionWasm *getWasmSection(const Twine &Section, SectionKind K,
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
459 const Twine &Group, unsigned UniqueID,
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
460 const char *BeginSymName);
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
461
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
462 MCSectionWasm *getWasmSection(const Twine &Section, SectionKind K,
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
463 const MCSymbolWasm *Group, unsigned UniqueID,
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
464 const char *BeginSymName);
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
465
100
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
466 // Create and save a copy of STI and return a reference to the copy.
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
467 MCSubtargetInfo &getSubtargetCopy(const MCSubtargetInfo &STI);
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
468
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
469 /// @}
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
470
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
471 /// \name Dwarf Management
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
472 /// @{
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
473
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
474 /// \brief Get the compilation directory for DW_AT_comp_dir
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
475 /// The compilation directory should be set with \c setCompilationDir before
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
476 /// calling this function. If it is unset, an empty string will be returned.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
477 StringRef getCompilationDir() const { return CompilationDir; }
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
478
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
479 /// \brief Set the compilation directory for DW_AT_comp_dir
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
480 void setCompilationDir(StringRef S) { CompilationDir = S.str(); }
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
481
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
482 /// \brief Get the main file name for use in error messages and debug
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
483 /// info. This can be set to ensure we've got the correct file name
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
484 /// after preprocessing or for -save-temps.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
485 const std::string &getMainFileName() const { return MainFileName; }
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
486
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
487 /// \brief Set the main file name and override the default.
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
488 void setMainFileName(StringRef S) { MainFileName = S; }
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
489
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
490 /// Creates an entry in the dwarf file and directory tables.
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
491 unsigned getDwarfFile(StringRef Directory, StringRef FileName,
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
492 unsigned FileNumber, unsigned CUID);
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
493
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
494 bool isValidDwarfFileNumber(unsigned FileNumber, unsigned CUID = 0);
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
495
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
496 const std::map<unsigned, MCDwarfLineTable> &getMCDwarfLineTables() const {
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
497 return MCDwarfLineTablesCUMap;
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
498 }
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
499
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
500 MCDwarfLineTable &getMCDwarfLineTable(unsigned CUID) {
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
501 return MCDwarfLineTablesCUMap[CUID];
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
502 }
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
503
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
504 const MCDwarfLineTable &getMCDwarfLineTable(unsigned CUID) const {
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
505 auto I = MCDwarfLineTablesCUMap.find(CUID);
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
506 assert(I != MCDwarfLineTablesCUMap.end());
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
507 return I->second;
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
508 }
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
509
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
510 const SmallVectorImpl<MCDwarfFile> &getMCDwarfFiles(unsigned CUID = 0) {
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
511 return getMCDwarfLineTable(CUID).getMCDwarfFiles();
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
512 }
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
513
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
514 const SmallVectorImpl<std::string> &getMCDwarfDirs(unsigned CUID = 0) {
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
515 return getMCDwarfLineTable(CUID).getMCDwarfDirs();
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
516 }
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
517
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
518 bool hasMCLineSections() const {
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
519 for (const auto &Table : MCDwarfLineTablesCUMap)
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
520 if (!Table.second.getMCDwarfFiles().empty() || Table.second.getLabel())
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
521 return true;
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
522 return false;
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
523 }
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
524
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
525 unsigned getDwarfCompileUnitID() { return DwarfCompileUnitID; }
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
526
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
527 void setDwarfCompileUnitID(unsigned CUIndex) {
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
528 DwarfCompileUnitID = CUIndex;
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
529 }
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
530
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
531 void setMCLineTableCompilationDir(unsigned CUID, StringRef CompilationDir) {
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
532 getMCDwarfLineTable(CUID).setCompilationDir(CompilationDir);
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
533 }
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
534
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
535 /// Saves the information from the currently parsed dwarf .loc directive
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
536 /// and sets DwarfLocSeen. When the next instruction is assembled an entry
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
537 /// in the line number table with this information and the address of the
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
538 /// instruction will be created.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
539 void setCurrentDwarfLoc(unsigned FileNum, unsigned Line, unsigned Column,
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
540 unsigned Flags, unsigned Isa,
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
541 unsigned Discriminator) {
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
542 CurrentDwarfLoc.setFileNum(FileNum);
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
543 CurrentDwarfLoc.setLine(Line);
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
544 CurrentDwarfLoc.setColumn(Column);
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
545 CurrentDwarfLoc.setFlags(Flags);
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
546 CurrentDwarfLoc.setIsa(Isa);
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
547 CurrentDwarfLoc.setDiscriminator(Discriminator);
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
548 DwarfLocSeen = true;
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
549 }
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
550
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
551 void clearDwarfLocSeen() { DwarfLocSeen = false; }
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
552
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
553 bool getDwarfLocSeen() { return DwarfLocSeen; }
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
554 const MCDwarfLoc &getCurrentDwarfLoc() { return CurrentDwarfLoc; }
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
555
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
556 bool getGenDwarfForAssembly() { return GenDwarfForAssembly; }
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
557 void setGenDwarfForAssembly(bool Value) { GenDwarfForAssembly = Value; }
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
558 unsigned getGenDwarfFileNumber() { return GenDwarfFileNumber; }
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
559
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
560 void setGenDwarfFileNumber(unsigned FileNumber) {
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
561 GenDwarfFileNumber = FileNumber;
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
562 }
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
563
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
564 const SetVector<MCSection *> &getGenDwarfSectionSyms() {
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
565 return SectionsForRanges;
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
566 }
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
567
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
568 bool addGenDwarfSection(MCSection *Sec) {
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
569 return SectionsForRanges.insert(Sec);
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
570 }
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
571
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
572 void finalizeDwarfSections(MCStreamer &MCOS);
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
573
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
574 const std::vector<MCGenDwarfLabelEntry> &getMCGenDwarfLabelEntries() const {
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
575 return MCGenDwarfLabelEntries;
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
576 }
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
577
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
578 void addMCGenDwarfLabelEntry(const MCGenDwarfLabelEntry &E) {
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
579 MCGenDwarfLabelEntries.push_back(E);
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
580 }
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
581
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
582 void setDwarfDebugFlags(StringRef S) { DwarfDebugFlags = S; }
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
583 StringRef getDwarfDebugFlags() { return DwarfDebugFlags; }
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
584
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
585 void setDwarfDebugProducer(StringRef S) { DwarfDebugProducer = S; }
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
586 StringRef getDwarfDebugProducer() { return DwarfDebugProducer; }
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
587
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
588 dwarf::DwarfFormat getDwarfFormat() const {
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
589 // TODO: Support DWARF64
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
590 return dwarf::DWARF32;
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
591 }
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
592
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
593 void setDwarfVersion(uint16_t v) { DwarfVersion = v; }
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
594 uint16_t getDwarfVersion() const { return DwarfVersion; }
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
595
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
596 /// @}
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
597
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
598 char *getSecureLogFile() { return SecureLogFile; }
100
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
599 raw_fd_ostream *getSecureLog() { return SecureLog.get(); }
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
600
100
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
601 void setSecureLog(std::unique_ptr<raw_fd_ostream> Value) {
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
602 SecureLog = std::move(Value);
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
603 }
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
604
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
605 bool getSecureLogUsed() { return SecureLogUsed; }
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
606 void setSecureLogUsed(bool Value) { SecureLogUsed = Value; }
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
607
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
608 void *allocate(unsigned Size, unsigned Align = 8) {
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
609 return Allocator.Allocate(Size, Align);
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
610 }
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
611
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
612 void deallocate(void *Ptr) {}
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
613
100
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
614 bool hadError() { return HadError; }
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
615 void reportError(SMLoc L, const Twine &Msg);
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
616 // Unrecoverable error has occurred. Display the best diagnostic we can
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
617 // and bail via exit(1). For now, most MC backend errors are unrecoverable.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
618 // FIXME: We should really do something about that.
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
619 LLVM_ATTRIBUTE_NORETURN void reportFatalError(SMLoc L,
100
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
620 const Twine &Msg);
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
621 };
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
622
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
623 } // end namespace llvm
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
624
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
625 // operator new and delete aren't allowed inside namespaces.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
626 // The throw specifications are mandated by the standard.
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
627 /// \brief Placement new for using the MCContext's allocator.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
628 ///
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
629 /// This placement form of operator new uses the MCContext's allocator for
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
630 /// obtaining memory. It is a non-throwing new, which means that it returns
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
631 /// null on error. (If that is what the allocator does. The current does, so if
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
632 /// this ever changes, this operator will have to be changed, too.)
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
633 /// Usage looks like this (assuming there's an MCContext 'Context' in scope):
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
634 /// \code
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
635 /// // Default alignment (8)
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
636 /// IntegerLiteral *Ex = new (Context) IntegerLiteral(arguments);
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
637 /// // Specific alignment
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
638 /// IntegerLiteral *Ex2 = new (Context, 4) IntegerLiteral(arguments);
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
639 /// \endcode
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
640 /// Please note that you cannot use delete on the pointer; it must be
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
641 /// deallocated using an explicit destructor call followed by
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
642 /// \c Context.Deallocate(Ptr).
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
643 ///
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
644 /// \param Bytes The number of bytes to allocate. Calculated by the compiler.
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
645 /// \param C The MCContext that provides the allocator.
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
646 /// \param Alignment The alignment of the allocated memory (if the underlying
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
647 /// allocator supports it).
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
648 /// \return The allocated memory. Could be NULL.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
649 inline void *operator new(size_t Bytes, llvm::MCContext &C,
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
650 size_t Alignment = 8) noexcept {
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
651 return C.allocate(Bytes, Alignment);
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
652 }
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
653 /// \brief Placement delete companion to the new above.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
654 ///
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
655 /// This operator is just a companion to the new above. There is no way of
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
656 /// invoking it directly; see the new operator for more details. This operator
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
657 /// is called implicitly by the compiler if a placement new expression using
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
658 /// the MCContext throws in the object constructor.
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
659 inline void operator delete(void *Ptr, llvm::MCContext &C, size_t) noexcept {
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
660 C.deallocate(Ptr);
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
661 }
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
662
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
663 /// This placement form of operator new[] uses the MCContext's allocator for
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
664 /// obtaining memory. It is a non-throwing new[], which means that it returns
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
665 /// null on error.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
666 /// Usage looks like this (assuming there's an MCContext 'Context' in scope):
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
667 /// \code
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
668 /// // Default alignment (8)
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
669 /// char *data = new (Context) char[10];
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
670 /// // Specific alignment
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
671 /// char *data = new (Context, 4) char[10];
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
672 /// \endcode
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
673 /// Please note that you cannot use delete on the pointer; it must be
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
674 /// deallocated using an explicit destructor call followed by
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
675 /// \c Context.Deallocate(Ptr).
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
676 ///
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
677 /// \param Bytes The number of bytes to allocate. Calculated by the compiler.
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
678 /// \param C The MCContext that provides the allocator.
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
679 /// \param Alignment The alignment of the allocated memory (if the underlying
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
680 /// allocator supports it).
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
681 /// \return The allocated memory. Could be NULL.
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
682 inline void *operator new[](size_t Bytes, llvm::MCContext &C,
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
683 size_t Alignment = 8) noexcept {
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
684 return C.allocate(Bytes, Alignment);
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
685 }
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
686
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
687 /// \brief Placement delete[] companion to the new[] above.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
688 ///
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
689 /// This operator is just a companion to the new[] above. There is no way of
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
690 /// invoking it directly; see the new[] operator for more details. This operator
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
691 /// is called implicitly by the compiler if a placement new[] expression using
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
692 /// the MCContext throws in the object constructor.
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
693 inline void operator delete[](void *Ptr, llvm::MCContext &C) noexcept {
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
694 C.deallocate(Ptr);
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
695 }
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
696
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
697 #endif // LLVM_MC_MCCONTEXT_H