15 #ifndef LLVM_MC_MCDWARF_H
16 #define LLVM_MC_MCDWARF_H
31 template <
typename T>
class ArrayRef;
34 class MCObjectStreamer;
67 #define DWARF2_LINE_DEFAULT_IS_STMT 1
69 #define DWARF2_FLAG_IS_STMT (1 << 0)
70 #define DWARF2_FLAG_BASIC_BLOCK (1 << 1)
71 #define DWARF2_FLAG_PROLOGUE_END (1 << 2)
72 #define DWARF2_FLAG_EPILOGUE_BEGIN (1 << 3)
78 MCDwarfLoc(
unsigned fileNum,
unsigned line,
unsigned column,
unsigned flags,
79 unsigned isa,
unsigned discriminator)
80 : FileNum(fileNum), Line(line), Column(column),
Flags(flags), Isa(isa),
81 Discriminator(discriminator) {}
113 assert(column <= UINT16_MAX);
119 assert(flags <= UINT8_MAX);
131 Discriminator = discriminator;
168 MCLineDivisions[Sec].push_back(LineEntry);
172 using iterator = MCDwarfLineEntryCollection::iterator;
183 return MCLineDivisions;
210 unsigned FileNumber = 0);
213 std::pair<MCSymbol *, MCSymbol *>
227 return Header.
getFile(Directory, FileName);
245 unsigned FileNumber = 0);
252 Header.
Label = Label;
276 return MCLineSections;
279 return MCLineSections;
287 int64_t LineDelta, uint64_t AddrDelta,
raw_ostream &OS);
291 int64_t LineDelta, uint64_t AddrDelta);
319 : Name(name), FileNumber(fileNumber), LineNumber(lineNumber),
361 std::vector<char> Values;
364 : Operation(Op), Label(L), Register(R),
Offset(O),
370 : Operation(Op), Label(L), Register(R1),
Register2(R2) {
494 return StringRef(&Values[0], Values.size());
527 #endif // LLVM_MC_MCDWARF_H
void setCompilationDir(StringRef CompilationDir)
Instances of this class represent a uniqued identifier for a section in the current translation unit...
const_iterator end(StringRef path)
Get end iterator over path.
unsigned getFileNumber() const
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
MCDwarfLineEntryCollection::iterator iterator
static void Make(MCObjectStreamer *MCOS, MCSection *Section)
unsigned getColumn() const
Get the Column of this MCDwarfLoc.
SmallVectorImpl< std::string > & getMCDwarfDirs()
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
static MCCFIInstruction createRememberState(MCSymbol *L)
.cfi_remember_state Save all current rules for all registers.
static MCCFIInstruction createOffset(MCSymbol *L, unsigned Register, int Offset)
.cfi_offset Previous value of Register is saved at offset Offset from CFA.
MCSymbol * getLabel() const
unsigned CurrentCfaRegister
unsigned getFileNum() const
Get the FileNum of this MCDwarfLoc.
static void EmitAdvanceLoc(MCObjectStreamer &Streamer, uint64_t AddrDelta)
SmallVectorImpl< MCDwarfFile > & getMCDwarfFiles()
MCSymbol * getLabel() const
static void Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params, int64_t LineDelta, uint64_t AddrDelta)
Utility function to emit the encoding to a streamer.
void setIsa(unsigned isa)
Set the Isa of this MCDwarfLoc.
static MCCFIInstruction createDefCfaOffset(MCSymbol *L, int Offset)
.cfi_def_cfa_offset modifies a rule for computing CFA.
static MCCFIInstruction createAdjustCfaOffset(MCSymbol *L, int Adjustment)
.cfi_adjust_cfa_offset Same as .cfi_def_cfa_offset, but Offset is a relative value that is added/subt...
std::vector< MCDwarfLineEntry > MCDwarfLineEntryCollection
static void Encode(MCContext &Context, MCDwarfLineTableParams Params, int64_t LineDelta, uint64_t AddrDelta, raw_ostream &OS)
Utility function to encode a Dwarf pair of LineDelta and AddrDeltas.
unsigned getRegister() const
MCDwarfLineEntry(MCSymbol *label, const MCDwarfLoc loc)
std::vector< MCCFIInstruction > Instructions
static MCCFIInstruction createUndefined(MCSymbol *L, unsigned Register)
.cfi_undefined From now on the previous value of Register can't be restored anymore.
unsigned getDiscriminator() const
Get the Discriminator of this MCDwarfLoc.
unsigned getLineNumber() const
uint8_t DWARF2LineRange
Range of line offsets in a special line info. opcode.
Context object for machine code objects.
StringRef getValues() const
void setLine(unsigned line)
Set the Line of this MCDwarfLoc.
const SmallVectorImpl< MCDwarfFile > & getMCDwarfFiles() const
Streaming object file generation interface.
Instances of this class represent the information from a dwarf .loc directive.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
unsigned getLine() const
Get the Line of this MCDwarfLoc.
void EmitCU(MCObjectStreamer *MCOS, MCDwarfLineTableParams Params) const
static MCCFIInstruction createSameValue(MCSymbol *L, unsigned Register)
.cfi_same_value Current value of Register is the same as in the previous frame.
Streaming machine code generation interface.
unsigned getFile(StringRef Directory, StringRef FileName)
uint8_t DWARF2LineOpcodeBase
First special line opcode - leave room for the standard opcodes.
static MCCFIInstruction createDefCfa(MCSymbol *L, unsigned Register, int Offset)
.cfi_def_cfa defines a rule for computing CFA as: take address from Register and add Offset to it...
static MCCFIInstruction createDefCfaRegister(MCSymbol *L, unsigned Register)
.cfi_def_cfa_register modifies a rule for computing CFA.
Instances of this class represent the line information for a compile unit where machine instructions ...
static MCCFIInstruction createWindowSave(MCSymbol *L)
.cfi_window_save SPARC register window is saved.
void addLineEntry(const MCDwarfLineEntry &LineEntry, MCSection *Sec)
static MCCFIInstruction createGnuArgsSize(MCSymbol *L, int Size)
A special wrapper for .cfi_escape that indicates GNU_ARGS_SIZE.
const SmallVectorImpl< std::string > & getMCDwarfDirs() const
void setCompilationDir(StringRef CompilationDir)
static MCCFIInstruction createRelOffset(MCSymbol *L, unsigned Register, int Offset)
.cfi_rel_offset Previous value of Register is saved at offset Offset from the current CFA register...
static MCCFIInstruction createRestore(MCSymbol *L, unsigned Register)
.cfi_restore says that the rule for Register is now the same as it was at the beginning of the functi...
unsigned PersonalityEncoding
This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling...
static MCCFIInstruction createRestoreState(MCSymbol *L)
.cfi_restore_state Restore the previously saved state.
int8_t DWARF2LineBase
Minimum line offset in a special line info.
unsigned getIsa() const
Get the Isa of this MCDwarfLoc.
OpType getOperation() const
MCDwarfLineEntryCollection::const_iterator const_iterator
unsigned getRegister2() const
static void EncodeAdvanceLoc(MCContext &Context, uint64_t AddrDelta, raw_ostream &OS)
LLVM_NODISCARD bool isa(const Y &Val)
uint32_t CompactUnwindEncoding
unsigned getFlags() const
Get the Flags of this MCDwarfLoc.
static void Emit(MCStreamer *MCOS)
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
Instances of this class represent the line information for the dwarf line table entries.
static void Emit(MCObjectStreamer *MCOS, MCDwarfLineTableParams Params)
static std::vector< std::string > Flags
void Emit(MCStreamer &MCOS, MCDwarfLineTableParams Params) const
MCLineSection & getMCLineSections()
const MCLineSection & getMCLineSections() const
MCDwarfFrameInfo()=default
static void Make(MCSymbol *Symbol, MCStreamer *MCOS, SourceMgr &SrcMgr, SMLoc &Loc)
const MCSymbol * Personality
void setFileNum(unsigned fileNum)
Set the FileNum of this MCDwarfLoc.
void setFlags(unsigned flags)
Set the Flags of this MCDwarfLoc.
const MCLineDivisionMap & getMCLineEntries() const
MCGenDwarfLabelEntry(StringRef name, unsigned fileNumber, unsigned lineNumber, MCSymbol *label)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
StringRef getName() const
Generic interface to target specific assembler backends.
This class implements an extremely fast bulk output stream that can only output to a stream...
void setColumn(unsigned column)
Set the Column of this MCDwarfLoc.
static void Emit(MCObjectStreamer &streamer, MCAsmBackend *MAB, bool isEH)
StringRef - Represent a constant reference to a string, i.e.
MCSymbol * getLabel() const
Instances of this class represent the name of the dwarf .file directive and its associated dwarf file...
Represents a location in source code.
unsigned getFile(StringRef &Directory, StringRef &FileName, unsigned FileNumber=0)
static MCCFIInstruction createEscape(MCSymbol *L, StringRef Vals)
.cfi_escape Allows the user to add arbitrary bytes to the unwind info.
MCSymbol * getLabel() const
void setDiscriminator(unsigned discriminator)
Set the Discriminator of this MCDwarfLoc.
void setLabel(MCSymbol *Label)
static MCCFIInstruction createRegister(MCSymbol *L, unsigned Register1, unsigned Register2)
.cfi_register Previous value of Register1 is saved in register Register2.