LLVM 22.0.0git
MCGOFFStreamer.cpp
Go to the documentation of this file.
1//===- lib/MC/MCGOFFStreamer.cpp - GOFF Object Output ---------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file assembles .s files and emits GOFF .o object files.
10//
11//===----------------------------------------------------------------------===//
12
16#include "llvm/MC/MCAssembler.h"
18#include "llvm/MC/MCContext.h"
24
25using namespace llvm;
26
28 std::unique_ptr<MCAsmBackend> MAB,
29 std::unique_ptr<MCObjectWriter> OW,
30 std::unique_ptr<MCCodeEmitter> Emitter)
31 : MCObjectStreamer(Context, std::move(MAB), std::move(OW),
32 std::move(Emitter)) {}
33
35
37 getWriter().setRootSD(static_cast<MCSectionGOFF *>(
38 getContext().getObjectFileInfo()->getTextSection())
39 ->getParent());
41}
42
46
48 // Make sure that all section are registered in the correct order.
50 for (auto *S = static_cast<MCSectionGOFF *>(Section); S; S = S->getParent())
51 Sections.push_back(S);
52 while (!Sections.empty()) {
53 auto *S = Sections.pop_back_val();
54 MCObjectStreamer::changeSection(S, Sections.empty() ? Subsection : 0);
55 }
56}
57
60 return static_cast<MCSymbolGOFF *>(Sym)->setSymbolAttribute(Attribute);
61}
62
64 std::unique_ptr<MCAsmBackend> &&MAB,
65 std::unique_ptr<MCObjectWriter> &&OW,
66 std::unique_ptr<MCCodeEmitter> &&CE) {
68 new MCGOFFStreamer(Context, std::move(MAB), std::move(OW), std::move(CE));
69 return S;
70}
static const Function * getParent(const Value *V)
dxil DXContainer Global Emitter
This file contains the MCSymbolGOFF class.
Functions, function parameters, and return types can have attributes to indicate how they should be t...
Definition Attributes.h:69
void setRootSD(MCSectionGOFF *RootSD)
MCObjectWriter & getWriter() const
Context object for machine code objects.
Definition MCContext.h:83
void changeSection(MCSection *Section, uint32_t Subsection=0) override
This is called by popSection and switchSection, if the current section changes.
bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override
Add the given Attribute to Symbol.
void finishImpl() override
Streamer specific finalization.
MCGOFFStreamer(MCContext &Context, std::unique_ptr< MCAsmBackend > MAB, std::unique_ptr< MCObjectWriter > OW, std::unique_ptr< MCCodeEmitter > Emitter)
~MCGOFFStreamer() override
GOFFObjectWriter & getWriter()
MCAssembler & getAssembler()
MCObjectStreamer(MCContext &Context, std::unique_ptr< MCAsmBackend > TAB, std::unique_ptr< MCObjectWriter > OW, std::unique_ptr< MCCodeEmitter > Emitter)
void finishImpl() override
Streamer specific finalization.
void changeSection(MCSection *Section, uint32_t Subsection=0) override
This is called by popSection and switchSection, if the current section changes.
MCSectionGOFF * getParent() const
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition MCSection.h:517
Streaming machine code generation interface.
Definition MCStreamer.h:220
MCContext & getContext() const
Definition MCStreamer.h:314
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition MCSymbol.h:42
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
This is an optimization pass for GlobalISel generic memory operations.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition STLExtras.h:1915
LLVM_ABI MCStreamer * createGOFFStreamer(MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&CE)
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:870