17 #ifndef LLVM_CODEGEN_LEXICALSCOPES_H
18 #define LLVM_CODEGEN_LEXICALSCOPES_H
31 class MachineBasicBlock;
32 class MachineFunction;
39 typedef std::pair<const MachineInstr *, const MachineInstr *>
InsnRange;
57 bool empty() {
return CurrentFnLexicalScope == NULL; }
62 return LS == CurrentFnLexicalScope;
84 return AbstractScopesList;
89 return AbstractScopeMap.lookup(N);
95 return InlinedLexicalScopeMap.lookup(DL);
100 return LexicalScopeMap.lookup(N);
156 virtual void anchor();
160 : Parent(P), Desc(D), InlinedAtLocation(I), AbstractScope(A),
161 LastInsn(0), FirstInsn(0), DFSIn(0), DFSOut(0) {
192 assert (FirstInsn &&
"MI Range is not open!");
202 assert (LastInsn &&
"Last insn missing!");
208 if (Parent && (!NewScope || !Parent->
dominates(NewScope)))
228 void dump(
unsigned Indent = 0)
const;
242 unsigned DFSIn, DFSOut;
void push_back(const T &Elt)
void openInsnRange(const MachineInstr *MI)
openInsnRange - This scope covers instruction range starting from MI.
void dump(unsigned Indent=0) const
dump - print lexical scope.
void extendInsnRange(const MachineInstr *MI)
LexicalScope(LexicalScope *P, const MDNode *D, const MDNode *I, bool A)
const MDNode * getScopeNode() const
bool isCurrentFunctionScope(const LexicalScope *LS)
SmallVectorImpl< InsnRange > & getRanges()
MDNode - a tuple of other values.
ArrayRef< LexicalScope * > getAbstractScopesList() const
getAbstractScopesList - Return a reference to list of abstract scopes.
SmallVectorImpl< LexicalScope * > & getChildren()
void setDFSOut(unsigned O)
LexicalScope * getCurrentFunctionScope() const
getCurrentFunctionScope - Return lexical scope for the current function.
LexicalScope * getParent() const
virtual void initialize(const MachineFunction &)
initialize - Scan machine function and constuct lexical scope nest.
const MDNode * getInlinedAt() const
bool dominates(DebugLoc DL, MachineBasicBlock *MBB)
LexicalScope * findLexicalScope(DebugLoc DL)
LexicalScope * findAbstractScope(const MDNode *N)
findAbstractScope - Find an abstract scope or return NULL.
void closeInsnRange(LexicalScope *NewScope=NULL)
bool dominates(const LexicalScope *S) const
dominates - Return true if current scope dominates given lexical scope.
const MDNode * getDesc() const
LexicalScope * findInlinedScope(DebugLoc DL)
unsigned getDFSOut() const
bool isAbstractScope() const
void setDFSIn(unsigned I)
LexicalScope * findLexicalScope(const MDNode *N)
findLexicalScope - Find regular lexical scope or return NULL.
void dump()
dump - Print data structures to dbgs().
unsigned getDFSIn() const
std::pair< const MachineInstr *, const MachineInstr * > InsnRange
void addChild(LexicalScope *S)
addChild - Add a child scope.
virtual void releaseMemory()
releaseMemory - release memory.
void getMachineBasicBlocks(DebugLoc DL, SmallPtrSet< const MachineBasicBlock *, 4 > &MBBs)
bool empty()
empty - Return true if there is any lexical scope information available.