43#define DEBUG_TYPE "hexagonmcelfstreamer"
49 cl::desc(
"Global Pointer Addressing Size. The default size is 8."),
54 MCContext &Context, std::unique_ptr<MCAsmBackend> TAB,
55 std::unique_ptr<MCObjectWriter> OW, std::unique_ptr<MCCodeEmitter>
Emitter)
60 MCContext &Context, std::unique_ptr<MCAsmBackend> TAB,
61 std::unique_ptr<MCObjectWriter> OW, std::unique_ptr<MCCodeEmitter>
Emitter,
95 unsigned AccessSize) {
97 StringRef sbss[4] = {
".sbss.1",
".sbss.2",
".sbss.4",
".sbss.8"};
99 auto ELFSymbol = cast<MCSymbolELF>(Symbol);
100 if (!ELFSymbol->isBindingSet())
115 if (ELFSymbol->isUndefined()) {
122 Section.ensureMinAlignment(ByteAlignment);
126 if (ELFSymbol->declareCommon(
Size, ByteAlignment))
128 " redeclared as different type");
134 ELFSymbol->setIndex(SectionIndex);
144 unsigned AccessSize) {
146 auto ELFSymbol = cast<MCSymbolELF>(Symbol);
148 ELFSymbol->setExternal(
false);
154 case Hexagon::ArchV5:
156 case Hexagon::ArchV55:
158 case Hexagon::ArchV60:
159 case Hexagon::ExtensionHVXV60:
161 case Hexagon::ArchV62:
162 case Hexagon::ExtensionHVXV62:
164 case Hexagon::ArchV65:
165 case Hexagon::ExtensionHVXV65:
167 case Hexagon::ArchV66:
168 case Hexagon::ExtensionHVXV66:
170 case Hexagon::ArchV67:
171 case Hexagon::ExtensionHVXV67:
173 case Hexagon::ArchV68:
174 case Hexagon::ExtensionHVXV68:
176 case Hexagon::ArchV69:
177 case Hexagon::ExtensionHVXV69:
179 case Hexagon::ArchV71:
180 case Hexagon::ExtensionHVXV71:
182 case Hexagon::ArchV73:
183 case Hexagon::ExtensionHVXV73:
197 if (Features.test(Hexagon::ExtensionHVXIEEEFP))
199 if (Features.test(Hexagon::ExtensionHVXQFloat))
201 if (Features.test(Hexagon::ExtensionZReg))
203 if (Features.test(Hexagon::ExtensionAudio))
205 if (Features.test(Hexagon::FeatureCabac))
211 std::unique_ptr<MCAsmBackend> MAB,
212 std::unique_ptr<MCObjectWriter> OW,
213 std::unique_ptr<MCCodeEmitter> CE) {
dxil DXContainer Global Emitter
static cl::opt< unsigned > GPSize("gpsize", cl::NotHidden, cl::desc("Global Pointer Addressing Size. The default size is 8."), cl::Prefix, cl::init(8))
static unsigned featureToArchVersion(unsigned Feature)
#define HEXAGON_PACKET_SIZE
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void HexagonMCEmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, Align ByteAlignment, unsigned AccessSize)
void HexagonMCEmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, Align ByteAlignment, unsigned AccessSize)
void emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) override
Emit the given Instruction into the current section.
void EmitSymbol(const MCInst &Inst)
HexagonMCELFStreamer(MCContext &Context, std::unique_ptr< MCAsmBackend > TAB, std::unique_ptr< MCObjectWriter > OW, std::unique_ptr< MCCodeEmitter > Emitter)
void emitTargetAttributes(const MCSubtargetInfo &STI)
virtual void emitAttribute(unsigned Attribute, unsigned Value)
MCContext & getContext() const
bool registerSymbol(const MCSymbol &Symbol)
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)
void emitValueToAlignment(Align, int64_t, unsigned, unsigned) override
Emit some number of copies of Value until the byte alignment ByteAlignment is reached.
void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc()) override
Emit a label for Symbol into the current section.
Instances of this class represent a single low-level machine instruction.
unsigned getNumOperands() const
unsigned getOpcode() const
const MCOperand & getOperand(unsigned i) const
MCAssembler & getAssembler()
void emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) override
Emit the given Instruction into the current section.
const MCExpr * getExpr() const
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Streaming machine code generation interface.
MCContext & getContext() const
virtual void switchSection(MCSection *Section, uint32_t Subsec=0)
Set the current section where code is being emitted to Section.
MCSectionSubPair getCurrentSection() const
Return the current section that the streamer is emitting code to.
void emitZeros(uint64_t NumBytes)
Emit NumBytes worth of zeros.
void visitUsedExpr(const MCExpr &Expr)
Generic base class for all target subtargets.
const FeatureBitset & getFeatureBits() const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
StringRef - Represent a constant reference to a string, i.e.
Triple - Helper class for working with autoconf configuration names.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
size_t bundleSize(MCInst const &MCI)
iterator_range< Hexagon::PacketIterator > bundleInstructions(MCInstrInfo const &MCII, MCInst const &MCI)
unsigned getArchVersion(const FeatureBitset &Features)
std::optional< unsigned > getHVXVersion(const FeatureBitset &Features)
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
int bit_width(T Value)
Returns the number of bits needed to represent Value if Value is nonzero.
unsigned Log2_64(uint64_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
std::pair< MCSection *, uint32_t > MCSectionSubPair
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
MCInstrInfo * createHexagonMCInstrInfo()
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
MCStreamer * createHexagonELFStreamer(Triple const &TT, MCContext &Context, std::unique_ptr< MCAsmBackend > MAB, std::unique_ptr< MCObjectWriter > OW, std::unique_ptr< MCCodeEmitter > CE)
Implement std::hash so that hash_code can be used in STL containers.
This struct is a compact representation of a valid (non-zero power of two) alignment.