Introduce a new temporary MDNode concept. Temporary MDNodes are

not part of the IR, are not uniqued, and may be safely RAUW'd.
This replaces a variety of alternate mechanisms for achieving
the same effect.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111681 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman
2010-08-20 22:02:26 +00:00
parent 95c7930225
commit 489b29b0a4
6 changed files with 62 additions and 14 deletions

View File

@@ -272,6 +272,10 @@ namespace llvm {
StringRef getFilename() const { return getCompileUnit().getFilename();}
StringRef getDirectory() const { return getCompileUnit().getDirectory();}
/// replaceAllUsesWith - Replace all uses of debug info referenced by
/// this descriptor.
void replaceAllUsesWith(DIDescriptor &D);
/// print - print type.
void print(raw_ostream &OS) const;
@@ -314,10 +318,6 @@ namespace llvm {
/// dump - print derived type to dbgs() with a newline.
void dump() const;
/// replaceAllUsesWith - Replace all uses of debug info referenced by
/// this descriptor.
void replaceAllUsesWith(DIDescriptor &D);
};
/// DICompositeType - This descriptor holds a type that can refer to multiple
@@ -654,6 +654,9 @@ namespace llvm {
unsigned RunTimeLang = 0,
MDNode *ContainingType = 0);
/// CreateTemporaryType - Create a temporary forward-declared type.
DIType CreateTemporaryType(DIDescriptor Context);
/// CreateArtificialType - Create a new DIType with "artificial" flag set.
DIType CreateArtificialType(DIType Ty);

View File

@@ -128,6 +128,16 @@ public:
static MDNode *getIfExists(LLVMContext &Context, Value *const *Vals,
unsigned NumVals);
/// getTemporary - Return a temporary MDNode, for use in constructing
/// cyclic MDNode structures. A temporary MDNode is not uniqued,
/// may be RAUW'd, and must be manually deleted with deleteTemporary.
static MDNode *getTemporary(LLVMContext &Context, Value *const *Vals,
unsigned NumVals);
/// deleteTemporary - Deallocate a node created by getTemporary. The
/// node must not have any users.
static void deleteTemporary(MDNode *N);
/// getOperand - Return specified operand.
Value *getOperand(unsigned i) const;