comparison lib/MC/MCSectionWasm.cpp @ 147:c2174574ed3a

LLVM 10
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Wed, 14 Aug 2019 16:55:33 +0900
parents 3a76565eade5
children
comparison
equal deleted inserted replaced
134:3a76565eade5 147:c2174574ed3a
1 //===- lib/MC/MCSectionWasm.cpp - Wasm Code Section Representation --------===// 1 //===- lib/MC/MCSectionWasm.cpp - Wasm Code Section Representation --------===//
2 // 2 //
3 // The LLVM Compiler Infrastructure 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // 4 // See https://llvm.org/LICENSE.txt for license information.
5 // This file is distributed under the University of Illinois Open Source 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 // License. See LICENSE.TXT for details.
7 // 6 //
8 //===----------------------------------------------------------------------===// 7 //===----------------------------------------------------------------------===//
9 8
10 #include "llvm/MC/MCSectionWasm.h" 9 #include "llvm/MC/MCSectionWasm.h"
11 #include "llvm/MC/MCAsmInfo.h" 10 #include "llvm/MC/MCAsmInfo.h"
13 #include "llvm/MC/MCSymbol.h" 12 #include "llvm/MC/MCSymbol.h"
14 #include "llvm/Support/raw_ostream.h" 13 #include "llvm/Support/raw_ostream.h"
15 14
16 using namespace llvm; 15 using namespace llvm;
17 16
18 MCSectionWasm::~MCSectionWasm() {} // anchor.
19
20 // Decides whether a '.section' directive 17 // Decides whether a '.section' directive
21 // should be printed before the section name. 18 // should be printed before the section name.
22 bool MCSectionWasm::ShouldOmitSectionDirective(StringRef Name, 19 bool MCSectionWasm::shouldOmitSectionDirective(StringRef Name,
23 const MCAsmInfo &MAI) const { 20 const MCAsmInfo &MAI) const {
24 return MAI.shouldOmitSectionDirective(Name); 21 return MAI.shouldOmitSectionDirective(Name);
25 } 22 }
26 23
27 static void printName(raw_ostream &OS, StringRef Name) { 24 static void printName(raw_ostream &OS, StringRef Name) {
49 46
50 void MCSectionWasm::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T, 47 void MCSectionWasm::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
51 raw_ostream &OS, 48 raw_ostream &OS,
52 const MCExpr *Subsection) const { 49 const MCExpr *Subsection) const {
53 50
54 if (ShouldOmitSectionDirective(SectionName, MAI)) { 51 if (shouldOmitSectionDirective(SectionName, MAI)) {
55 OS << '\t' << getSectionName(); 52 OS << '\t' << getSectionName();
56 if (Subsection) { 53 if (Subsection) {
57 OS << '\t'; 54 OS << '\t';
58 Subsection->print(OS, &MAI); 55 Subsection->print(OS, &MAI);
59 } 56 }
63 60
64 OS << "\t.section\t"; 61 OS << "\t.section\t";
65 printName(OS, getSectionName()); 62 printName(OS, getSectionName());
66 OS << ",\""; 63 OS << ",\"";
67 64
68 // TODO: Print section flags. 65 if (IsPassive)
66 OS << "passive";
69 67
70 OS << '"'; 68 OS << '"';
71 69
72 OS << ','; 70 OS << ',';
73 71