diff options
author | Chris Lattner <sabre@nondot.org> | 2009-06-24 04:31:49 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-06-24 04:31:49 +0000 |
commit | 3f5738d599fa0c001ccb3734423e329fc0010c8d (patch) | |
tree | b571dda6d5e40d6c169c669db996cb68867ebb99 /llvm/lib/MC/MCContext.cpp | |
parent | 828e301c8e06734d4df5c4451bc962da493941fc (diff) | |
download | bcm5719-llvm-3f5738d599fa0c001ccb3734423e329fc0010c8d.tar.gz bcm5719-llvm-3f5738d599fa0c001ccb3734423e329fc0010c8d.zip |
add trivial support for passing label definitions through the MCStreamer.
This is suboptimal in several aspects, see the commented out assertion.
I need to talk to Daniel about this.
llvm-svn: 74057
Diffstat (limited to 'llvm/lib/MC/MCContext.cpp')
-rw-r--r-- | llvm/lib/MC/MCContext.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp index cad0d569902..f7793b918ca 100644 --- a/llvm/lib/MC/MCContext.cpp +++ b/llvm/lib/MC/MCContext.cpp @@ -44,6 +44,20 @@ MCSymbol *MCContext::CreateSymbol(MCAtom *Atom, const char *Name) { return Entry = new (*this) MCSymbol(Atom, Name, false); } +/// GetOrCreateSymbol - Lookup the symbol inside with the specified +/// @param Name. If it exists, return it. If not, create a forward +/// reference and return it. +/// +/// @param Name - The symbol name, which must be unique across all symbols. +MCSymbol *MCContext::GetOrCreateSymbol(const char *Name) { + MCSymbol *&Entry = Symbols[Name]; + if (Entry) return Entry; + + // FIXME: is a null atom the right way to make a forward ref? + return Entry = new (*this) MCSymbol(0, Name, false); +} + + MCSymbol *MCContext::CreateTemporarySymbol(MCAtom *Atom, const char *Name) { // If unnamed, just create a symbol. if (Name[0] == '\0') |