38 unsigned EFlags = W.getELFHeaderEFlags();
42 if (Features[CSKY::ProcCK801])
44 else if (Features[CSKY::ProcCK802])
46 else if (Features[CSKY::ProcCK803])
48 else if (Features[CSKY::ProcCK804])
50 else if (Features[CSKY::ProcCK805])
52 else if (Features[CSKY::ProcCK807])
54 else if (Features[CSKY::ProcCK810])
56 else if (Features[CSKY::ProcCK860])
61 if (Features[CSKY::FeatureFPUV2_SF] || Features[CSKY::FeatureFPUV3_SF])
66 W.setELFHeaderEFlags(EFlags);
73void CSKYTargetELFStreamer::emitAttribute(
unsigned Attribute,
unsigned Value) {
77void CSKYTargetELFStreamer::emitTextAttribute(
unsigned Attribute,
86 if (AttributeSection) {
87 Streamer.switchSection(AttributeSection);
92 Streamer.switchSection(AttributeSection);
97 const size_t VendorHeaderSize = 4 + CurrentVendor.size() + 1;
100 const size_t TagHeaderSize = 1 + 4;
102 const size_t ContentsSize = calculateContentSize();
104 Streamer.emitInt32(VendorHeaderSize + TagHeaderSize + ContentsSize);
109 Streamer.emitInt32(TagHeaderSize + ContentsSize);
113 for (AttributeItem item : Contents) {
114 Streamer.emitULEB128IntValue(item.Tag);
118 case AttributeType::Numeric:
119 Streamer.emitULEB128IntValue(item.IntValue);
121 case AttributeType::Text:
122 Streamer.emitBytes(item.StringValue);
125 case AttributeType::NumericAndText:
126 Streamer.emitULEB128IntValue(item.IntValue);
127 Streamer.emitBytes(item.StringValue);
136size_t CSKYTargetELFStreamer::calculateContentSize()
const {
138 for (AttributeItem item : Contents) {
140 case AttributeType::Hidden:
142 case AttributeType::Numeric:
146 case AttributeType::Text:
148 Result += item.StringValue.size() + 1;
150 case AttributeType::NumericAndText:
153 Result += item.StringValue.size() + 1;
160void CSKYELFStreamer::EmitMappingSymbol(
StringRef Name) {
180void CSKYTargetELFStreamer::emitTargetAttributes(
const MCSubtargetInfo &STI) {
181 StringRef CPU = STI.
getCPU();
184 if (ArchID == CSKY::ArchKind::CK804)
185 ArchID = CSKY::ArchKind::CK803;
189 if (ArchID == CSKY::ArchKind::INVALID) {
196 unsigned ISAFlag = 0;
271 unsigned ISAExtFlag = 0;
301 else if (STI.
hasFeature(CSKY::FeatureFPUV3_HF) ||
306 bool hasAnyFloatExt = STI.
hasFeature(CSKY::FeatureFPUV2_SF) ||
312 if (hasAnyFloatExt && STI.
hasFeature(CSKY::ModeHardFloat) &&
315 else if (hasAnyFloatExt && STI.
hasFeature(CSKY::ModeHardFloat))
320 unsigned HardFPFlag = 0;
330 if (HardFPFlag != 0) {
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.
bool hasFeature(unsigned Feature) const
const FeatureBitset & getFeatureBits() const
StringRef - 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.
LLVM_ABI ArchKind parseCPUArch(StringRef CPU)
LLVM_ABI StringRef getArchName(ArchKind AK)
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.