34 "riscv-abi-attributes",
35 cl::desc(
"Enable emitting RISC-V ELF attributes for ABI features"),
111 HasRVC = STI.
hasFeature(RISCV::FeatureStdExtZca);
112 HasTSO = STI.
hasFeature(RISCV::FeatureStdExtZtso);
116 bool EmitStackAlign) {
117 if (EmitStackAlign) {
138 unsigned AtomicABITag;
139 if (STI.
hasFeature(RISCV::FeatureStdExtZalasr))
141 else if (STI.
hasFeature(RISCV::FeatureNoTrailingSeqCstFence))
155 OS <<
"\t.option\tpush\n";
159 OS <<
"\t.option\tpop\n";
163 OS <<
"\t.option\tpic\n";
167 OS <<
"\t.option\tnopic\n";
171 OS <<
"\t.option\trvc\n";
175 OS <<
"\t.option\tnorvc\n";
179 OS <<
"\t.option\texact\n";
183 OS <<
"\t.option\tnoexact\n";
187 OS <<
"\t.option\trelax\n";
191 OS <<
"\t.option\tnorelax\n";
196 OS <<
"\t.option\tarch";
197 for (
const auto &Arg : Args) {
215 OS <<
"\t.variant_cc\t" << Symbol.getName() <<
"\n";
218void RISCVTargetAsmStreamer::emitAttribute(
unsigned Attribute,
unsigned Value) {
222void RISCVTargetAsmStreamer::emitTextAttribute(
unsigned Attribute,
227void RISCVTargetAsmStreamer::emitIntTextAttribute(
unsigned Attribute,
231void RISCVTargetAsmStreamer::finishAttributeSection() {}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static cl::opt< bool > RiscvAbiAttr("riscv-abi-attributes", cl::desc("Enable emitting RISC-V ELF attributes for ABI features"), cl::Hidden)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Context object for machine code objects.
Environment getObjectFileType() const
MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags)
const Triple & getTargetTriple() const
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Streaming machine code generation interface.
virtual bool popSection()
Restore the current and previous section from the section stack.
MCContext & getContext() const
virtual void emitValueToAlignment(Align Alignment, int64_t Fill=0, uint8_t FillLen=1, unsigned MaxBytesToEmit=0)
Emit some number of copies of Value until the byte alignment ByteAlignment is reached.
virtual void emitIntValue(uint64_t Value, unsigned Size)
Special case of EmitValue that avoids the client having to pass in a MCExpr for constant integers.
void pushSection()
Save the current and previous section on the section stack.
virtual void switchSection(MCSection *Section, uint32_t Subsec=0)
Set the current section where code is being emitted to Section.
virtual void emitBytes(StringRef Data)
Emit the bytes in Data into the output.
Generic base class for all target subtargets.
bool hasFeature(unsigned Feature) const
const FeatureBitset & getFeatureBits() const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Target specific streamer interface.
MCStreamer & getStreamer()
This class represents success/failure for parsing-like operations that find it important to chain tog...
void emitDirectiveOptionPIC() override
void emitDirectiveOptionExact() override
void emitDirectiveOptionArch(ArrayRef< RISCVOptionArchArg > Args) override
void emitDirectiveOptionRelax() override
RISCVTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS)
void emitDirectiveOptionNoRVC() override
void emitDirectiveOptionNoPIC() override
void emitDirectiveOptionPop() override
void emitDirectiveOptionNoRelax() override
void emitDirectiveOptionRVC() override
void emitDirectiveVariantCC(MCSymbol &Symbol) override
void emitDirectiveOptionNoExact() override
void emitDirectiveOptionPush() override
void emitNoteGnuPropertySection(const uint32_t Feature1And)
virtual void emitDirectiveOptionPIC()
virtual void emitDirectiveOptionNoRelax()
virtual void emitAttribute(unsigned Attribute, unsigned Value)
virtual void emitTextAttribute(unsigned Attribute, StringRef String)
virtual void emitDirectiveVariantCC(MCSymbol &Symbol)
void emitTargetAttributes(const MCSubtargetInfo &STI, bool EmitStackAlign)
void setFlagsFromFeatures(const MCSubtargetInfo &STI)
virtual void emitIntTextAttribute(unsigned Attribute, unsigned IntValue, StringRef StringValue)
virtual void emitDirectiveOptionExact()
virtual void emitDirectiveOptionNoExact()
virtual void emitDirectiveOptionPop()
virtual void emitDirectiveOptionNoPIC()
void setTargetABI(RISCVABI::ABI ABI)
RISCVTargetStreamer(MCStreamer &S)
virtual void emitDirectiveOptionArch(ArrayRef< RISCVOptionArchArg > Args)
virtual void finishAttributeSection()
virtual void emitDirectiveOptionPush()
virtual void emitDirectiveOptionRelax()
virtual void emitDirectiveOptionNoRVC()
virtual void emitDirectiveOptionRVC()
StringRef - Represent a constant reference to a string, i.e.
Triple - Helper class for working with autoconf configuration names.
LLVM_ABI bool isArch64Bit() const
Test whether the architecture is 64-bit.
LLVM_ABI bool isArch32Bit() const
Test whether the architecture is 32-bit.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
LLVM Value Representation.
@ GNU_PROPERTY_RISCV_FEATURE_1_AND
llvm::Expected< std::unique_ptr< RISCVISAInfo > > parseFeatureBits(bool IsRV64, const FeatureBitset &FeatureBits)
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
This struct is a compact representation of a valid (non-zero power of two) alignment.