#include "llvm/CodeGen/LexicalScopes.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Metadata.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <string>
#include <tuple>
#include <utility>
usingnamespacellvm;
#define DEBUG_TYPE …
void LexicalScopes::reset() { … }
void LexicalScopes::initialize(const MachineFunction &Fn) { … }
void LexicalScopes::extractLexicalScopes(
SmallVectorImpl<InsnRange> &MIRanges,
DenseMap<const MachineInstr *, LexicalScope *> &MI2ScopeMap) { … }
LexicalScope *LexicalScopes::findLexicalScope(const DILocation *DL) { … }
LexicalScope *LexicalScopes::getOrCreateLexicalScope(const DILocalScope *Scope,
const DILocation *IA) { … }
LexicalScope *
LexicalScopes::getOrCreateRegularScope(const DILocalScope *Scope) { … }
LexicalScope *
LexicalScopes::getOrCreateInlinedScope(const DILocalScope *Scope,
const DILocation *InlinedAt) { … }
LexicalScope *
LexicalScopes::getOrCreateAbstractScope(const DILocalScope *Scope) { … }
void LexicalScopes::constructScopeNest(LexicalScope *Scope) { … }
void LexicalScopes::assignInstructionRanges(
SmallVectorImpl<InsnRange> &MIRanges,
DenseMap<const MachineInstr *, LexicalScope *> &MI2ScopeMap) { … }
void LexicalScopes::getMachineBasicBlocks(
const DILocation *DL, SmallPtrSetImpl<const MachineBasicBlock *> &MBBs) { … }
bool LexicalScopes::dominates(const DILocation *DL, MachineBasicBlock *MBB) { … }
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_DUMP_METHOD void LexicalScope::dump(unsigned Indent) const {
raw_ostream &err = dbgs();
err.indent(Indent);
err << "DFSIn: " << DFSIn << " DFSOut: " << DFSOut << "\n";
const MDNode *N = Desc;
err.indent(Indent);
N->dump();
if (AbstractScope)
err << std::string(Indent, ' ') << "Abstract Scope\n";
if (!Children.empty())
err << std::string(Indent + 2, ' ') << "Children ...\n";
for (const LexicalScope *Child : Children)
if (Child != this)
Child->dump(Indent + 2);
}
#endif