39 MAB.getTargetOptions().getABIName()));
55void RISCVTargetELFStreamer::emitAttribute(
unsigned Attribute,
unsigned Value) {
59void RISCVTargetELFStreamer::emitTextAttribute(
unsigned Attribute,
64void RISCVTargetELFStreamer::emitIntTextAttribute(
unsigned Attribute,
67 setAttributeItems(
Attribute, IntValue, StringValue,
71void RISCVTargetELFStreamer::finishAttributeSection() {
75 if (AttributeSection) {
87 const size_t VendorHeaderSize = 4 + CurrentVendor.
size() + 1;
90 const size_t TagHeaderSize = 1 + 4;
92 const size_t ContentsSize = calculateContentSize();
103 for (AttributeItem item : Contents) {
108 case AttributeType::Numeric:
111 case AttributeType::Text:
115 case AttributeType::NumericAndText:
126size_t RISCVTargetELFStreamer::calculateContentSize()
const {
128 for (AttributeItem item : Contents) {
130 case AttributeType::Hidden:
132 case AttributeType::Numeric:
136 case AttributeType::Text:
138 Result += item.StringValue.size() + 1;
140 case AttributeType::NumericAndText:
143 Result += item.StringValue.size() + 1;
158 if (Features[RISCV::FeatureStdExtC])
160 if (Features[RISCV::FeatureStdExtZtso])
185void RISCVTargetELFStreamer::reset() {
186 AttributeSection =
nullptr;
197 const auto *MBE = dyn_cast<MCBinaryExpr>(
Value);
202 if (!
Value->evaluateAsRelocatable(
E,
nullptr,
nullptr))
204 if (
E.getSymA() ==
nullptr ||
E.getSymB() ==
nullptr)
207 const auto &
A =
E.getSymA()->getSymbol();
208 const auto &
B =
E.getSymB()->getSymbol();
221 if (
A.isInSection() &&
A.getSection().getKind().isText())
223 if (
B.isInSection() &&
B.getSection().getKind().isText())
227 return A.isInSection() &&
B.isInSection() &&
228 A.getSection().getName() !=
B.getSection().getName();
231void RISCVELFStreamer::reset() {
239 if (!requiresFixups(getContext(),
Value,
A,
B))
245 flushPendingLabels(
DF,
DF->getContents().size());
251 DF->getFixups().push_back(
253 DF->getFixups().push_back(
256 DF->getContents().resize(
DF->getContents().size() +
Size, 0);
261 std::unique_ptr<MCAsmBackend> MAB,
262 std::unique_ptr<MCObjectWriter> MOW,
263 std::unique_ptr<MCCodeEmitter> MCE,
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static RegisterPass< DebugifyFunctionPass > DF("debugify-function", "Attach debug info to a function")
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.
Container class for subtarget features.
MCContext & getContext() const
void registerSymbol(const MCSymbol &Symbol, bool *Created=nullptr)
unsigned getELFHeaderEFlags() const
ELF e_header flags.
MCAsmBackend & getBackend() const
void setELFHeaderEFlags(unsigned Flags)
void setRelaxAll(bool Value)
static const MCBinaryExpr * create(Opcode Op, const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx, SMLoc Loc=SMLoc())
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false, unsigned SizeInBytes=0)
Context object for machine code objects.
MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags)
Fragment for data and encoded instructions.
static void make(MCStreamer *MCOS, MCSection *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.
void reset() override
state management
Base class for the full range of assembler expressions which are needed for parsing.
static MCFixup create(uint32_t Offset, const MCExpr *Value, MCFixupKind Kind, SMLoc Loc=SMLoc())
MCAssembler & getAssembler()
Streaming machine code generation interface.
unsigned emitULEB128IntValue(uint64_t Value, unsigned PadTo=0)
Special case of EmitULEB128Value that avoids the client having to pass in a MCExpr for constant integ...
virtual void switchSection(MCSection *Section, const MCExpr *Subsection=nullptr)
Set the current section where code is being emitted to Section.
void emitInt32(uint64_t Value)
virtual void emitValueImpl(const MCExpr *Value, unsigned Size, SMLoc Loc=SMLoc())
Emit the expression Value into the output as a native integer of the given Size bytes.
void emitInt8(uint64_t Value)
virtual void emitBytes(StringRef Data)
Emit the bytes in Data into the output.
Generic base class for all target subtargets.
const Triple & getTargetTriple() const
const FeatureBitset & getFeatureBits() const
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
This represents an "assembler immediate".
void emitDirectiveOptionPop() override
void emitDirectiveOptionPush() override
void emitDirectiveOptionNoPIC() override
void emitDirectiveOptionNoRVC() override
RISCVTargetELFStreamer(MCStreamer &S, const MCSubtargetInfo &STI)
void emitDirectiveVariantCC(MCSymbol &Symbol) override
void emitDirectiveOptionRelax() override
RISCVELFStreamer & getStreamer()
void emitDirectiveOptionNoRelax() override
void emitDirectiveOptionPIC() override
void emitDirectiveOptionRVC() override
RISCVABI::ABI getTargetABI() const
void setTargetABI(RISCVABI::ABI ABI)
Represents a location in source code.
StringRef - Represent a constant reference to a string, i.e.
constexpr size_t size() const
size - Get the string size.
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, FeatureBitset FeatureBits, StringRef ABIName)
static std::pair< MCFixupKind, MCFixupKind > getRelocPairForSize(unsigned Size)
This is an optimization pass for GlobalISel generic memory operations.
MCFixupKind
Extensible enumeration to represent the type of a fixup.
unsigned getULEB128Size(uint64_t Value)
Utility function to get the size of the ULEB128-encoded value.
MCELFStreamer * createRISCVELFStreamer(MCContext &C, std::unique_ptr< MCAsmBackend > MAB, std::unique_ptr< MCObjectWriter > MOW, std::unique_ptr< MCCodeEmitter > MCE, bool RelaxAll)