15 #ifndef LLVM_MC_MCDWARF_H
16 #define LLVM_MC_MCDWARF_H
28 template <
typename T>
class ArrayRef;
32 class MCObjectStreamer;
64 #define DWARF2_LINE_DEFAULT_IS_STMT 1
66 #define DWARF2_FLAG_IS_STMT (1 << 0)
67 #define DWARF2_FLAG_BASIC_BLOCK (1 << 1)
68 #define DWARF2_FLAG_PROLOGUE_END (1 << 2)
69 #define DWARF2_FLAG_EPILOGUE_BEGIN (1 << 3)
74 MCDwarfLoc(
unsigned fileNum,
unsigned line,
unsigned column,
unsigned flags,
75 unsigned isa,
unsigned discriminator)
76 : FileNum(fileNum), Line(line), Column(column),
Flags(flags), Isa(isa),
77 Discriminator(discriminator) {}
96 unsigned getIsa()
const {
return Isa; }
109 assert(column <= UINT16_MAX);
115 assert(flags <= UINT8_MAX);
127 Discriminator = discriminator;
164 MCLineDivisions[Sec].push_back(LineEntry);
168 typedef MCDwarfLineEntryCollection::iterator
iterator;
179 return MCLineDivisions;
205 unsigned FileNumber = 0);
208 std::pair<MCSymbol *, MCSymbol *>
220 return Header.
getFile(Directory, FileName);
237 unsigned FileNumber = 0);
244 Header.
Label = Label;
268 return MCLineSections;
271 return MCLineSections;
279 int64_t LineDelta, uint64_t AddrDelta,
raw_ostream &OS);
283 int64_t LineDelta, uint64_t AddrDelta);
311 : Name(name), FileNumber(fileNumber), LineNumber(lineNumber),
353 std::vector<char> Values;
356 : Operation(Op), Label(L), Register(R),
Offset(O),
362 : Operation(Op), Label(L), Register(R1),
Register2(R2) {
486 return StringRef(&Values[0], Values.size());
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
static void Make(MCObjectStreamer *MCOS, MCSection *Section)
unsigned getColumn() const
Get the Column of this MCDwarfLoc.
SmallVectorImpl< std::string > & getMCDwarfDirs()
MCDwarfLineEntryCollection::iterator iterator
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
MCDwarfLineEntryCollection::const_iterator const_iterator
unsigned CurrentCfaRegister
unsigned getFileNum() const
Get the FileNum of this MCDwarfLoc.
static void EmitAdvanceLoc(MCObjectStreamer &Streamer, uint64_t AddrDelta)
const_iterator begin(StringRef path)
Get begin iterator over path.
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...
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.
MapVector< MCSection *, MCDwarfLineEntryCollection > MCLineDivisionMap
struct fuzzer::@269 Flags
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.
Function Alias Analysis false
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
std::vector< MCDwarfLineEntry > MCDwarfLineEntryCollection
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
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)
Instances of this class represent the line information for the dwarf line table entries.
static void Emit(MCObjectStreamer *MCOS, MCDwarfLineTableParams Params)
void Emit(MCStreamer &MCOS, MCDwarfLineTableParams Params) const
MCLineSection & getMCLineSections()
const MCLineSection & getMCLineSections() const
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.