24 #define DEBUG_TYPE "faultmaps" 27 const char *FaultMaps::WFMP =
"Fault Maps: ";
46 FunctionInfos[AP.
CurrentFnSym].emplace_back(FaultTy, FaultingOffset,
51 if (FunctionInfos.empty())
72 LLVM_DEBUG(
dbgs() << WFMP <<
"#functions = " << FunctionInfos.size() <<
"\n");
77 for (
const auto &FFI : FunctionInfos)
78 emitFunctionInfo(FFI.first, FFI.second);
81 void FaultMaps::emitFunctionInfo(
const MCSymbol *FnLabel,
82 const FunctionFaultInfos &FFI) {
85 LLVM_DEBUG(
dbgs() << WFMP <<
" function addr: " << *FnLabel <<
"\n");
88 LLVM_DEBUG(
dbgs() << WFMP <<
" #faulting PCs: " << FFI.size() <<
"\n");
93 for (
auto &
Fault : FFI) {
99 << *
Fault.FaultingOffsetExpr <<
"\n");
103 << *
Fault.HandlerOffsetExpr <<
"\n");
113 return "FaultingLoad";
115 return "FaultingLoadStore";
117 return "FaultingStore";
Instances of this class represent a uniqued identifier for a section in the current translation unit...
FaultingPCOffsetType getFaultingPCOffset() const
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)
This class represents lattice values for constants.
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.
HandlerPCOffsetType getHandlerPCOffset() const
FunctionAddrType getFunctionAddr() const
FaultKindType getFaultKind() 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.
FunctionInfoAccessor getFirstFunctionInfo() const
Context object for machine code objects.
void recordFaultingOp(FaultKind FaultTy, const MCSymbol *HandlerLabel)
static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
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
NumFunctionsType getNumFunctions() const
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.
This class is intended to be used as a driving class for all asm writers.
const MCObjectFileInfo * getObjectFileInfo() const
FunctionFaultInfoAccessor getFunctionFaultInfoAt(uint32_t Index) const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
A parser for the __llvm_faultmaps section generated by the FaultMaps class above. ...
void serializeToFaultMapSection()
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
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)
MCSection * getFaultMapSection() const
FaultMapVersionType getFaultMapVersion() const
virtual void EmitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc())
Emit a label for Symbol into the current section.
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...
NumFaultingPCsType getNumFaultingPCs() const
FunctionInfoAccessor getNextFunctionInfo() const