36 unsigned EFlags = W.getELFHeaderEFlags();
40 if (Features[CSKY::ProcCK801])
42 else if (Features[CSKY::ProcCK802])
44 else if (Features[CSKY::ProcCK803])
46 else if (Features[CSKY::ProcCK804])
48 else if (Features[CSKY::ProcCK805])
50 else if (Features[CSKY::ProcCK807])
52 else if (Features[CSKY::ProcCK810])
54 else if (Features[CSKY::ProcCK860])
59 if (Features[CSKY::FeatureFPUV2_SF] || Features[CSKY::FeatureFPUV3_SF])
64 W.setELFHeaderEFlags(EFlags);
71void CSKYTargetELFStreamer::emitAttribute(
unsigned Attribute,
unsigned Value) {
75void CSKYTargetELFStreamer::emitTextAttribute(
unsigned Attribute,
84 if (AttributeSection) {
85 Streamer.switchSection(AttributeSection);
90 Streamer.switchSection(AttributeSection);
95 const size_t VendorHeaderSize = 4 + CurrentVendor.size() + 1;
98 const size_t TagHeaderSize = 1 + 4;
100 const size_t ContentsSize = calculateContentSize();
102 Streamer.emitInt32(VendorHeaderSize + TagHeaderSize + ContentsSize);
107 Streamer.emitInt32(TagHeaderSize + ContentsSize);
111 for (AttributeItem item : Contents) {
112 Streamer.emitULEB128IntValue(item.Tag);
116 case AttributeType::Numeric:
117 Streamer.emitULEB128IntValue(item.IntValue);
119 case AttributeType::Text:
120 Streamer.emitBytes(item.StringValue);
123 case AttributeType::NumericAndText:
124 Streamer.emitULEB128IntValue(item.IntValue);
125 Streamer.emitBytes(item.StringValue);
134size_t CSKYTargetELFStreamer::calculateContentSize()
const {
136 for (AttributeItem item : Contents) {
138 case AttributeType::Hidden:
140 case AttributeType::Numeric:
144 case AttributeType::Text:
146 Result += item.StringValue.size() + 1;
148 case AttributeType::NumericAndText:
151 Result += item.StringValue.size() + 1;
158void CSKYELFStreamer::EmitMappingSymbol(
StringRef Name) {
Functions, function parameters, and return types can have attributes to indicate how they should be t...
MCELFStreamer & getStreamer()
CSKYTargetELFStreamer(MCStreamer &S, const MCSubtargetInfo &STI)
virtual void finishAttributeSection()
CSKYTargetStreamer(MCStreamer &S)
Container class for subtarget features.
MCContext & getContext() const
MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags)
LLVM_ABI MCSymbol * createLocalSymbol(StringRef Name)
Create a local, non-temporary symbol like an ELF mapping symbol.
ELFObjectWriter & getWriter()
void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc()) override
Emit a label for Symbol into the current section.
MCAssembler & getAssembler()
Streaming machine code generation interface.
MCContext & getContext() const
Generic base class for all target subtargets.
const FeatureBitset & getFeatureBits() const
Represent a constant reference to a string, i.e.
LLVM Value Representation.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI unsigned getULEB128Size(uint64_t Value)
Utility function to get the size of the ULEB128-encoded value.