LLVM: include/llvm/Transforms/Utils/DebugSSAUpdater.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21#ifndef LLVM_TRANSFORMS_UTILS_DEBUGSSAUPDATER_H

22#define LLVM_TRANSFORMS_UTILS_DEBUGSSAUPDATER_H

23

33#include

34

35namespace llvm {

36

37

38

39

42

43

44

45

46

53

73

76 return true;

79 Other.Expression);

80 }

81

85

87};

88

89class DbgSSABlock;

90class DebugSSAUpdater;

91

92

93

114

120 PHI.print(OS);

121 return OS;

122}

123

124

126public:

129

132

136

141

143};

144

145

147public:

150

153

157

162

164};

165

167public:

171

172

174

177

181

185

189

193

197

201

202

205 "Only one PHI should exist per-block per-variable");

206 PHIList.emplace_back(this);

208 }

209

210

212};

213

214

215

219

220private:

221

222

223 AvailableValsTy AV;

224

225

226

228

230

231public:

232

233

238

240 for (auto &Block : BlockMap)

241 delete Block.second;

242 }

243

245 for (auto &Block : BlockMap)

246 delete Block.second;

247

248 if (InsertedPHIs)

249 InsertedPHIs->clear();

250 BlockMap.clear();

251 }

252

254

255

256

258 auto it = BlockMap.find(BB);

259 if (it == BlockMap.end()) {

260 BlockMap[BB] = new DbgSSABlock(*BB, *this);

261 it = BlockMap.find(BB);

262 }

263 return it->second;

264 }

265

266

267

269

270

271

273

274

275

277

278

279

281

282

283

284

285

286

287

288

289

290

291

292

293

294

295

296

297

298

299

300

301

303

304private:

306};

307

314

315

316

317

318

319

323 };

324

325public:

329

330private:

334};

335

336

337

338

339

342 OrigVariableValueRangeTable;

344

345public:

348 return OrigVariableValueRangeTable.contains(DVA) ||

349 OrigSingleLocVariableValueTable.contains(DVA);

350 }

352 return OrigSingleLocVariableValueTable.contains(DVA);

353 }

355 return OrigVariableValueRangeTable[DVA];

356 }

358 return OrigSingleLocVariableValueTable[DVA];

359 }

360

362};

363

364}

365

366#endif

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

#define LLVM_ABI_FOR_TEST

This file provides various utilities for inspecting and working with the control flow graph in LLVM I...

This file defines the SmallVector class.

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

LLVM Basic Block Representation.

InstListType::iterator iterator

Instruction iterators...

Thin wrapper around a block successor iterator.

Definition DebugSSAUpdater.h:146

DbgSSABlockPredIterator(pred_iterator PredIt, DebugSSAUpdater &Updater)

Definition DebugSSAUpdater.h:151

DebugSSAUpdater & Updater

Definition DebugSSAUpdater.h:149

bool operator!=(const DbgSSABlockPredIterator &OtherIt) const

Definition DebugSSAUpdater.h:154

DbgSSABlockPredIterator & operator++()

Definition DebugSSAUpdater.h:158

pred_iterator PredIt

Definition DebugSSAUpdater.h:148

DbgSSABlock * operator*()

Thin wrapper around a block successor iterator.

Definition DebugSSAUpdater.h:125

DebugSSAUpdater & Updater

Definition DebugSSAUpdater.h:128

DbgSSABlock * operator*()

DbgSSABlockSuccIterator(succ_iterator SuccIt, DebugSSAUpdater &Updater)

Definition DebugSSAUpdater.h:130

succ_iterator SuccIt

Definition DebugSSAUpdater.h:127

bool operator!=(const DbgSSABlockSuccIterator &OtherIt) const

Definition DebugSSAUpdater.h:133

DbgSSABlockSuccIterator & operator++()

Definition DebugSSAUpdater.h:137

Definition DebugSSAUpdater.h:166

DebugSSAUpdater & Updater

Definition DebugSSAUpdater.h:169

iterator_range< DbgSSABlockPredIterator > predecessors()

Definition DebugSSAUpdater.h:186

DbgSSABlockSuccIterator succ_end()

Definition DebugSSAUpdater.h:194

SmallVector< DbgSSAPhi, 1 > PHIListT

Definition DebugSSAUpdater.h:170

DbgSSABlockPredIterator pred_end()

Definition DebugSSAUpdater.h:182

DbgSSABlockPredIterator pred_begin()

Definition DebugSSAUpdater.h:178

DbgSSABlockSuccIterator succ_begin()

Definition DebugSSAUpdater.h:190

PHIListT & phis()

SSAUpdater wishes to know what PHIs already exist in this block.

Definition DebugSSAUpdater.h:211

PHIListT PHIList

List of PHIs in this block.

Definition DebugSSAUpdater.h:173

BasicBlock & BB

Definition DebugSSAUpdater.h:168

DbgSSAPhi * newPHI()

SSAUpdater has requested a PHI: create that within this block record.

Definition DebugSSAUpdater.h:203

iterator_range< DbgSSABlockSuccIterator > successors()

Definition DebugSSAUpdater.h:198

DbgSSABlock(BasicBlock &BB, DebugSSAUpdater &Updater)

Definition DebugSSAUpdater.h:175

Represents the live-in definitions of a variable to a block with multiple predecessors.

Definition DebugSSAUpdater.h:94

SmallVector< std::pair< DbgSSABlock *, DbgValueDef >, 4 > IncomingValues

Definition DebugSSAUpdater.h:96

void addIncoming(DbgSSABlock *BB, DbgValueDef DV)

Definition DebugSSAUpdater.h:108

DbgSSABlock * getParent()

Definition DebugSSAUpdater.h:100

DbgSSAPhi(DbgSSABlock *ParentBlock)

Definition DebugSSAUpdater.h:98

void print(raw_ostream &OS) const

DbgSSABlock * ParentBlock

Definition DebugSSAUpdater.h:97

DbgValueDef getIncomingValue(size_t Idx)

Definition DebugSSAUpdater.h:105

unsigned getNumIncomingValues() const

Definition DebugSSAUpdater.h:101

DbgSSABlock * getIncomingBlock(size_t Idx)

Definition DebugSSAUpdater.h:102

Utility class used to find and store the live debug ranges for variables in a module.

Definition DebugSSAUpdater.h:340

DbgValueDef getSingleLoc(DebugVariableAggregate DVA)

Definition DebugSSAUpdater.h:357

ArrayRef< DbgRangeEntry > getVariableRanges(DebugVariableAggregate DVA)

Definition DebugSSAUpdater.h:354

void printValues(DebugVariableAggregate DVA, raw_ostream &OS)

LLVM_ABI_FOR_TEST void addVariable(Function *F, DebugVariableAggregate DVA)

bool hasSingleLocEntry(DebugVariableAggregate DVA) const

Definition DebugSSAUpdater.h:351

bool hasVariableEntry(DebugVariableAggregate DVA) const

Definition DebugSSAUpdater.h:347

Record of a variable value-assignment, aka a non instruction representation of the dbg....

LLVM_ABI bool isKillLocation() const

bool isAddressOfVariable() const

Does this describe the address of a local variable.

DIExpression * getExpression() const

Metadata * getRawLocation() const

Returns the metadata operand for the first location description.

Class used to determine the live ranges of debug variables in IR using SSA construction (via the SSAU...

Definition DebugSSAUpdater.h:216

DebugSSAUpdater(SmallVectorImpl< DbgSSAPhi * > *InsertedPHIs=nullptr)

If InsertedPHIs is specified, it will be filled in with all PHI Nodes created by rewriting.

DebugSSAUpdater & operator=(const DebugSSAUpdater &)=delete

DbgValueDef findValueForBlock(DbgSSABlock *BB) const

Return the value for the specified block if the DebugSSAUpdater has one, otherwise return nullptr.

DebugSSAUpdater(const DebugSSAUpdater &)=delete

void addAvailableValue(DbgSSABlock *BB, DbgValueDef DV)

Indicate that a rewritten value is available in the specified block with the specified value.

DbgValueDef getValueAtEndOfBlock(DbgSSABlock *BB)

Construct SSA form, materializing a value that is live at the end of the specified block.

DbgSSABlock * getDbgSSABlock(BasicBlock *BB)

For a given BB, create a wrapper block for it.

Definition DebugSSAUpdater.h:257

~DebugSSAUpdater()

Definition DebugSSAUpdater.h:239

DbgValueDef getValueInMiddleOfBlock(DbgSSABlock *BB)

Construct SSA form, materializing a value that is live in the middle of the specified block.

void reset()

Definition DebugSSAUpdater.h:244

bool hasValueForBlock(DbgSSABlock *BB) const

Return true if the DebugSSAUpdater already has a value for the specified block.

Identifies a unique instance of a whole variable (discards/ignores fragment information).

Utility class used to store the names of SSA values after their owning modules have been destroyed.

Definition DebugSSAUpdater.h:320

uint64_t ValueID

Definition DebugSSAUpdater.h:326

std::string getName(ValueID ID)

Definition DebugSSAUpdater.h:328

ValueID addValue(Value *V)

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

This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.

LLVM Value Representation.

A range adaptor for a pair of iterators.

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

unsigned ID

LLVM IR allows to use arbitrary numbers as calling convention identifiers.

This is an optimization pass for GlobalISel generic memory operations.

auto pred_end(const MachineBasicBlock *BB)

RNSuccIterator< NodeRef, BlockT, RegionT > succ_begin(NodeRef Node)

iterator_range(Container &&) -> iterator_range< llvm::detail::IterOfRange< Container > >

RNSuccIterator< NodeRef, BlockT, RegionT > succ_end(NodeRef Node)

PredIterator< BasicBlock, Value::user_iterator > pred_iterator

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

auto pred_begin(const MachineBasicBlock *BB)

SuccIterator< Instruction, BasicBlock > succ_iterator

Definition DebugSSAUpdater.h:308

BasicBlock::iterator End

Definition DebugSSAUpdater.h:310

BasicBlock::iterator Start

Definition DebugSSAUpdater.h:309

DbgValueDef Value

Definition DebugSSAUpdater.h:312

A definition of a variable; can represent either a debug value, no definition (the variable has not y...

Definition DebugSSAUpdater.h:47

bool IsUndef

Definition DebugSSAUpdater.h:49

DbgValueDef(DbgVariableRecord *DVR)

Definition DebugSSAUpdater.h:63

DbgValueDef(DbgSSAPhi *Phi)

Definition DebugSSAUpdater.h:70

bool operator!=(DbgValueDef Other) const

Definition DebugSSAUpdater.h:84

bool IsMemory

Definition DebugSSAUpdater.h:50

void print(raw_ostream &OS) const

DbgValueDef()

Definition DebugSSAUpdater.h:54

DIExpression * Expression

Definition DebugSSAUpdater.h:52

DbgSSAPhi * Phi

Definition DebugSSAUpdater.h:48

bool operator==(DbgValueDef Other) const

Definition DebugSSAUpdater.h:83

Metadata * Locations

Definition DebugSSAUpdater.h:51

DbgValueDef(bool IsMemory, Metadata *Locations, DIExpression *Expression)

Definition DebugSSAUpdater.h:60

DbgValueDef(int)

Definition DebugSSAUpdater.h:57

bool agreesWith(DbgValueDef Other) const

Definition DebugSSAUpdater.h:74

This class defines the default behavior for configurable aspects of ValueMap<>.