LLVM: lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
24
25using namespace llvm;
26
27
35 MAB.getTargetOptions().getABIName()));
37}
38
40 std::unique_ptr MAB,
41 std::unique_ptr MOW,
42 std::unique_ptr MCE)
44
48
59
60void RISCVTargetELFStreamer::emitAttribute(unsigned Attribute, unsigned Value) {
62}
63
64void RISCVTargetELFStreamer::emitTextAttribute(unsigned Attribute,
67}
68
69void RISCVTargetELFStreamer::emitIntTextAttribute(unsigned Attribute,
70 unsigned IntValue,
73 true);
74}
75
79 return;
80
83}
84
89
90 unsigned EFlags = W.getELFHeaderEFlags();
91
96
97 switch (ABI) {
100 break;
104 break;
108 break;
112 break;
115 }
116
117 W.setELFHeaderEFlags(EFlags);
118}
119
121 AttributeSection = nullptr;
122}
123
128
132 LastMappingSymbols.clear();
133 LastEMS = EMS_None;
134}
135
136void RISCVELFStreamer::emitDataMappingSymbol() {
137 if (LastEMS == EMS_Data)
138 return;
139 emitMappingSymbol("$d");
140 LastEMS = EMS_Data;
141}
142
143void RISCVELFStreamer::emitInstructionsMappingSymbol() {
144 if (LastEMS == EMS_Instructions)
145 return;
146 emitMappingSymbol("$x");
147 LastEMS = EMS_Instructions;
148}
149
150void RISCVELFStreamer::emitMappingSymbol(StringRef Name) {
156}
157
159
160
161
163 LastEMS = LastMappingSymbols.lookup(Section);
164
166}
167
170 emitInstructionsMappingSymbol();
172}
173
175 emitDataMappingSymbol();
177}
178
181 emitDataMappingSymbol();
183}
184
187 emitDataMappingSymbol();
189}
190
192 std::unique_ptr &&MAB,
193 std::unique_ptr &&MOW,
194 std::unique_ptr &&MCE) {
196 std::move(MCE));
197}
Functions, function parameters, and return types can have attributes to indicate how they should be t...
Container class for subtarget features.
MCAsmBackend & getBackend() const
LLVM_ABI bool registerSymbol(const MCSymbol &Symbol)
Context object for machine code objects.
LLVM_ABI MCSymbol * createLocalSymbol(StringRef Name)
Create a local, non-temporary symbol like an ELF mapping symbol.
SmallVector< AttributeItem, 64 > Contents
void emitAttributesSection(StringRef Vendor, const Twine &Section, unsigned Type, MCSection *&AttributeSection)
void changeSection(MCSection *Section, uint32_t Subsection=0) override
This is called by popSection and switchSection, if the current section changes.
void setAttributeItems(unsigned Attribute, unsigned IntValue, StringRef StringValue, bool OverwriteExisting)
ELFObjectWriter & getWriter()
void setAttributeItem(unsigned Attribute, unsigned Value, bool OverwriteExisting)
void reset() override
state management
void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc()) override
Emit a label for Symbol into the current section.
MCELFStreamer(MCContext &Context, std::unique_ptr< MCAsmBackend > TAB, std::unique_ptr< MCObjectWriter > OW, std::unique_ptr< MCCodeEmitter > Emitter)
Base class for the full range of assembler expressions which are needed for parsing.
Instances of this class represent a single low-level machine instruction.
void emitFill(const MCExpr &NumBytes, uint64_t FillValue, SMLoc Loc=SMLoc()) override
Emit Size bytes worth of the value specified by FillValue.
MCAssembler & getAssembler()
void emitBytes(StringRef Data) override
Emit the bytes in Data into the output.
void emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) override
Emit the given Instruction into the current section.
void emitValueImpl(const MCExpr *Value, unsigned Size, SMLoc Loc=SMLoc()) override
Emit the expression Value into the output as a native integer of the given Size bytes.
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Streaming machine code generation interface.
MCSectionSubPair getPreviousSection() const
Return the previous section that the streamer is emitting code to.
MCContext & getContext() const
MCTargetStreamer * getTargetStreamer()
Generic base class for all target subtargets.
const Triple & getTargetTriple() const
const FeatureBitset & getFeatureBits() const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
void changeSection(MCSection *Section, uint32_t Subsection) override
This is called by popSection and switchSection, if the current section changes.
Definition RISCVELFStreamer.cpp:158
void emitBytes(StringRef Data) override
Emit the bytes in Data into the output.
Definition RISCVELFStreamer.cpp:174
RISCVELFStreamer(MCContext &C, std::unique_ptr< MCAsmBackend > MAB, std::unique_ptr< MCObjectWriter > MOW, std::unique_ptr< MCCodeEmitter > MCE)
Definition RISCVELFStreamer.cpp:39
void emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) override
Emit the given Instruction into the current section.
Definition RISCVELFStreamer.cpp:168
void emitFill(const MCExpr &NumBytes, uint64_t FillValue, SMLoc Loc) override
Emit Size bytes worth of the value specified by FillValue.
Definition RISCVELFStreamer.cpp:179
void emitValueImpl(const MCExpr *Value, unsigned Size, SMLoc Loc) override
Emit the expression Value into the output as a native integer of the given Size bytes.
Definition RISCVELFStreamer.cpp:185
void emitDirectiveOptionExact() override
Definition RISCVELFStreamer.cpp:49
void emitDirectiveOptionPop() override
Definition RISCVELFStreamer.cpp:53
void emitDirectiveOptionPush() override
Definition RISCVELFStreamer.cpp:54
void emitDirectiveOptionNoPIC() override
Definition RISCVELFStreamer.cpp:52
void emitDirectiveOptionNoRVC() override
Definition RISCVELFStreamer.cpp:58
void emitDirectiveOptionNoExact() override
Definition RISCVELFStreamer.cpp:50
RISCVTargetELFStreamer(MCStreamer &S, const MCSubtargetInfo &STI)
Definition RISCVELFStreamer.cpp:28
void emitDirectiveVariantCC(MCSymbol &Symbol) override
Definition RISCVELFStreamer.cpp:124
void emitDirectiveOptionRelax() override
Definition RISCVELFStreamer.cpp:55
RISCVELFStreamer & getStreamer()
Definition RISCVELFStreamer.cpp:45
void emitDirectiveOptionNoRelax() override
Definition RISCVELFStreamer.cpp:56
void finish() override
Definition RISCVELFStreamer.cpp:85
void emitDirectiveOptionPIC() override
Definition RISCVELFStreamer.cpp:51
void emitDirectiveOptionRVC() override
Definition RISCVELFStreamer.cpp:57
RISCVABI::ABI getTargetABI() const
void setFlagsFromFeatures(const MCSubtargetInfo &STI)
void setTargetABI(RISCVABI::ABI ABI)
RISCVTargetStreamer(MCStreamer &S)
virtual void finishAttributeSection()
Represents a location in source code.
StringRef - Represent a constant reference to a string, i.e.
Triple - Helper class for working with autoconf configuration names.
LLVM Value Representation.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
@ EF_RISCV_FLOAT_ABI_SINGLE
@ EF_RISCV_FLOAT_ABI_DOUBLE
ABI computeTargetABI(const Triple &TT, const FeatureBitset &FeatureBits, StringRef ABIName)
This is an optimization pass for GlobalISel generic memory operations.
MCStreamer * createRISCVELFStreamer(const Triple &, MCContext &C, std::unique_ptr< MCAsmBackend > &&MAB, std::unique_ptr< MCObjectWriter > &&MOW, std::unique_ptr< MCCodeEmitter > &&MCE)
Definition RISCVELFStreamer.cpp:191
FunctionAddr VTableAddr uintptr_t uintptr_t Data
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Implement std::hash so that hash_code can be used in STL containers.