LLVM: lib/MC/MCFragment.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
12#include "llvm/Config/llvm-config.h"
21#include
22#include <type_traits>
23#include
24
25using namespace llvm;
26
27static_assert(std::is_trivially_destructible_v,
28 "fragment classes must be trivially destructible");
29
31 : Kind(Kind), LinkerRelaxable(false), HasInstructions(HasInstructions),
32 AllowAutoPadding(false) {
33 static_assert(sizeof(MCFragment::Tail) <= 16,
34 "Keep the variable-size tail small");
35}
36
40
41#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
44
45 OS << Offset << ' ';
47
62
63 }
64
66 if (Fixups.empty())
67 return;
69 OS << "\n Fixup @" << F.getOffset() << " Value:";
70 F.getValue()->print(OS, nullptr);
71 OS << " Kind:" << F.getKind();
72 if (F.isLinkerRelaxable())
73 OS << " LinkerRelaxable";
74 }
75 };
76
86 OS << " LinkerRelaxable";
89 OS << " Size:" << Fixed.size();
91 OS << '+' << Var.size();
92
93
95 Var = {};
96 }
97 OS << " [";
98 for (unsigned i = 0, e = Fixed.size(); i != e; ++i) {
99 if (i) OS << ",";
101 }
102 for (unsigned i = 0, e = Var.size(); i != e; ++i) {
103 if (Fixed.size() || i)
104 OS << ",";
106 }
107 OS << ']';
110 break;
112 OS << ' ';
114 break;
120 OS << " Nops";
121 break;
123 OS << " Value:";
126 break;
127 }
129 OS << " AddrDelta:";
132 break;
135 OS << " AddrDelta:";
137 break;
138 default:
140 }
143 break;
144 }
147 OS << " Value:" << static_cast<unsigned>(FF->getValue())
148 << " ValueSize:" << static_cast<unsigned>(FF->getValueSize())
149 << " NumValues:";
150 FF->getNumValues().print(OS, nullptr);
151 break;
152 }
155 OS << " NumBytes:" << NF->getNumBytes()
156 << " ControlledNopLength:" << NF->getControlledNopLength();
157 break;
158 }
161 OS << " Offset:";
162 OF->getOffset().print(OS, nullptr);
163 OS << " Value:" << static_cast<unsigned>(OF->getValue());
164 break;
165 }
168 OS << " BoundarySize:" << BF->getAlignment().value()
169 << " LastFragment:" << BF->getLastFragment()
170 << " Size:" << BF->getSize();
171 break;
172 }
175 OS << " Sym:" << F->getSymbol();
176 break;
177 }
180 OS << " Sym:" << *F->getFnStartSym();
181 break;
182 }
185 OS << "\n ";
186 for (std::pair<const MCSymbol *, const MCSymbol *> RangeStartEnd :
187 F->getRanges()) {
188 OS << " RangeStart:" << RangeStartEnd.first;
189 OS << " RangeEnd:" << RangeStartEnd.second;
190 }
191 break;
192 }
193 }
194}
195#endif
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
This file defines the SmallVector class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
const MCExpr & getDwarfAddrDelta() const
MutableArrayRef< char > getContents()
FragmentType getKind() const
bool isLinkerRelaxable() const
LLVM_ABI MCFragment(FragmentType Kind=MCFragment::FT_Data, bool HasInstructions=false)
Definition MCFragment.cpp:30
bool hasAlignEmitNops() const
LLVM_ABI const MCSymbol * getAtom() const
Definition MCFragment.cpp:37
unsigned getAlignMaxBytesToEmit() const
int64_t getDwarfLineDelta() const
MutableArrayRef< MCFixup > getFixups()
const MCExpr & getLEBValue() const
LLVM_ABI void dump() const
Definition MCFragment.cpp:42
Align getAlignment() const
int64_t getAlignFill() const
uint8_t getAlignFillLen() const
MutableArrayRef< char > getVarContents()
MutableArrayRef< MCFixup > getVarFixups()
LLVM_ABI void dump_pretty(raw_ostream &OS, const MCInstPrinter *Printer=nullptr, StringRef Separator=" ", const MCContext *Ctx=nullptr) const
Dump the MCInst as prettily as possible using the additional MC structures, if given.
This represents a section on a Mach-O system (used by Mac OS X).
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
This class implements an extremely fast bulk output stream that can only output to a stream.
#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.
auto enumerate(FirstRange &&First, RestRanges &&...Rest)
Given two or more input ranges, returns a new range whose values are tuples (A, B,...
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
decltype(auto) cast(const From &Val)
cast - Return the argument parameter cast to the specified type.
constexpr uint64_t value() const
This is a hole in the type system and should not be abused.