14 #define DEBUG_TYPE "hexagonmcelfstreamer" 45 cl::desc(
"Global Pointer Addressing Size. The default size is 8."),
51 std::unique_ptr<MCObjectWriter> OW, std::unique_ptr<MCCodeEmitter> Emitter)
56 MCContext &Context, std::unique_ptr<MCAsmBackend> TAB,
57 std::unique_ptr<MCObjectWriter> OW, std::unique_ptr<MCCodeEmitter> Emitter,
91 unsigned AccessSize) {
93 StringRef sbss[4] = {
".sbss.1",
".sbss.2",
".sbss.4",
".sbss.8"};
95 auto ELFSymbol = cast<MCSymbolELF>(
Symbol);
96 if (!ELFSymbol->isBindingSet()) {
98 ELFSymbol->setExternal(
true);
105 ((AccessSize == 0) || (Size == 0) || (Size >
GPSize))
113 if (ELFSymbol->isUndefined()) {
120 if (ByteAlignment > Section.getAlignment())
121 Section.setAlignment(ByteAlignment);
125 if (ELFSymbol->declareCommon(Size, ByteAlignment))
127 " redeclared as different type");
128 if ((AccessSize) && (Size <=
GPSize)) {
129 uint64_t SectionIndex =
133 ELFSymbol->setIndex(SectionIndex);
143 unsigned AccessSize) {
145 auto ELFSymbol = cast<MCSymbolELF>(
Symbol);
147 ELFSymbol->setExternal(
false);
154 std::unique_ptr<MCAsmBackend> MAB,
155 std::unique_ptr<MCObjectWriter> OW,
156 std::unique_ptr<MCCodeEmitter> CE) {
Instances of this class represent a uniqued identifier for a section in the current translation unit...
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class represents lattice values for constants.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI, bool) override
Emit the given Instruction into the current section.
void registerSymbol(const MCSymbol &Symbol, bool *Created=nullptr)
MCContext & getContext() const
MCContext & getContext() const
static cl::opt< unsigned > GPSize("gpsize", cl::NotHidden, cl::desc("Global Pointer Addressing Size. The default size is 8."), cl::Prefix, cl::init(8))
iterator_range< Hexagon::PacketIterator > bundleInstructions(MCInstrInfo const &MCII, MCInst const &MCI)
void EmitValueToAlignment(unsigned, int64_t, unsigned, unsigned) override
Emit some number of copies of Value until the byte alignment ByteAlignment is reached.
Context object for machine code objects.
MCInstrInfo * createHexagonMCInstrInfo()
const MCExpr * getExpr() const
Instances of this class represent a single low-level machine instruction.
initializer< Ty > init(const Ty &Val)
void EmitZeros(uint64_t NumBytes)
Emit NumBytes worth of zeros.
Streaming machine code generation interface.
virtual void SwitchSection(MCSection *Section, const MCExpr *Subsection=nullptr)
Set the current section where code is being emitted to Section.
MCAssembler & getAssembler()
unsigned getNumOperands() const
Triple - Helper class for working with autoconf configuration names.
void HexagonMCEmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment, unsigned AccessSize)
MCSectionSubPair getCurrentSection() const
Return the current section that the streamer is emitting code to.
std::pair< MCSection *, const MCExpr * > MCSectionSubPair
HexagonMCELFStreamer(MCContext &Context, std::unique_ptr< MCAsmBackend > TAB, std::unique_ptr< MCObjectWriter > OW, std::unique_ptr< MCCodeEmitter > Emitter)
const MCOperand & getOperand(unsigned i) const
void EmitSymbol(const MCInst &Inst)
void visitUsedExpr(const MCExpr &Expr)
Generic base class for all target subtargets.
size_t bundleSize(MCInst const &MCI)
void EmitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc()) override
Emit a label for Symbol into the current section.
StringRef getName() const
getName - Get the symbol name.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
MCStreamer * createHexagonELFStreamer(Triple const &TT, MCContext &Context, std::unique_ptr< MCAsmBackend > MAB, std::unique_ptr< MCObjectWriter > OW, std::unique_ptr< MCCodeEmitter > CE)
MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags)
#define HEXAGON_PACKET_SIZE
StringRef - Represent a constant reference to a string, i.e.
unsigned getOpcode() const
unsigned Log2_64(uint64_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx)
void HexagonMCEmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment, unsigned AccessSize)
void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI, bool=false) override
Emit the given Instruction into the current section.