LLVM: lib/MC/MCFragment.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

13#include "llvm/Config/llvm-config.h"

22#include

23#include

24

25using namespace llvm;

26

28 : Kind(Kind), HasInstructions(HasInstructions), AlignToBundleEnd(false),

29 LinkerRelaxable(false), AllowAutoPadding(false) {}

30

32 switch (Kind) {

34 cast(this)->~MCAlignFragment();

35 return;

37 cast(this)->~MCDataFragment();

38 return;

40 cast(this)->~MCFillFragment();

41 return;

43 cast(this)->~MCNopsFragment();

44 return;

46 cast(this)->~MCRelaxableFragment();

47 return;

49 cast(this)->~MCOrgFragment();

50 return;

52 cast(this)->~MCDwarfLineAddrFragment();

53 return;

55 cast(this)->~MCDwarfCallFrameFragment();

56 return;

58 cast(this)->~MCLEBFragment();

59 return;

61 cast(this)->~MCBoundaryAlignFragment();

62 return;

64 cast(this)->~MCSymbolIdFragment();

65 return;

67 cast(this)->~MCCVInlineLineTableFragment();

68 return;

70 cast(this)->~MCCVDefRangeFragment();

71 return;

73 cast(this)->~MCPseudoProbeAddrFragment();

74 return;

76 cast(this)->~MCDummyFragment();

77 return;

78 }

79}

80

82 return cast(Parent)->getAtom(LayoutOrder);

83}

84

85

86

87namespace llvm {

88

90 OS << "<MCFixup" << " Offset:" << AF.getOffset()

91 << " Value:" << *AF.getValue()

92 << " Kind:" << AF.getKind() << ">";

93 return OS;

94}

95

96}

97

98#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)

101

102 OS << "<";

108 OS << "MCFNopsFragment";

109 break;

120 OS << "MCPseudoProbe";

121 break;

123 }

124

125 OS << "<MCFragment " << (const void *)this << " LayoutOrder:" << LayoutOrder

126 << " Offset:" << Offset << " HasInstructions:" << hasInstructions();

127 if (const auto *EF = dyn_cast(this))

128 OS << " BundlePadding:" << static_cast<unsigned>(EF->getBundlePadding());

129 OS << ">";

130

133 const auto *AF = cast(this);

134 if (AF->hasEmitNops())

135 OS << " (emit nops)";

136 OS << "\n ";

137 OS << " Alignment:" << AF->getAlignment().value()

138 << " Value:" << AF->getValue() << " ValueSize:" << AF->getValueSize()

139 << " MaxBytesToEmit:" << AF->getMaxBytesToEmit() << ">";

140 break;

141 }

143 const auto *DF = cast(this);

144 OS << "\n ";

145 OS << " Contents:[";

147 for (unsigned i = 0, e = Contents.size(); i != e; ++i) {

148 if (i) OS << ",";

149 OS << hexdigit((Contents[i] >> 4) & 0xF) << hexdigit(Contents[i] & 0xF);

150 }

151 OS << "] (" << Contents.size() << " bytes)";

152

153 if (DF->getFixups().size()) {

154 OS << ",\n ";

155 OS << " Fixups:[";

157 OS << "]";

158 }

159 break;

160 }

162 const auto *FF = cast(this);

163 OS << " Value:" << static_cast<unsigned>(FF->getValue())

164 << " ValueSize:" << static_cast<unsigned>(FF->getValueSize())

165 << " NumValues:" << FF->getNumValues();

166 break;

167 }

169 const auto *NF = cast(this);

170 OS << " NumBytes:" << NF->getNumBytes()

171 << " ControlledNopLength:" << NF->getControlledNopLength();

172 break;

173 }

175 const auto *F = cast(this);

176 OS << "\n ";

177 OS << " Inst:";

178 F->getInst().dump_pretty(OS);

179 OS << " (" << F->getContents().size() << " bytes)";

180 break;

181 }

183 const auto *OF = cast(this);

184 OS << "\n ";

185 OS << " Offset:" << OF->getOffset()

186 << " Value:" << static_cast<unsigned>(OF->getValue());

187 break;

188 }

190 const auto *OF = cast(this);

191 OS << "\n ";

192 OS << " AddrDelta:" << OF->getAddrDelta()

193 << " LineDelta:" << OF->getLineDelta();

194 break;

195 }

197 const auto *CF = cast(this);

198 OS << "\n ";

199 OS << " AddrDelta:" << CF->getAddrDelta();

200 break;

201 }

203 const auto *LF = cast(this);

204 OS << "\n ";

205 OS << " Value:" << LF->getValue() << " Signed:" << LF->isSigned();

206 break;

207 }

209 const auto *BF = cast(this);

210 OS << "\n ";

211 OS << " BoundarySize:" << BF->getAlignment().value()

212 << " LastFragment:" << BF->getLastFragment()

213 << " Size:" << BF->getSize();

214 break;

215 }

217 const auto *F = cast(this);

218 OS << "\n ";

219 OS << " Sym:" << F->getSymbol();

220 break;

221 }

223 const auto *F = cast(this);

224 OS << "\n ";

225 OS << " Sym:" << *F->getFnStartSym();

226 break;

227 }

229 const auto *F = cast(this);

230 OS << "\n ";

231 for (std::pair<const MCSymbol *, const MCSymbol *> RangeStartEnd :

232 F->getRanges()) {

233 OS << " RangeStart:" << RangeStartEnd.first;

234 OS << " RangeEnd:" << RangeStartEnd.second;

235 }

236 break;

237 }

239 const auto *OF = cast(this);

240 OS << "\n ";

241 OS << " AddrDelta:" << OF->getAddrDelta();

242 break;

243 }

245 break;

246 }

247 OS << ">";

248}

249#endif

#define LLVM_DUMP_METHOD

Mark debug helper function definitions like dump() that should not be stripped from debug builds.

static RegisterPass< DebugifyFunctionPass > DF("debugify-function", "Attach debug info to a function")

This file defines the SmallVector class.

Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...

const MCExpr * getValue() const

uint32_t getOffset() const

MCFixupKind getKind() const

FragmentType getKind() const

const MCSymbol * getAtom() const

void destroy()

Destroys the current fragment.

bool hasInstructions() const

Does this fragment have instructions emitted into it? By default this is false, but specific fragment...

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

This class consists of common code factored out of the SmallVector class to reduce code duplication b...

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

This is an optimization pass for GlobalISel generic memory operations.

void interleave(ForwardIterator begin, ForwardIterator end, UnaryFunctor each_fn, NullaryFunctor between_fn)

An STL-style algorithm similar to std::for_each that applies a second functor between every pair of e...

raw_fd_ostream & errs()

This returns a reference to a raw_ostream for standard error.

raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)