llvm.org GIT mirror llvm / 1ef9be2
Make SectionKind::get() private. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77835 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 10 years ago
6 changed file(s) with 25 addition(s) and 24 deletion(s). Raw diff Collapse all Expand all
169169 bool isReadOnlyWithRelLocal() const {
170170 return K == ReadOnlyWithRelLocal;
171171 }
172
172 private:
173173 static SectionKind get(Kind K) {
174174 SectionKind Res;
175175 Res.K = K;
176176 return Res;
177177 }
178 public:
178179
179180 static SectionKind getMetadata() { return get(Metadata); }
180181 static SectionKind getText() { return get(Text); }
3636 void Initialize(MCContext &Ctx, const TargetMachine &TM) {
3737 TargetLoweringObjectFile::Initialize(Ctx, TM);
3838 TextSection = getOrCreateSection("_text", true,
39 SectionKind::get(SectionKind::Text));
39 SectionKind::getText());
4040 DataSection = getOrCreateSection("_data", true,
41 SectionKind::get(SectionKind::DataRel));
41 SectionKind::getDataRel());
4242 ReadOnlySection = getOrCreateSection("_rodata", true,
43 SectionKind::get(SectionKind::ReadOnly));
43 SectionKind::getReadOnly());
4444 }
4545 };
4646 }
7272
7373 const MCSection *fCodeSection =
7474 getObjFileLowering().getOrCreateSection(codeSection, false,
75 SectionKind::get(SectionKind::Text));
75 SectionKind::getText());
7676 // Start the Code Section.
7777 O << "\n";
7878 SwitchToSection(fCodeSection);
349349
350350 const MCSection *fPDataSection =
351351 getObjFileLowering().getOrCreateSection(SectionName, false,
352 SectionKind::get(SectionKind::DataRel));
352 SectionKind::getDataRel());
353353 SwitchToSection(fPDataSection);
354354
355355 // Emit function frame label
1919 TM = &tm;
2020
2121 BSSSection = getOrCreateSection("udata.# UDATA", false,
22 SectionKind::get(SectionKind::BSS));
22 SectionKind::getBSS());
2323 ReadOnlySection = getOrCreateSection("romdata.# ROMDATA", false,
24 SectionKind::get(SectionKind::ReadOnly));
24 SectionKind::getReadOnly());
2525 DataSection = getOrCreateSection("idata.# IDATA", false,
26 SectionKind::get(SectionKind::DataRel));
26 SectionKind::getDataRel());
2727
2828 // Need because otherwise a .text symbol is emitted by DwarfWriter
2929 // in BeginModule, and gpasm cribbs for that .text symbol.
3030 TextSection = getOrCreateSection("", true,
31 SectionKind::get(SectionKind::Text));
31 SectionKind::getText());
3232
3333 ROSections.push_back(new PIC16Section(ReadOnlySection));
3434
3535 // FIXME: I don't know what the classification of these sections really is.
3636 ExternalVarDecls = new PIC16Section(getOrCreateSection("ExternalVarDecls",
3737 false,
38 SectionKind::get(SectionKind::Metadata)));
38 SectionKind::getMetadata()));
3939 ExternalVarDefs = new PIC16Section(getOrCreateSection("ExternalVarDefs",
4040 false,
41 SectionKind::get(SectionKind::Metadata)));
41 SectionKind::getMetadata()));
4242 }
4343
4444
6868 std::string name = PAN::getUdataSectionName(BSSSections.size());
6969 const MCSection *NewSection = getOrCreateSection(name.c_str(), false,
7070 // FIXME.
71 SectionKind::get(SectionKind::Metadata));
71 SectionKind::getMetadata());
7272
7373 FoundBSS = new PIC16Section(NewSection);
7474
110110 std::string name = PAN::getIdataSectionName(IDATASections.size());
111111 const MCSection *NewSection = getOrCreateSection(name.c_str(), false,
112112 // FIXME.
113 SectionKind::get(SectionKind::Metadata));
113 SectionKind::getMetadata());
114114
115115 FoundIDATA = new PIC16Section(NewSection);
116116
146146 const MCSection *NewSection = getOrCreateSection(name.c_str(),
147147 // FIXME.
148148 false,
149 SectionKind::get(SectionKind::Metadata));
149 SectionKind::getMetadata());
150150
151151 FoundAutoSec = new PIC16Section(NewSection);
152152
299299 PIC16Section *NewBSS = FoundBSS;
300300 if (NewBSS == NULL) {
301301 const MCSection *NewSection = getOrCreateSection(Name.c_str(), false,
302 SectionKind::get(SectionKind::BSS));
302 SectionKind::getBSS());
303303 NewBSS = new PIC16Section(NewSection);
304304 BSSSections.push_back(NewBSS);
305305 }
352352 if (NewIDATASec == NULL) {
353353 const MCSection *NewSection = getOrCreateSection(Name.c_str(), false,
354354 // FIXME:
355 SectionKind::get(SectionKind::Metadata));
355 SectionKind::getMetadata());
356356 NewIDATASec = new PIC16Section(NewSection);
357357 IDATASections.push_back(NewIDATASec);
358358 }
391391 PIC16Section *NewRomSec = FoundROSec;
392392 if (NewRomSec == NULL) {
393393 const MCSection *NewSection = getOrCreateSection(Name.c_str(), false,
394 SectionKind::get(SectionKind::ReadOnly));
394 SectionKind::getReadOnly());
395395 NewRomSec = new PIC16Section(NewSection);
396396 ROSections.push_back(NewRomSec);
397397 }
1616 TargetLoweringObjectFileELF::Initialize(Ctx, TM);
1717
1818 TextSection = getOrCreateSection("\t.text", true,
19 SectionKind::get(SectionKind::Text));
19 SectionKind::getText());
2020 DataSection = getOrCreateSection("\t.dp.data", false,
21 SectionKind::get(SectionKind::DataRel));
21 SectionKind::getDataRel());
2222 BSSSection = getOrCreateSection("\t.dp.bss", false,
23 SectionKind::get(SectionKind::BSS));
23 SectionKind::getBSS());
2424
2525 // TLS globals are lowered in the backend to arrays indexed by the current
2626 // thread id. After lowering they require no special handling by the linker
3131 if (TM.getSubtarget().isXS1A())
3232 // FIXME: Why is this writable ("datarel")???
3333 ReadOnlySection = getOrCreateSection("\t.dp.rodata", false,
34 SectionKind::get(SectionKind::DataRel));
34 SectionKind::getDataRel());
3535 else
3636 ReadOnlySection = getOrCreateSection("\t.cp.rodata", false,
37 SectionKind::get(SectionKind::ReadOnly));
37 SectionKind::getReadOnly());
3838 }
192192 Str.get()->SwitchSection(MCSection::Create("__TEXT,__text,"
193193 "regular,pure_instructions",
194194 false,
195 SectionKind::get(SectionKind::Text),
195 SectionKind::getText(),
196196 Ctx));
197197
198198 AsmParser Parser(SrcMgr, Ctx, *Str.get());