#ifndef LLVM_CODEGEN_ASMPRINTER_H
#define LLVM_CODEGEN_ASMPRINTER_H
+#include "llvm/ADT/Twine.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/Support/DataTypes.h"
namespace llvm {
class AsmPrinterHandler;
class BlockAddress;
+ class ByteStreamer;
class GCStrategy;
class Constant;
class ConstantArray;
public:
virtual ~AsmPrinter();
- const DwarfDebug *getDwarfDebug() const { return DD; }
+ DwarfDebug *getDwarfDebug() { return DD; }
/// isVerbose - Return true if assembly output should contain comments.
///
/// getCurrentSection() - Return the current section we are emitting to.
const MCSection *getCurrentSection() const;
+ void getNameWithPrefix(SmallVectorImpl<char> &Name,
+ const GlobalValue *GV) const;
+
MCSymbol *getSymbol(const GlobalValue *GV) const;
//===------------------------------------------------------------------===//
/// getAnalysisUsage - Record analysis usage.
///
- void getAnalysisUsage(AnalysisUsage &AU) const;
+ void getAnalysisUsage(AnalysisUsage &AU) const override;
/// doInitialization - Set up the AsmPrinter when we are working on a new
/// module. If your pass overrides this, it must make sure to explicitly
/// call this implementation.
- bool doInitialization(Module &M);
+ bool doInitialization(Module &M) override;
/// doFinalization - Shut down the asmprinter. If you override this in your
/// pass, you must make sure to call it explicitly.
- bool doFinalization(Module &M);
+ bool doFinalization(Module &M) override;
/// runOnMachineFunction - Emit the specified function out to the
/// OutStreamer.
- virtual bool runOnMachineFunction(MachineFunction &MF) {
+ bool runOnMachineFunction(MachineFunction &MF) override {
SetupMachineFunction(MF);
EmitFunctionHeader();
EmitFunctionBody();
/// function.
void EmitFunctionBody();
- void emitPrologLabel(const MachineInstr &MI);
+ void emitCFIInstruction(const MachineInstr &MI);
enum CFIMoveType {
CFI_M_None,
/// an explicit alignment requested, it will override the alignment request
/// if required for correctness.
///
- void EmitAlignment(unsigned NumBits, const GlobalValue *GV = 0) const;
+ void EmitAlignment(unsigned NumBits, const GlobalValue *GV = nullptr) const;
/// EmitBasicBlockStart - This method prints the label for the specified
/// MachineBasicBlock, an alignment (if present) and a comment describing
/// it if appropriate.
- void EmitBasicBlockStart(const MachineBasicBlock *MBB) const;
+ void EmitBasicBlockStart(const MachineBasicBlock &MBB) const;
/// \brief Print a general LLVM constant to the .s file.
void EmitGlobalConstant(const Constant *CV);
llvm_unreachable("EmitInstruction not implemented");
}
+ /// GetCPISymbol - Return the symbol for the specified constant pool entry.
+ virtual MCSymbol *GetCPISymbol(unsigned CPID) const;
+
virtual void EmitFunctionEntryLabel();
virtual void EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV);
/// GetTempSymbol - Return the MCSymbol corresponding to the assembler
/// temporary label with the specified stem and unique ID.
- MCSymbol *GetTempSymbol(StringRef Name, unsigned ID) const;
+ MCSymbol *GetTempSymbol(Twine Name, unsigned ID) const;
/// GetTempSymbol - Return an assembler temporary label with the specified
/// stem.
- MCSymbol *GetTempSymbol(StringRef Name) const;
+ MCSymbol *GetTempSymbol(Twine Name) const;
/// Return the MCSymbol for a private symbol with global value name as its
/// base, with the specified suffix.
/// ExternalSymbol.
MCSymbol *GetExternalSymbolSymbol(StringRef Sym) const;
- /// GetCPISymbol - Return the symbol for the specified constant pool entry.
- MCSymbol *GetCPISymbol(unsigned CPID) const;
-
/// GetJTISymbol - Return the symbol for the specified jump table entry.
MCSymbol *GetJTISymbol(unsigned JTID, bool isLinkerPrivate = false) const;
//===------------------------------------------------------------------===//
/// EmitSLEB128 - emit the specified signed leb128 value.
- void EmitSLEB128(int64_t Value, const char *Desc = 0) const;
+ void EmitSLEB128(int64_t Value, const char *Desc = nullptr) const;
/// EmitULEB128 - emit the specified unsigned leb128 value.
- void EmitULEB128(uint64_t Value, const char *Desc = 0,
+ void EmitULEB128(uint64_t Value, const char *Desc = nullptr,
unsigned PadTo = 0) const;
/// EmitCFAByte - Emit a .byte 42 directive for a DW_CFA_xxx value.
/// encoding. If verbose assembly output is enabled, we output comments
/// describing the encoding. Desc is a string saying what the encoding is
/// specifying (e.g. "LSDA").
- void EmitEncodingByte(unsigned Val, const char *Desc = 0) const;
+ void EmitEncodingByte(unsigned Val, const char *Desc = nullptr) const;
/// GetSizeOfEncodedValue - Return the size of the encoding in bytes.
unsigned GetSizeOfEncodedValue(unsigned Encoding) const;
/// encoding specified.
virtual unsigned getISAEncoding() { return 0; }
+ /// \brief Emit a partial dwarf register operation.
+ /// \param MLoc the register
+ /// \param PieceSizeInBits size and
+ /// \param PieceOffsetBits offset of the piece in bits, if this is one
+ /// piece of an aggregate value.
+ void EmitDwarfRegOpPiece(ByteStreamer &BS, const MachineLocation &MLoc,
+ unsigned PieceSize,
+ unsigned PieceOffset) const;
+
/// EmitDwarfRegOp - Emit dwarf register operation.
- virtual void EmitDwarfRegOp(const MachineLocation &MLoc,
+ /// \param Indirect whether this is a register-indirect address
+ virtual void EmitDwarfRegOp(ByteStreamer &BS, const MachineLocation &MLoc,
bool Indirect) const;
//===------------------------------------------------------------------===//
/// \p EndInfo - the final subtarget info after parsing the inline asm,
/// or NULL if the value is unknown.
virtual void emitInlineAsmEnd(const MCSubtargetInfo &StartInfo,
- MCSubtargetInfo *EndInfo) const;
+ const MCSubtargetInfo *EndInfo) const;
private:
/// Private state for PrintSpecial()
mutable unsigned SetCounter;
/// EmitInlineAsm - Emit a blob of inline asm to the output streamer.
- void EmitInlineAsm(StringRef Str, const MDNode *LocMDNode = 0,
+ void EmitInlineAsm(StringRef Str, const MDNode *LocMDNode = nullptr,
InlineAsm::AsmDialect AsmDialect =
InlineAsm::AD_ATT) const;
/// Emit llvm.ident metadata in an '.ident' directive.
void EmitModuleIdents(Module &M);
void EmitXXStructorList(const Constant *List, bool isCtor);
- GCMetadataPrinter *GetOrCreateGCPrinter(GCStrategy *C);
+ GCMetadataPrinter *GetOrCreateGCPrinter(GCStrategy &C);
};
}