LLVM: lib/DebugInfo/DWARF/LowLevel/DWARFCFIProgram.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
14#include
15#include
16#include
17
18using namespace llvm;
19using namespace dwarf;
20
24
26#define ENUM_TO_CSTR(e) \
27 case e: \
28 return #e;
29 switch (OT) {
40 }
41 return "";
42}
43
49 "operand index %" PRIu32 " is not valid",
50 OperandIdx);
53 switch (Type) {
58 "op[%" PRIu32 "] has type %s which has no value",
60
66 "op[%" PRIu32 "] has OperandType OT_Offset which produces a signed "
67 "result, call getOperandAsSigned instead",
68 OperandIdx);
69
73 return Operand;
74
77 if (CodeAlignmentFactor == 0)
80 "op[%" PRIu32 "] has type OT_FactoredCodeOffset but code alignment "
81 "is zero",
82 OperandIdx);
83 return Operand * CodeAlignmentFactor;
84 }
85 }
87}
88
94 "operand index %" PRIu32 " is not valid",
95 OperandIdx);
98 switch (Type) {
103 "op[%" PRIu32 "] has type %s which has no value",
105
111 "op[%" PRIu32 "] has OperandType %s which produces an unsigned result, "
112 "call getOperandAsUnsigned instead",
114
116 return (int64_t)Operand;
117
120 const int64_t DataAlignmentFactor = CFIP.dataAlign();
121 if (DataAlignmentFactor == 0)
123 "op[%" PRIu32 "] has type %s but data "
124 "alignment is zero",
126 return int64_t(Operand) * DataAlignmentFactor;
127 }
128
130 const int64_t DataAlignmentFactor = CFIP.dataAlign();
131 if (DataAlignmentFactor == 0)
133 "op[%" PRIu32
134 "] has type OT_UnsignedFactDataOffset but data "
135 "alignment is zero",
136 OperandIdx);
137 return Operand * DataAlignmentFactor;
138 }
139 }
141}
142
146 static bool Initialized = false;
147 if (Initialized) {
149 }
150 Initialized = true;
151
152#define DECLARE_OP3(OP, OPTYPE0, OPTYPE1, OPTYPE2) \
153 do { \
154 OpTypes[OP][0] = OPTYPE0; \
155 OpTypes[OP][1] = OPTYPE1; \
156 OpTypes[OP][2] = OPTYPE2; \
157 } while (false)
158#define DECLARE_OP2(OP, OPTYPE0, OPTYPE1) \
159 DECLARE_OP3(OP, OPTYPE0, OPTYPE1, OT_None)
160#define DECLARE_OP1(OP, OPTYPE0) DECLARE_OP2(OP, OPTYPE0, OT_None)
161#define DECLARE_OP0(OP) DECLARE_OP1(OP, OT_None)
162
194 DECLARE_OP0(DW_CFA_AARCH64_negate_ra_state_with_pc);
197
198#undef DECLARE_OP0
199#undef DECLARE_OP1
200#undef DECLARE_OP2
201
203}
#define DECLARE_OP3(OP, OPTYPE0, OPTYPE1, OPTYPE2)
#define DECLARE_OP2(OP, OPTYPE0, OPTYPE1)
#define DECLARE_OP1(OP, OPTYPE0)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Tagged union holding either a T or a Error.
StringRef - Represent a constant reference to a string, i.e.
The instances of the Type class are immutable: once they are created, they are never changed.
OperandType
Types of operands to CFI instructions In DWARF, this type is implicitly tied to a CFI instruction opc...
@ OT_SignedFactDataOffset
@ OT_UnsignedFactDataOffset
uint64_t codeAlign() const
static constexpr size_t MaxOperands
static LLVM_ABI ArrayRef< OperandType[MaxOperands]> getOperandTypes()
Retrieve the array describing the types of operands according to the enum above.
Definition DWARFCFIProgram.cpp:144
CFIProgram(uint64_t CodeAlignmentFactor, int64_t DataAlignmentFactor, Triple::ArchType Arch)
int64_t dataAlign() const
static LLVM_ABI const char * operandTypeString(OperandType OT)
Get the OperandType as a "const char *".
Definition DWARFCFIProgram.cpp:25
LLVM_ABI StringRef callFrameString(unsigned Opcode) const
Get a DWARF CFI call frame string for the given DW_CFA opcode.
Definition DWARFCFIProgram.cpp:21
LLVM_ABI StringRef CallFrameString(unsigned Encoding, Triple::ArchType Arch)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Calculates the starting offsets for various sections within the .debug_names section.
This is an optimization pass for GlobalISel generic memory operations.
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
ArrayRef(const T &OneElt) -> ArrayRef< T >
LLVM_ABI Expected< uint64_t > getOperandAsUnsigned(const CFIProgram &CFIP, uint32_t OperandIdx) const
Definition DWARFCFIProgram.cpp:45
LLVM_ABI Expected< int64_t > getOperandAsSigned(const CFIProgram &CFIP, uint32_t OperandIdx) const
Definition DWARFCFIProgram.cpp:90