LLVM: lib/DebugInfo/DWARF/DWARFCFIPrinter.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

17#include

18#include

19#include

20#include

21

22using namespace llvm;

23using namespace dwarf;

24

26 unsigned RegNum) {

31 return;

32 }

33 }

34 OS << "reg" << RegNum;

35}

36

37

41 unsigned OperandIdx, uint64_t Operand,

42 std::optional<uint64_t> &Address) {

44 uint8_t Opcode = Instr.Opcode;

46

47 switch (Type) {

49 OS << " Unsupported " << (OperandIdx ? "second" : "first") << " operand to";

50 auto OpcodeName = P.callFrameString(Opcode);

51 if (!OpcodeName.empty())

52 OS << " " << OpcodeName;

53 else

54 OS << format(" Opcode %x", Opcode);

55 break;

56 }

58 break;

60 OS << format(" %" PRIx64, Operand);

61 Address = Operand;

62 break;

64

65

66

67 OS << format(" %+" PRId64, int64_t(Operand));

68 break;

70 if (P.codeAlign())

71 OS << format(" %" PRId64, Operand * P.codeAlign());

72 else

73 OS << format(" %" PRId64 "*code_alignment_factor", Operand);

74 if (Address && P.codeAlign()) {

75 *Address += Operand * P.codeAlign();

76 OS << format(" to 0x%" PRIx64, *Address);

77 }

78 break;

80 if (P.dataAlign())

81 OS << format(" %" PRId64, int64_t(Operand) * P.dataAlign());

82 else

83 OS << format(" %" PRId64 "*data_alignment_factor", int64_t(Operand));

84 break;

86 if (P.dataAlign())

87 OS << format(" %" PRId64, Operand * P.dataAlign());

88 else

89 OS << format(" %" PRId64 "*data_alignment_factor", Operand);

90 break;

92 OS << ' ';

94 break;

96 OS << format(" in addrspace%" PRId64, Operand);

97 break;

99 assert(Instr.Expression && "missing DWARFExpression object");

100 OS << " ";

102 break;

103 }

104}

105

108 unsigned IndentLevel,

109 std::optional<uint64_t> Address) {

110 for (const auto &Instr : P) {

111 uint8_t Opcode = Instr.Opcode;

112 OS.indent(2 * IndentLevel);

113 OS << P.callFrameString(Opcode) << ":";

114 for (size_t i = 0; i < Instr.Ops.size(); ++i)

116 OS << '\n';

117 }

118}

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

static void printOperand(raw_ostream &OS, const DIDumpOptions &DumpOpts, const CFIProgram &P, const CFIProgram::Instruction &Instr, unsigned OperandIdx, uint64_t Operand, std::optional< uint64_t > &Address)

Print Opcode's operand number OperandIdx which has value Operand.

Definition DWARFCFIPrinter.cpp:38

static void printRegister(raw_ostream &OS, const DIDumpOptions &DumpOpts, unsigned RegNum)

Definition DWARFCFIPrinter.cpp:25

The instances of the Type class are immutable: once they are created, they are never changed.

Represent a sequence of Call Frame Information instructions that, when read in order,...

OperandType

Types of operands to CFI instructions In DWARF, this type is implicitly tied to a CFI instruction opc...

@ OT_SignedFactDataOffset

@ OT_UnsignedFactDataOffset

static constexpr size_t MaxOperands

This class implements an extremely fast bulk output stream that can only output to a stream.

raw_ostream & indent(unsigned NumSpaces)

indent - Insert 'NumSpaces' spaces.

Calculates the starting offsets for various sections within the .debug_names section.

LLVM_ABI void printCFIProgram(const CFIProgram &P, raw_ostream &OS, const DIDumpOptions &DumpOpts, unsigned IndentLevel, std::optional< uint64_t > Address)

Definition DWARFCFIPrinter.cpp:106

This is an optimization pass for GlobalISel generic memory operations.

LLVM_ABI void printDwarfExpression(const DWARFExpression *E, raw_ostream &OS, DIDumpOptions DumpOpts, DWARFUnit *U, bool IsEH=false)

Print a Dwarf expression/.

format_object< Ts... > format(const char *Fmt, const Ts &... Vals)

These are helper functions used to produce formatted output.

Container for dump options that control which debug information will be dumped.

std::function< llvm::StringRef(uint64_t DwarfRegNum, bool IsEH)> GetNameForDWARFReg

An instruction consists of a DWARF CFI opcode and an optional sequence of operands.