X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FCodeGen%2FLexicalScopes.h;h=9d54ad8b8662d62689f6c872ca1ee3414eb96b60;hb=d1abec365aa89a8497d9b615ccb4b21c72da9447;hp=dbdb58e24370eb731c2b8988f579a0cfb02f9138;hpb=5bc942cc3cc970836d48d8ad276ef3b2b1120ffc;p=oota-llvm.git diff --git a/include/llvm/CodeGen/LexicalScopes.h b/include/llvm/CodeGen/LexicalScopes.h index dbdb58e2437..9d54ad8b866 100644 --- a/include/llvm/CodeGen/LexicalScopes.h +++ b/include/llvm/CodeGen/LexicalScopes.h @@ -17,10 +17,11 @@ #ifndef LLVM_CODEGEN_LEXICALSCOPES_H #define LLVM_CODEGEN_LEXICALSCOPES_H -#include "llvm/Metadata.h" +#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/Metadata.h" #include "llvm/Support/DebugLoc.h" #include "llvm/Support/ValueHandle.h" #include @@ -44,7 +45,7 @@ typedef std::pair InsnRange; class LexicalScopes { public: LexicalScopes() : MF(NULL), CurrentFnLexicalScope(NULL) { } - ~LexicalScopes(); + virtual ~LexicalScopes(); /// initialize - Scan machine function and constuct lexical scope nest. virtual void initialize(const MachineFunction &); @@ -79,7 +80,7 @@ public: LexicalScope *findLexicalScope(DebugLoc DL); /// getAbstractScopesList - Return a reference to list of abstract scopes. - SmallVector &getAbstractScopesList() { + ArrayRef getAbstractScopesList() const { return AbstractScopesList; } @@ -152,11 +153,15 @@ private: /// LexicalScope - This class is used to track scope information. /// class LexicalScope { + virtual void anchor(); public: LexicalScope(LexicalScope *P, const MDNode *D, const MDNode *I, bool A) : Parent(P), Desc(D), InlinedAtLocation(I), AbstractScope(A), - LastInsn(0), FirstInsn(0), DFSIn(0), DFSOut(0), IndentLevel(0) { + LastInsn(0), FirstInsn(0), DFSIn(0), DFSOut(0) { +#ifndef NDEBUG + IndentLevel = 0; +#endif if (Parent) Parent->addChild(this); } @@ -207,8 +212,8 @@ public: Parent->closeInsnRange(NewScope); } - /// dominates - Return true if current scope dominsates given lexical scope. - bool dominates(const LexicalScope *S) { + /// dominates - Return true if current scope dominates given lexical scope. + bool dominates(const LexicalScope *S) const { if (S == this) return true; if (DFSIn < S->getDFSIn() && DFSOut > S->getDFSOut()) @@ -239,7 +244,9 @@ private: const MachineInstr *FirstInsn; // First instruction of this scope. unsigned DFSIn, DFSOut; // In & Out Depth use to determine // scope nesting. +#ifndef NDEBUG mutable unsigned IndentLevel; // Private state for dump() +#endif }; } // end llvm namespace