LLVM: lib/CodeGen/FaultMaps.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

18

19using namespace llvm;

20

21#define DEBUG_TYPE "faultmaps"

22

24const char *FaultMaps::WFMP = "Fault Maps: ";

25

27

29 const MCSymbol *FaultingLabel,

30 const MCSymbol *HandlerLabel) {

31 MCContext &OutContext = AP.OutStreamer->getContext();

32

36

40

41 FunctionInfos[AP.CurrentFnSym].emplace_back(FaultTy, FaultingOffset,

42 HandlerOffset);

43}

44

46 if (FunctionInfos.empty())

47 return;

48

49 MCContext &OutContext = AP.OutStreamer->getContext();

51

52

56

57

59

60 LLVM_DEBUG(dbgs() << "********** Fault Map Output **********\n");

61

62

66

67 LLVM_DEBUG(dbgs() << WFMP << "#functions = " << FunctionInfos.size() << "\n");

68 OS.emitInt32(FunctionInfos.size());

69

71

72 for (const auto &FFI : FunctionInfos)

73 emitFunctionInfo(FFI.first, FFI.second);

74}

75

76void FaultMaps::emitFunctionInfo(const MCSymbol *FnLabel,

77 const FunctionFaultInfos &FFI) {

79

80 LLVM_DEBUG(dbgs() << WFMP << " function addr: " << *FnLabel << "\n");

82

83 LLVM_DEBUG(dbgs() << WFMP << " #faulting PCs: " << FFI.size() << "\n");

85

87

88 for (const auto &Fault : FFI) {

92 }

93}

94

96 switch (FT) {

97 default:

100 return "FaultingLoad";

102 return "FaultingLoadStore";

104 return "FaultingStore";

105 }

106}

static const int FaultMapVersion

Definition FaultMaps.cpp:23

This class is intended to be used as a driving class for all asm writers.

std::unique_ptr< MCStreamer > OutStreamer

This is the MCStreamer object for the file we are generating.

void recordFaultingOp(FaultKind FaultTy, const MCSymbol *FaultingLabel, const MCSymbol *HandlerLabel)

Definition FaultMaps.cpp:28

void serializeToFaultMapSection()

Definition FaultMaps.cpp:45

FaultMaps(AsmPrinter &AP)

Definition FaultMaps.cpp:26

static const char * faultTypeToString(FaultKind)

Definition FaultMaps.cpp:95

static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)

Context object for machine code objects.

const MCObjectFileInfo * getObjectFileInfo() const

LLVM_ABI MCSymbol * getOrCreateSymbol(const Twine &Name)

Lookup the symbol inside with the specified Name.

Base class for the full range of assembler expressions which are needed for parsing.

MCSection * getFaultMapSection() const

Instances of this class represent a uniqued identifier for a section in the current translation unit.

Streaming machine code generation interface.

void emitValue(const MCExpr *Value, unsigned Size, SMLoc Loc=SMLoc())

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.

virtual void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc())

Emit a label for Symbol into the current section.

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 emitInt16(uint64_t Value)

virtual void switchSection(MCSection *Section, uint32_t Subsec=0)

Set the current section where code is being emitted to Section.

void emitInt32(uint64_t Value)

static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx, SMLoc Loc=SMLoc())

MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...

Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...

#define llvm_unreachable(msg)

Marks that the current location is not supposed to be reachable.

This is an optimization pass for GlobalISel generic memory operations.

LLVM_ABI raw_ostream & dbgs()

dbgs() - This returns a reference to a raw_ostream for debugging messages.