add a AsmPrinter::GetGlobalValueSymbol and GetExternalSymbolSymbol

helper method, use it to simplify some code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93575 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2010-01-15 23:18:17 +00:00
parent 11f30b0131
commit 6b04edee11
5 changed files with 29 additions and 10 deletions

View File

@ -1698,6 +1698,22 @@ MCSymbol *AsmPrinter::GetMBBSymbol(unsigned MBBID) const {
return OutContext.GetOrCreateSymbol(Name.str());
}
/// GetGlobalValueSymbol - Return the MCSymbol for the specified global
/// value.
MCSymbol *AsmPrinter::GetGlobalValueSymbol(const GlobalValue *GV) const {
SmallString<60> NameStr;
Mang->getNameWithPrefix(NameStr, GV, false);
return OutContext.GetOrCreateSymbol(NameStr.str());
}
/// GetExternalSymbolSymbol - Return the MCSymbol for the specified
/// ExternalSymbol.
MCSymbol *AsmPrinter::GetExternalSymbolSymbol(StringRef Sym) const {
SmallString<60> NameStr;
Mang->getNameWithPrefix(NameStr, Sym);
return OutContext.GetOrCreateSymbol(NameStr.str());
}
/// EmitBasicBlockStart - This method prints the label for the specified
/// MachineBasicBlock, an alignment (if present) and a comment describing