21 #define DEBUG_TYPE "faultmaps"
24 const char *FaultMaps::WFMP =
"Fault Maps: ";
43 FunctionInfos[AP.
CurrentFnSym].emplace_back(FaultTy, FaultingOffset,
48 if (FunctionInfos.empty())
62 DEBUG(
dbgs() <<
"********** Fault Map Output **********\n");
69 DEBUG(
dbgs() << WFMP <<
"#functions = " << FunctionInfos.size() <<
"\n");
74 for (
const auto &FFI : FunctionInfos)
75 emitFunctionInfo(FFI.first, FFI.second);
78 void FaultMaps::emitFunctionInfo(
const MCSymbol *FnLabel,
79 const FunctionFaultInfos &FFI) {
82 DEBUG(
dbgs() << WFMP <<
" function addr: " << *FnLabel <<
"\n");
85 DEBUG(
dbgs() << WFMP <<
" #faulting PCs: " << FFI.size() <<
"\n");
90 for (
auto &
Fault : FFI) {
95 DEBUG(
dbgs() << WFMP <<
" faulting PC offset: "
96 << *
Fault.FaultingOffsetExpr <<
"\n");
99 DEBUG(
dbgs() << WFMP <<
" fault handler PC offset: "
100 << *
Fault.HandlerOffsetExpr <<
"\n");
112 return "FaultingLoad";
Instances of this class represent a uniqued identifier for a section in the current translation unit...
std::unique_ptr< MCStreamer > OutStreamer
This is the MCStreamer object for the file we are generating.
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
void EmitSymbolValue(const MCSymbol *Sym, unsigned Size, bool IsSectionRelative=false)
Special case of EmitValue that avoids the client having to pass in a MCExpr for MCSymbols.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
FormattedNumber format_hex(uint64_t N, unsigned Width, bool Upper=false)
format_hex - Output N as a fixed width hexadecimal.
FunctionInfoAccessor getFirstFunctionInfo() const
MCSection * getFaultMapSection() const
FaultingPCOffsetType getFaultingPCOffset() const
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Base class for the full range of assembler expressions which are needed for parsing.
Context object for machine code objects.
void recordFaultingOp(FaultKind FaultTy, const MCSymbol *HandlerLabel)
NumFaultingPCsType getNumFaultingPCs() const
static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
HandlerPCOffsetType getHandlerPCOffset() const
virtual void EmitIntValue(uint64_t Value, unsigned Size)
Special case of EmitValue that avoids the client having to pass in a MCExpr for constant integers...
void EmitValue(const MCExpr *Value, unsigned Size, SMLoc Loc=SMLoc())
static const int FaultMapVersion
FaultMaps(AsmPrinter &AP)
Streaming machine code generation interface.
MCSymbol * createTempSymbol(bool CanBeUnnamed=true)
Create and return a new assembler temporary symbol with a unique but unspecified name.
MCSymbol * CurrentFnSym
The symbol for the current function.
virtual void SwitchSection(MCSection *Section, const MCExpr *Subsection=nullptr)
Set the current section where code is being emitted to Section.
FunctionFaultInfoAccessor getFunctionFaultInfoAt(uint32_t Index) const
This class is intended to be used as a driving class for all asm writers.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
FaultKindType getFaultKind() const
A parser for the __llvm_faultmaps section generated by the FaultMaps class above. ...
virtual void EmitLabel(MCSymbol *Symbol)
Emit a label for Symbol into the current section.
void serializeToFaultMapSection()
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
NumFunctionsType getNumFunctions() const
FaultMapVersionType getFaultMapVersion() const
static const char * faultTypeToString(FaultKind)
MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
FunctionInfoAccessor getNextFunctionInfo() const
FunctionAddrType getFunctionAddr() const
const MCObjectFileInfo * getObjectFileInfo() const
This class implements an extremely fast bulk output stream that can only output to a stream...
MCSymbol * CurrentFnSymForSize
The symbol used to represent the start of the current function for the purpose of calculating its siz...