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,
82void CSKYTargetELFStreamer::finishAttributeSection() {
86 if (AttributeSection) {
97 const size_t VendorHeaderSize = 4 + CurrentVendor.
size() + 1;
100 const size_t TagHeaderSize = 1 + 4;
102 const size_t ContentsSize = calculateContentSize();
113 for (AttributeItem item : Contents) {
118 case AttributeType::Numeric:
121 case AttributeType::Text:
125 case AttributeType::NumericAndText:
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;
179void CSKYTargetELFStreamer::emitTargetAttributes(
const MCSubtargetInfo &STI) {
183 if (ArchID == CSKY::ArchKind::CK804)
184 ArchID = CSKY::ArchKind::CK803;
188 if (ArchID == CSKY::ArchKind::INVALID) {
195 unsigned ISAFlag = 0;
270 unsigned ISAExtFlag = 0;
300 else if (STI.
hasFeature(CSKY::FeatureFPUV3_HF) ||
305 bool hasAnyFloatExt = STI.
hasFeature(CSKY::FeatureFPUV2_SF) ||
311 if (hasAnyFloatExt && STI.
hasFeature(CSKY::ModeHardFloat) &&
314 else if (hasAnyFloatExt && STI.
hasFeature(CSKY::ModeHardFloat))
319 unsigned HardFPFlag = 0;
329 if (HardFPFlag != 0) {
MCELFStreamer & getStreamer()
CSKYTargetELFStreamer(MCStreamer &S, const MCSubtargetInfo &STI)
Container class for subtarget features.
MCContext & getContext() const
MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags)
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
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, uint32_t Subsec=0)
Set the current section where code is being emitted to Section.
void emitInt32(uint64_t Value)
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.
bool hasFeature(unsigned Feature) const
const FeatureBitset & getFeatureBits() const
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.
ArchKind parseCPUArch(StringRef CPU)
StringRef getArchName(ArchKind AK)
This is an optimization pass for GlobalISel generic memory operations.
unsigned getULEB128Size(uint64_t Value)
Utility function to get the size of the ULEB128-encoded value.