LLVM: lib/MC/MCAsmInfoELF.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
24#include
25
26using namespace llvm;
27
28void MCAsmInfoELF::anchor() {}
29
30MCSection *MCAsmInfoELF::getStackSection(MCContext &Ctx, bool Exec) const {
31
32
34 return nullptr;
37}
38
39bool MCAsmInfoELF::useCodeAlign(const MCSection &Sec) const {
41}
42
49
51 if (Name.find_first_not_of("0123456789_."
52 "abcdefghijklmnopqrstuvwxyz"
53 "ABCDEFGHIJKLMNOPQRSTUVWXYZ") == Name.npos) {
54 OS << Name;
55 return;
56 }
57 OS << '"';
58 for (const char *B = Name.begin(), *E = Name.end(); B < E; ++B) {
59 if (*B == '"')
60 OS << "\\\"";
61 else if (*B != '\\')
62 OS << *B;
64 OS << "\\\\";
65 else {
67 ++B;
68 }
69 }
70 OS << '"';
71}
72
73void MCAsmInfoELF::printSwitchToSection(const MCSection &Section,
74 uint32_t Subsection, const Triple &T,
76 auto &Sec = static_cast<const MCSectionELF &>(Section);
78 OS << '\t' << Sec.getName();
79 if (Subsection)
80 OS << '\t' << Subsection;
81 OS << '\n';
82 return;
83 }
84
85 OS << "\t.section\t";
87
88
91 OS << ",#alloc";
93 OS << ",#execinstr";
95 OS << ",#write";
97 OS << ",#exclude";
99 OS << ",#tls";
100 OS << '\n';
101 return;
102 }
103
104 OS << ",\"";
106 OS << 'a';
108 OS << 'e';
110 OS << 'x';
112 OS << 'w';
114 OS << 'M';
116 OS << 'S';
118 OS << 'T';
120 OS << 'o';
122 OS << 'G';
124 OS << 'R';
125
126
127 if (T.isOSSolaris())
129 OS << 'R';
130
131
135 OS << 'c';
137 OS << 'd';
138 } else if (T.isARM() || T.isThumb()) {
140 OS << 'y';
141 } else if (T.isAArch64()) {
143 OS << 'y';
146 OS << 's';
149 OS << 'l';
150 }
151
152 OS << '"';
153
154 OS << ',';
155
156
158 OS << '%';
159 else
160 OS << '@';
161
163 OS << "init_array";
165 OS << "fini_array";
167 OS << "preinit_array";
169 OS << "nobits";
171 OS << "note";
173 OS << "progbits";
175 OS << "unwind";
177
178
179 OS << "0x7000001e";
181 OS << "llvm_odrtab";
183 OS << "llvm_linker_options";
185 OS << "llvm_call_graph_profile";
187 OS << "llvm_dependent_libraries";
189 OS << "llvm_sympart";
191 OS << "llvm_bb_addr_map";
193 OS << "llvm_offloading";
195 OS << "llvm_lto";
197 OS << "llvm_jt_sizes";
199 OS << "llvm_cfi_jump_table";
201 OS << "llvm_call_graph";
202 else
204
205 if (Sec.EntrySize) {
208 OS << "," << Sec.EntrySize;
209 }
210
212 OS << ",";
213 if (Sec.LinkedToSym)
215 else
216 OS << '0';
217 }
218
220 OS << ",";
222 if (Sec.isComdat())
223 OS << ",comdat";
224 }
225
226 if (Sec.isUnique())
227 OS << ",unique," << Sec.UniqueID;
228
229 OS << '\n';
230
231 if (Subsection) {
232 OS << "\t.subsection\t" << Subsection;
233 OS << '\n';
234 }
235}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static void printName(raw_ostream &OS, StringRef Name)
Definition MCAsmInfoELF.cpp:50
static uint32_t getFlags(const Symbol *Sym)
MCAsmInfoELF()
Definition MCAsmInfoELF.cpp:43
bool usesSunStyleELFSectionSwitchSyntax() const
StringRef PrivateGlobalPrefix
This prefix is used for globals like constant pool entries that are completely private to the ....
const char * WeakRefDirective
This directive, if non-null, is used to declare a global as being a weak undefined symbol.
StringRef PrivateLabelPrefix
This prefix is used for labels for basic blocks.
StringRef getCommentString() const
virtual bool shouldOmitSectionDirective(StringRef SectionName) const
Return true if the .section directive should be omitted when emitting SectionName.
bool HasIdentDirective
True if the target has a .ident directive, this is true for ELF targets.
Context object for machine code objects.
MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags)
const Triple & getTargetTriple() const
Instances of this class represent a uniqued identifier for a section in the current translation unit.
StringRef getName() const
StringRef - Represent a constant reference to a string, i.e.
Triple - Helper class for working with autoconf configuration names.
static Twine utohexstr(uint64_t Val)
This class implements an extremely fast bulk output stream that can only output to a stream.
@ XCORE_SHF_DP_SECTION
All sections with the "d" flag are grouped together by the linker to form the data section and the dp...
@ XCORE_SHF_CP_SECTION
All sections with the "c" flag are grouped together by the linker to form the constant pool and the c...
@ SHT_LLVM_DEPENDENT_LIBRARIES
@ SHT_LLVM_LINKER_OPTIONS
@ SHT_LLVM_CALL_GRAPH_PROFILE
@ SHT_LLVM_CFI_JUMP_TABLE
This is an optimization pass for GlobalISel generic memory operations.