MCStreamer.h revision dce4a407a24b04eebc6a376f8e62b41aaa7b071f
15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//===- MCStreamer.h - High-level Streaming Machine Code Output --*- C++ -*-===//
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//                     The LLVM Compiler Infrastructure
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This file is distributed under the University of Illinois Open Source
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// License. See LICENSE.TXT for details.
72a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)//
8bbcdd45c55eb7c4641ab97aef9889b0fc828e7d3Ben Murdoch//===----------------------------------------------------------------------===//
92a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)//
10868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// This file declares the MCStreamer class.
111e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)//
121e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)//===----------------------------------------------------------------------===//
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#ifndef LLVM_MC_MCSTREAMER_H
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define LLVM_MC_MCSTREAMER_H
162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "llvm/ADT/ArrayRef.h"
182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "llvm/ADT/SmallVector.h"
19c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#include "llvm/MC/MCAssembler.h"
20c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#include "llvm/MC/MCDirectives.h"
21eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch#include "llvm/MC/MCDwarf.h"
22c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#include "llvm/MC/MCLinkerOptimizationHint.h"
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "llvm/MC/MCWin64EH.h"
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "llvm/Support/DataTypes.h"
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <string>
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace llvm {
282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class MCAsmBackend;
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class MCCodeEmitter;
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class MCContext;
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class MCExpr;
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class MCInst;
332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class MCInstPrinter;
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class MCSection;
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class MCStreamer;
36bbcdd45c55eb7c4641ab97aef9889b0fc828e7d3Ben Murdochclass MCSymbol;
37eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdochclass MCSymbolRefExpr;
3858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)class MCSubtargetInfo;
397d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)class StringRef;
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Twine;
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class raw_ostream;
425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class formatted_raw_ostream;
431e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)class AssemblerConstantPools;
444e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef std::pair<const MCSection *, const MCExpr *> MCSectionSubPair;
462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// Target specific streamer interface. This is used so that targets can
482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/// implement support for target specific assembly directives.
4990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)///
505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// If target foo wants to use this, it should implement 3 classes:
515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// * FooTargetStreamer : public MCTargetStreamer
522a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/// * FooTargetAsmSreamer : public FooTargetStreamer
5368043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)/// * FooTargetELFStreamer : public FooTargetStreamer
545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)///
555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// FooTargetStreamer should have a pure virtual method for each directive. For
565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// example, for a ".bar symbol_name" directive, it should have
572a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/// virtual emitBar(const MCSymbol &Symbol) = 0;
58d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)///
59d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)/// The FooTargetAsmSreamer and FooTargetELFStreamer classes implement the
602a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/// method. The assembly streamer just prints ".bar symbol_name". The object
612a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/// streamer does whatever is needed to implement .bar in the object file.
622a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)///
632a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/// In the assembly printer and parser the target streamer can be used by
645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// calling getTargetStreamer and casting it to FooTargetStreamer:
655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)///
665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// MCTargetStreamer &TS = OutStreamer.getTargetStreamer();
672a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/// FooTargetStreamer &ATS = static_cast<FooTargetStreamer &>(TS);
685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)///
695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// The base classes FooTargetAsmSreamer and FooTargetELFStreamer should *never*
705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// be treated differently. Callers should always talk to a FooTargetStreamer.
715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class MCTargetStreamer {
725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)protected:
735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  MCStreamer &Streamer;
745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)public:
765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  MCTargetStreamer(MCStreamer &S);
775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual ~MCTargetStreamer();
78bbcdd45c55eb7c4641ab97aef9889b0fc828e7d3Ben Murdoch
79bbcdd45c55eb7c4641ab97aef9889b0fc828e7d3Ben Murdoch  const MCStreamer &getStreamer() { return Streamer; }
80bbcdd45c55eb7c4641ab97aef9889b0fc828e7d3Ben Murdoch
81bbcdd45c55eb7c4641ab97aef9889b0fc828e7d3Ben Murdoch  // Allow a target to add behavior to the EmitLabel of MCStreamer.
82bbcdd45c55eb7c4641ab97aef9889b0fc828e7d3Ben Murdoch  virtual void emitLabel(MCSymbol *Symbol);
832a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Allow a target to add behavior to the emitAssignment of MCStreamer.
842a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void emitAssignment(MCSymbol *Symbol, const MCExpr *Value);
852a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
862a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void finish();
872a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)};
882a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
892a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// FIXME: declared here because it is used from
902a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// lib/CodeGen/AsmPrinter/ARMException.cpp.
912a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class ARMTargetStreamer : public MCTargetStreamer {
922a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)public:
932a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  ARMTargetStreamer(MCStreamer &S);
942a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  ~ARMTargetStreamer();
95c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
96c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  virtual void emitFnStart();
97c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  virtual void emitFnEnd();
98c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  virtual void emitCantUnwind();
99c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  virtual void emitPersonality(const MCSymbol *Personality);
100c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  virtual void emitPersonalityIndex(unsigned Index);
101c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  virtual void emitHandlerData();
102c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  virtual void emitSetFP(unsigned FpReg, unsigned SpReg,
103c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)                         int64_t Offset = 0);
104c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  virtual void emitMovSP(unsigned Reg, int64_t Offset = 0);
105c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  virtual void emitPad(int64_t Offset);
1062a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void emitRegSave(const SmallVectorImpl<unsigned> &RegList,
1072a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                           bool isVector);
1082a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void emitUnwindRaw(int64_t StackOffset,
109c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)                             const SmallVectorImpl<uint8_t> &Opcodes);
1102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void switchVendor(StringRef Vendor);
1122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void emitAttribute(unsigned Attribute, unsigned Value);
1132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void emitTextAttribute(unsigned Attribute, StringRef String);
1142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void emitIntTextAttribute(unsigned Attribute, unsigned IntValue,
1152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                    StringRef StringValue = "");
1162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void emitFPU(unsigned FPU);
1172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void emitArch(unsigned Arch);
1182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void emitObjectArch(unsigned Arch);
1192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void finishAttributeSection();
1202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void emitInst(uint32_t Inst, char Suffix = '\0');
1212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void AnnotateTLSDescriptorSequence(const MCSymbolRefExpr *SRE);
1232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void emitThumbSet(MCSymbol *Symbol, const MCExpr *Value);
125c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
1267dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  void finish() override;
127c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
128c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  /// Callback used to implement the ldr= pseudo.
12968043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  /// Add a new entry to the constant pool for the current section and return an
13068043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  /// MCExpr that can be used to refer to the constant pool location.
131c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  const MCExpr *addConstantPoolEntry(const MCExpr *);
132c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
133c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  /// Callback used to implemnt the .ltorg directive.
1342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// Emit contents of constant pool for the current section.
1352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  void emitCurrentConstantPool();
1362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)private:
1382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  std::unique_ptr<AssemblerConstantPools> ConstantPools;
1392a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)};
1402a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/// MCStreamer - Streaming machine code generation interface.  This interface
1422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/// is intended to provide a programatic interface that is very similar to the
1432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/// level that an assembler .s file provides.  It has callbacks to emit bytes,
1442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/// handle directives, etc.  The implementation of this interface retains
1452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/// state to know what the current section is etc.
1462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)///
1472a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/// There are multiple implementations of this interface: one for writing out
1482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/// a .s file, and implementations that write out .o files of various formats.
1492a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)///
1502a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class MCStreamer {
1512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  MCContext &Context;
1522a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  std::unique_ptr<MCTargetStreamer> TargetStreamer;
1532a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1542a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  MCStreamer(const MCStreamer &) LLVM_DELETED_FUNCTION;
1552a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  MCStreamer &operator=(const MCStreamer &) LLVM_DELETED_FUNCTION;
1562a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1572a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  std::vector<MCDwarfFrameInfo> FrameInfos;
1582a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  MCDwarfFrameInfo *getCurrentFrameInfo();
1592a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  MCSymbol *EmitCFICommon();
1602a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  void EnsureValidFrame();
1612a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1622a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  std::vector<MCWin64EHUnwindInfo *> W64UnwindInfos;
1632a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  MCWin64EHUnwindInfo *CurrentW64UnwindInfo;
1642a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  void setCurrentW64UnwindInfo(MCWin64EHUnwindInfo *Frame);
1652a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  void EnsureValidW64UnwindInfo();
1662a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1672a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  MCSymbol *LastSymbol;
1682a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // SymbolOrdering - Tracks an index to represent the order
1705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // a symbol was emitted in. Zero means we did not emit that symbol.
171c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  DenseMap<const MCSymbol *, unsigned> SymbolOrdering;
1725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// SectionStack - This is stack of current and previous section
1745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// values saved by PushSection.
1755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  SmallVector<std::pair<MCSectionSubPair, MCSectionSubPair>, 4> SectionStack;
1765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
177c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)protected:
178c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  MCStreamer(MCContext &Ctx);
179c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
1805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  const MCExpr *BuildSymbolDiff(MCContext &Context, const MCSymbol *A,
1815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                const MCSymbol *B);
1825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  const MCExpr *ForceExpAbs(const MCExpr *Expr);
184c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
1855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void RecordProcStart(MCDwarfFrameInfo &Frame);
1865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame);
1875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void RecordProcEnd(MCDwarfFrameInfo &Frame);
1885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void EmitCFIEndProcImpl(MCDwarfFrameInfo &CurFrame);
1895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  MCWin64EHUnwindInfo *getCurrentW64UnwindInfo() {
1915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return CurrentW64UnwindInfo;
1925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void EmitW64Tables();
1945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void EmitRawTextImpl(StringRef String);
1965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)public:
1985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual ~MCStreamer();
1995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void setTargetStreamer(MCTargetStreamer *TS) {
2015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    TargetStreamer.reset(TS);
20290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  }
2035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// State management
2055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  ///
2065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void reset();
2075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
208c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  MCContext &getContext() const { return Context; }
2095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  MCTargetStreamer *getTargetStreamer() {
2115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return TargetStreamer.get();
2125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
2135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  unsigned getNumFrameInfos() { return FrameInfos.size(); }
2155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  const MCDwarfFrameInfo &getFrameInfo(unsigned i) { return FrameInfos[i]; }
2175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  ArrayRef<MCDwarfFrameInfo> getFrameInfos() const { return FrameInfos; }
2195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  unsigned getNumW64UnwindInfos() { return W64UnwindInfos.size(); }
2215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  MCWin64EHUnwindInfo &getW64UnwindInfo(unsigned i) {
2235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return *W64UnwindInfos[i];
2245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
2255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void generateCompactUnwindEncodings(MCAsmBackend *MAB);
2275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// @name Assembly File Formatting.
2295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// @{
2305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// isVerboseAsm - Return true if this streamer supports verbose assembly
2325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// and if it is enabled.
2335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool isVerboseAsm() const { return false; }
2345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// hasRawTextSupport - Return true if this asm streamer supports emitting
2365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// unformatted text to the .s file with EmitRawText.
2375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool hasRawTextSupport() const { return false; }
2385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// Is the integrated assembler required for this streamer to function
2405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// correctly?
2415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool isIntegratedAssemblerRequired() const { return false; }
2425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
24358537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  /// AddComment - Add a comment that can be emitted to the generated .s
24458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  /// file if applicable as a QoI issue to make the output of the compiler
24558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  /// more readable.  This only affects the MCAsmStreamer, and only when
24658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  /// verbose assembly output is enabled.
24758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  ///
24858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  /// If the comment includes embedded \n's, they will each get the comment
24958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  /// prefix as appropriate.  The added comment should not end with a \n.
25058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  virtual void AddComment(const Twine &T) {}
25158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)
25258537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  /// GetCommentOS - Return a raw_ostream that comments can be written to.
25358537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  /// Unlike AddComment, you are required to terminate comments with \n if you
25458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  /// use this method.
25558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  virtual raw_ostream &GetCommentOS();
25658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)
25758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  /// Print T and prefix it with the comment string (normally #) and optionally
25858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  /// a tab. This prints the comment immediately, not at the end of the
25958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  /// current line. It is basically a safe version of EmitRawText: since it
26058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  /// only prints comments, the object streamer ignores it instead of asserting.
261eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  virtual void emitRawComment(const Twine &T, bool TabPrefix = true);
262eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
2632a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// AddBlankLine - Emit a blank line to a .s file to pretty it up.
26458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  virtual void AddBlankLine() {}
26558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)
26658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  /// @}
26758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)
26858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  /// @name Symbol & Section Management
26958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  /// @{
27058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)
2715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// getCurrentSection - Return the current section that the streamer is
2725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// emitting code to.
2735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  MCSectionSubPair getCurrentSection() const {
2745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    if (!SectionStack.empty())
2755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      return SectionStack.back().first;
2765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return MCSectionSubPair();
2775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
2785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
279eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// getPreviousSection - Return the previous section that the streamer is
2805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// emitting code to.
2815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  MCSectionSubPair getPreviousSection() const {
2825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    if (!SectionStack.empty())
2835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      return SectionStack.back().second;
2842a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    return MCSectionSubPair();
2852a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  }
2865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// GetSymbolOrder - Returns an index to represent the order
2885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// a symbol was emitted in. (zero if we did not emit that symbol)
2895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  unsigned GetSymbolOrder(const MCSymbol *Sym) const {
2905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return SymbolOrdering.lookup(Sym);
2915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
2925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// ChangeSection - Update streamer for a new active section.
2945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  ///
2955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// This is called by PopSection and SwitchSection, if the current
2965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// section changes.
297eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  virtual void ChangeSection(const MCSection *, const MCExpr *) = 0;
298eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
2995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// pushSection - Save the current and previous section on the
3005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// section stack.
3015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void PushSection() {
3027d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)    SectionStack.push_back(
3035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)        std::make_pair(getCurrentSection(), getPreviousSection()));
3045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
3055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// popSection - Restore the current and previous section from
3075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// the section stack.  Calls ChangeSection as needed.
3085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  ///
3095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// Returns false if the stack was empty.
3105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool PopSection() {
3115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    if (SectionStack.size() <= 1)
3125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      return false;
3135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    MCSectionSubPair oldSection = SectionStack.pop_back_val().first;
3145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    MCSectionSubPair curSection = SectionStack.back().first;
3155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3167d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)    if (oldSection != curSection)
3175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      ChangeSection(curSection.first, curSection.second);
3185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return true;
3195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
3205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool SubSection(const MCExpr *Subsection) {
3225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    if (SectionStack.empty())
3235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      return false;
3245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
325eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch    SwitchSection(SectionStack.back().first.first, Subsection);
3265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return true;
3275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
3285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// SwitchSection - Set the current section where code is being emitted to
3305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// @p Section.  This is required to update CurSection.
3315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  ///
33290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  /// This corresponds to assembler directives like .section, .text, etc.
33390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  void SwitchSection(const MCSection *Section,
33490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)                     const MCExpr *Subsection = nullptr) {
3355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    assert(Section && "Cannot switch to a null section!");
3365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    MCSectionSubPair curSection = SectionStack.back().first;
337f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)    SectionStack.back().second = curSection;
3385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    if (MCSectionSubPair(Section, Subsection) != curSection) {
339f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)      SectionStack.back().first = MCSectionSubPair(Section, Subsection);
3405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      ChangeSection(Section, Subsection);
341f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)    }
3425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
343f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
3445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// SwitchSectionNoChange - Set the current section where code is being
345f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  /// emitted to @p Section.  This is required to update CurSection. This
3465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// version does not call ChangeSection.
3475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void SwitchSectionNoChange(const MCSection *Section,
3485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                             const MCExpr *Subsection = nullptr) {
3495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    assert(Section && "Cannot switch to a null section!");
350f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)    MCSectionSubPair curSection = SectionStack.back().first;
351f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)    SectionStack.back().second = curSection;
3525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    if (MCSectionSubPair(Section, Subsection) != curSection)
353f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)      SectionStack.back().first = MCSectionSubPair(Section, Subsection);
3545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
355f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
3565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// Create the default sections and set the initial one.
357f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void InitSections();
358f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
3595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// AssignSection - Sets the symbol's section.
3605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  ///
3615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// Each emitted symbol will be tracked in the ordering table,
3625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// so we can sort on them later.
3635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void AssignSection(MCSymbol *Symbol, const MCSection *Section);
364f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
3655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// EmitLabel - Emit a label for @p Symbol into the current section.
366f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  ///
3675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// This corresponds to an assembler statement such as:
368f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  ///   foo:
3695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  ///
370f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  /// @param Symbol - The symbol to emit. A given symbol should only be
3715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// emitted as a label once, and symbols emitted as a label should never be
3725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// used in an assignment.
3735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // FIXME: These emission are non-const because we mutate the symbol to
374eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  // add the section we're emitting it to later.
375eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  virtual void EmitLabel(MCSymbol *Symbol);
376eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
377eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  virtual void EmitDebugLabel(MCSymbol *Symbol);
378eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
379eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  virtual void EmitEHSymAttributes(const MCSymbol *Symbol, MCSymbol *EHSymbol);
380eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
381eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// EmitAssemblerFlag - Note in the output the specified @p Flag.
382eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  virtual void EmitAssemblerFlag(MCAssemblerFlag Flag) = 0;
383eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
384eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// EmitLinkerOptions - Emit the given list @p Options of strings as linker
385eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// options into the output.
386eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  virtual void EmitLinkerOptions(ArrayRef<std::string> Kind) {}
387eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
388eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// EmitDataRegion - Note in the output the specified region @p Kind.
389eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  virtual void EmitDataRegion(MCDataRegionType Kind) {}
390eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
391eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// EmitVersionMin - Specify the MachO minimum deployment target version.
392eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  virtual void EmitVersionMin(MCVersionMinType, unsigned Major, unsigned Minor,
393eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch                              unsigned Update) {}
394eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
395eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// EmitThumbFunc - Note in the output that the specified @p Func is
396eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// a Thumb mode function (ARM target only).
397eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  virtual void EmitThumbFunc(MCSymbol *Func) = 0;
398eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
399eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// EmitAssignment - Emit an assignment of @p Value to @p Symbol.
400eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  ///
401eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// This corresponds to an assembler statement such as:
402eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  ///  symbol = value
403eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  ///
404eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// The assignment generates no code, but has the side effect of binding the
405eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// value in the current context. For the assembly streamer, this prints the
406eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// binding into the .s file.
407eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  ///
408eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// @param Symbol - The symbol being assigned to.
409eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// @param Value - The value for the symbol.
410eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value);
411eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
412eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// EmitWeakReference - Emit an weak reference from @p Alias to @p Symbol.
413eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  ///
414eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// This corresponds to an assembler statement such as:
415eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  ///  .weakref alias, symbol
416eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  ///
417eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// @param Alias - The alias that is being created.
4185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  /// @param Symbol - The symbol being aliased.
4195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) = 0;
4202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
4212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// EmitSymbolAttribute - Add the given @p Attribute to @p Symbol.
4222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual bool EmitSymbolAttribute(MCSymbol *Symbol,
4232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                   MCSymbolAttr Attribute) = 0;
4242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
4252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// EmitSymbolDesc - Set the @p DescValue for the @p Symbol.
426eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  ///
427eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// @param Symbol - The symbol to have its n_desc field set.
4282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// @param DescValue - The value to set into the n_desc field.
429eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) = 0;
430eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
431eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// BeginCOFFSymbolDef - Start emitting COFF symbol definition
432eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  ///
4332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// @param Symbol - The symbol to have its External & Type fields set.
4342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void BeginCOFFSymbolDef(const MCSymbol *Symbol) = 0;
4352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
436eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// EmitCOFFSymbolStorageClass - Emit the storage class of the symbol.
4372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  ///
4382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// @param StorageClass - The storage class the symbol should have.
4392a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void EmitCOFFSymbolStorageClass(int StorageClass) = 0;
4402a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
4412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// EmitCOFFSymbolType - Emit the type of the symbol.
4422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  ///
4432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// @param Type - A COFF type identifier (see COFF::SymbolType in X86COFF.h)
4442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void EmitCOFFSymbolType(int Type) = 0;
4452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
4462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// EndCOFFSymbolDef - Marks the end of the symbol definition.
4472a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void EndCOFFSymbolDef() = 0;
4482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
4492a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// EmitCOFFSectionIndex - Emits a COFF section index.
4502a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  ///
4512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// @param Symbol - Symbol the section number relocation should point to.
4522a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void EmitCOFFSectionIndex(MCSymbol const *Symbol);
4532a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
4542a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// EmitCOFFSecRel32 - Emits a COFF section relative relocation.
455c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  ///
456c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  /// @param Symbol - Symbol the section relative relocation should point to.
4572a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void EmitCOFFSecRel32(MCSymbol const *Symbol);
4582a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
4592a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// EmitELFSize - Emit an ELF .size directive.
4602a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  ///
4612a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// This corresponds to an assembler statement such as:
4622a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  ///  .size symbol, expression
463eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  ///
464eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) = 0;
4652a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
4662a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// \brief Emit a Linker Optimization Hint (LOH) directive.
4672a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// \param Args - Arguments of the LOH.
468eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  virtual void EmitLOHDirective(MCLOHType Kind, const MCLOHArgs &Args) {}
469eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
470eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// EmitCommonSymbol - Emit a common symbol.
471eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  ///
472eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// @param Symbol - The common symbol to emit.
473eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// @param Size - The size of the common symbol.
474eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// @param ByteAlignment - The alignment of the symbol if
475eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// non-zero. This must be a power of 2.
476eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
477eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch                                unsigned ByteAlignment) = 0;
4782a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
4792a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// EmitLocalCommonSymbol - Emit a local common (.lcomm) symbol.
4802a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  ///
4812a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// @param Symbol - The common symbol to emit.
4822a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// @param Size - The size of the common symbol.
4832a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// @param ByteAlignment - The alignment of the common symbol in bytes.
4842a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
4852a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                     unsigned ByteAlignment) = 0;
486eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
4872a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// EmitZerofill - Emit the zerofill section and an optional symbol.
4882a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  ///
4892a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// @param Section - The zerofill section to create and or to put the symbol
4902a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// @param Symbol - The zerofill symbol to emit, if non-NULL.
4912a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// @param Size - The size of the zerofill symbol.
4922a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// @param ByteAlignment - The alignment of the zerofill symbol if
4932a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// non-zero. This must be a power of 2 on some targets.
494eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  virtual void EmitZerofill(const MCSection *Section,
4952a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                            MCSymbol *Symbol = nullptr, uint64_t Size = 0,
4962a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                            unsigned ByteAlignment = 0) = 0;
4972a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
498eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// EmitTBSSSymbol - Emit a thread local bss (.tbss) symbol.
499eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  ///
500eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// @param Section - The thread local common section.
501eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// @param Symbol - The thread local common symbol to emit.
502eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// @param Size - The size of the symbol.
5032a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// @param ByteAlignment - The alignment of the thread local common symbol
504eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// if non-zero.  This must be a power of 2 on some targets.
5052a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
5062a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                              uint64_t Size, unsigned ByteAlignment = 0) = 0;
5072a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
5082a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// @}
5092a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// @name Generating Data
5102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// @{
511eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
512eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// EmitBytes - Emit the bytes in \p Data into the output.
513eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  ///
514eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// This is used to implement assembler directives such as .byte, .ascii,
515eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// etc.
516eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  virtual void EmitBytes(StringRef Data) = 0;
517eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
518eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// EmitValue - Emit the expression @p Value into the output as a native
5197dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  /// integer of the given @p Size bytes.
520eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  ///
521eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// This is used to implement assembler directives such as .word, .quad,
52268043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  /// etc.
52368043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  ///
524eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// @param Value - The value to emit.
525eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// @param Size - The size of the integer (in bytes) to emit. This must
526eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// match a native machine width.
527eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// @param Loc - The location of the expression for error reporting.
528eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  virtual void EmitValueImpl(const MCExpr *Value, unsigned Size,
529eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch                             const SMLoc &Loc = SMLoc()) = 0;
530eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
531eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  void EmitValue(const MCExpr *Value, unsigned Size,
532eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch                 const SMLoc &Loc = SMLoc());
533eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
534eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// EmitIntValue - Special case of EmitValue that avoids the client having
535eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// to pass in a MCExpr for constant integers.
536eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  virtual void EmitIntValue(uint64_t Value, unsigned Size);
537eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
538eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// EmitAbsValue - Emit the Value, but try to avoid relocations. On MachO
539eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// this is done by producing
540eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// foo = value
541eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// .long foo
542eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  void EmitAbsValue(const MCExpr *Value, unsigned Size);
543eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
544eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  virtual void EmitULEB128Value(const MCExpr *Value) = 0;
545eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
546eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  virtual void EmitSLEB128Value(const MCExpr *Value) = 0;
547eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
548eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// EmitULEB128Value - Special case of EmitULEB128Value that avoids the
549eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// client having to pass in a MCExpr for constant integers.
550eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  void EmitULEB128IntValue(uint64_t Value, unsigned Padding = 0);
551eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
552eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// EmitSLEB128Value - Special case of EmitSLEB128Value that avoids the
553eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// client having to pass in a MCExpr for constant integers.
554eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  void EmitSLEB128IntValue(int64_t Value);
555eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
556eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// EmitSymbolValue - Special case of EmitValue that avoids the client
557eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// having to pass in a MCExpr for MCSymbols.
558eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  void EmitSymbolValue(const MCSymbol *Sym, unsigned Size);
559eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
560eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// EmitGPRel64Value - Emit the expression @p Value into the output as a
561eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// gprel64 (64-bit GP relative) value.
562eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  ///
563eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// This is used to implement assembler directives such as .gpdword on
564eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// targets that support them.
565eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  virtual void EmitGPRel64Value(const MCExpr *Value);
566eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
567eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// EmitGPRel32Value - Emit the expression @p Value into the output as a
568eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// gprel32 (32-bit GP relative) value.
569eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  ///
570eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// This is used to implement assembler directives such as .gprel32 on
571eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// targets that support them.
572eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  virtual void EmitGPRel32Value(const MCExpr *Value);
573eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
574eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// EmitFill - Emit NumBytes bytes worth of the value specified by
575eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// FillValue.  This implements directives such as '.space'.
576eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  virtual void EmitFill(uint64_t NumBytes, uint8_t FillValue);
577eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
578eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// \brief Emit NumBytes worth of zeros.
579eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// This function properly handles data in virtual sections.
580eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  virtual void EmitZeros(uint64_t NumBytes);
581eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
582eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// EmitValueToAlignment - Emit some number of copies of @p Value until
583eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// the byte alignment @p ByteAlignment is reached.
584eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  ///
585eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// If the number of bytes need to emit for the alignment is not a multiple
586eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// of @p ValueSize, then the contents of the emitted fill bytes is
5872a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// undefined.
5882a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  ///
5892a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// This used to implement the .align assembler directive.
5902a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  ///
5912a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// @param ByteAlignment - The alignment to reach. This must be a power of
5922a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// two on some targets.
5932a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// @param Value - The value to use when filling bytes.
5942a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// @param ValueSize - The size of the integer (in bytes) to emit for
5952a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// @p Value. This must match a native machine width.
5962a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// @param MaxBytesToEmit - The maximum numbers of bytes to emit, or 0. If
5972a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// the alignment cannot be reached in this many bytes, no bytes are
5982a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// emitted.
5992a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
6002a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                    unsigned ValueSize = 1,
6012a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                    unsigned MaxBytesToEmit = 0) = 0;
6022a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
6032a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// EmitCodeAlignment - Emit nops until the byte alignment @p ByteAlignment
6042a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// is reached.
6052a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  ///
6062a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// This used to align code where the alignment bytes may be executed.  This
6072a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// can emit different bytes for different sizes to optimize execution.
6082a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  ///
6092a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// @param ByteAlignment - The alignment to reach. This must be a power of
6102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// two on some targets.
6112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// @param MaxBytesToEmit - The maximum numbers of bytes to emit, or 0. If
6122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// the alignment cannot be reached in this many bytes, no bytes are
613eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// emitted.
614eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  virtual void EmitCodeAlignment(unsigned ByteAlignment,
615eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch                                 unsigned MaxBytesToEmit = 0) = 0;
6162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
617eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// EmitValueToOffset - Emit some number of copies of @p Value until the
618eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// byte offset @p Offset is reached.
619eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  ///
620eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// This is used to implement assembler directives such as .org.
621eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  ///
6222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// @param Offset - The offset to reach. This may be an expression, but the
6232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// expression must be associated with the current section.
6242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// @param Value - The value to use when filling bytes.
6252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// @return false on success, true if the offset was invalid.
626eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  virtual bool EmitValueToOffset(const MCExpr *Offset,
627eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch                                 unsigned char Value = 0) = 0;
628eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
629eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// @}
630eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
631eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// EmitFileDirective - Switch to a new logical file.  This is used to
632eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// implement the '.file "foo.c"' assembler directive.
633eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  virtual void EmitFileDirective(StringRef Filename) = 0;
634eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
635eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// Emit the "identifiers" directive.  This implements the
636eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// '.ident "version foo"' assembler directive.
637eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  virtual void EmitIdent(StringRef IdentString) {}
638eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
639eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// EmitDwarfFileDirective - Associate a filename with a specified logical
640eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// file number.  This implements the DWARF2 '.file 4 "foo.c"' assembler
641eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /// directive.
6422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual unsigned EmitDwarfFileDirective(unsigned FileNo, StringRef Directory,
6432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                          StringRef Filename,
6442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                          unsigned CUID = 0);
6452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
6462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /// EmitDwarfLocDirective - This implements the DWARF2
6472a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // '.loc fileno lineno ...' assembler directive.
6482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
6492a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                     unsigned Column, unsigned Flags,
6502a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                     unsigned Isa, unsigned Discriminator,
6512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                     StringRef FileName);
6522a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
6532a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual MCSymbol *getDwarfLineTableSymbol(unsigned CUID);
6542a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
6552a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  void EmitDwarfSetLineAddr(int64_t LineDelta, const MCSymbol *Label,
6562a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                            int PointerSize);
6572a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
658f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void EmitCompactUnwindEncoding(uint32_t CompactUnwindEncoding);
659f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void EmitCFISections(bool EH, bool Debug);
660f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  void EmitCFIStartProc(bool IsSimple);
661f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  void EmitCFIEndProc();
662f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void EmitCFIDefCfa(int64_t Register, int64_t Offset);
6632a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void EmitCFIDefCfaOffset(int64_t Offset);
6642a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void EmitCFIDefCfaRegister(int64_t Register);
6652a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void EmitCFIOffset(int64_t Register, int64_t Offset);
6662a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void EmitCFIPersonality(const MCSymbol *Sym, unsigned Encoding);
6671e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  virtual void EmitCFILsda(const MCSymbol *Sym, unsigned Encoding);
6681e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  virtual void EmitCFIRememberState();
6692a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void EmitCFIRestoreState();
6702a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void EmitCFISameValue(int64_t Register);
671f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void EmitCFIRestore(int64_t Register);
672f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void EmitCFIRelOffset(int64_t Register, int64_t Offset);
673f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void EmitCFIAdjustCfaOffset(int64_t Adjustment);
674f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void EmitCFIEscape(StringRef Values);
675f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void EmitCFISignalFrame();
676f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void EmitCFIUndefined(int64_t Register);
677f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void EmitCFIRegister(int64_t Register1, int64_t Register2);
678f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void EmitCFIWindowSave();
679f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
680f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void EmitWin64EHStartProc(const MCSymbol *Symbol);
681f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void EmitWin64EHEndProc();
682f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void EmitWin64EHStartChained();
683f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void EmitWin64EHEndChained();
684f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void EmitWin64EHHandler(const MCSymbol *Sym, bool Unwind,
685f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)                                  bool Except);
686f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void EmitWin64EHHandlerData();
6872a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void EmitWin64EHPushReg(unsigned Register);
6882a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void EmitWin64EHSetFrame(unsigned Register, unsigned Offset);
6892a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void EmitWin64EHAllocStack(unsigned Size);
690f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void EmitWin64EHSaveReg(unsigned Register, unsigned Offset);
691f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void EmitWin64EHSaveXMM(unsigned Register, unsigned Offset);
692f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void EmitWin64EHPushFrame(bool Code);
693f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void EmitWin64EHEndProlog();
694f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
695f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  /// EmitInstruction - Emit the given @p Instruction into the current
696f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  /// section.
697f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) = 0;
698f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
699f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  /// \brief Set the bundle alignment mode from now on in the section.
700f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  /// The argument is the power of 2 to which the alignment is set. The
701f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  /// value 0 means turn the bundle alignment off.
702f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void EmitBundleAlignMode(unsigned AlignPow2) = 0;
703f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
704f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  /// \brief The following instructions are a bundle-locked group.
705f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  ///
706f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  /// \param AlignToEnd - If true, the bundle-locked group will be aligned to
707f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  ///                     the end of a bundle.
708f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void EmitBundleLock(bool AlignToEnd) = 0;
709f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
710f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  /// \brief Ends a bundle-locked group.
711f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void EmitBundleUnlock() = 0;
712f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
713f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  /// EmitRawText - If this file is backed by a assembly streamer, this dumps
714f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  /// the specified string in the output .s file.  This capability is
715f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  /// indicated by the hasRawTextSupport() predicate.  By default this aborts.
716f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  void EmitRawText(const Twine &String);
717f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
718f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  /// Flush - Causes any cached state to be written out.
719f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void Flush() {}
720f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
721f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  /// FinishImpl - Streamer specific finalization.
722f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void FinishImpl() = 0;
723f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  /// Finish - Finish emission of machine code.
724f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  void Finish();
725f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)};
726f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
727f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)/// createNullStreamer - Create a dummy machine code streamer, which does
728f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)/// nothing. This is useful for timing the assembler front end.
729f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)MCStreamer *createNullStreamer(MCContext &Ctx);
730f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
731f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)/// createAsmStreamer - Create a machine code streamer which will print out
732f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)/// assembly for the native target, suitable for compiling with a native
7332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/// assembler.
7342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)///
735f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)/// \param InstPrint - If given, the instruction printer to use. If not given
7362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/// the MCInst representation will be printed.  This method takes ownership of
7372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/// InstPrint.
7382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)///
739f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)/// \param CE - If given, a code emitter to use to show the instruction
740f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)/// encoding inline with the assembly. This method takes ownership of \p CE.
741f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)///
742f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)/// \param TAB - If given, a target asm backend to use to show the fixup
743f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)/// information in conjunction with encoding information. This method takes
744f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)/// ownership of \p TAB.
745f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)///
746f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)/// \param ShowInst - Whether to show the MCInst representation inline with
747f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)/// the assembly.
748f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)MCStreamer *createAsmStreamer(MCContext &Ctx, formatted_raw_ostream &OS,
749f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)                              bool isVerboseAsm, bool useDwarfDirectory,
750f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)                              MCInstPrinter *InstPrint, MCCodeEmitter *CE,
751f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)                              MCAsmBackend *TAB, bool ShowInst);
752f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
753f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)/// createMachOStreamer - Create a machine code streamer which will generate
754f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)/// Mach-O format object files.
755f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)///
756f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)/// Takes ownership of \p TAB and \p CE.
757f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)MCStreamer *createMachOStreamer(MCContext &Ctx, MCAsmBackend &TAB,
758f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)                                raw_ostream &OS, MCCodeEmitter *CE,
759f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)                                bool RelaxAll = false,
760f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)                                bool LabelSections = false);
761f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
762f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)/// createELFStreamer - Create a machine code streamer which will generate
763f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)/// ELF format object files.
764f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)MCStreamer *createELFStreamer(MCContext &Ctx, MCAsmBackend &TAB,
765f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)                              raw_ostream &OS, MCCodeEmitter *CE, bool RelaxAll,
766f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)                              bool NoExecStack);
767f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
7682a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} // end namespace llvm
769f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
7702a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#endif
771f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)