summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-15 23:18:17 +0000
committerChris Lattner <sabre@nondot.org>2010-01-15 23:18:17 +0000
commit91687f6e282b72d5c97218a9a8976352d3fac222 (patch)
tree93105489051f595fd27093eb6c7a6e704eaa4559 /llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
parentd4d6fb3374066fc08350d071c6637460e87c8517 (diff)
downloadbcm5719-llvm-91687f6e282b72d5c97218a9a8976352d3fac222.tar.gz
bcm5719-llvm-91687f6e282b72d5c97218a9a8976352d3fac222.zip
add a AsmPrinter::GetGlobalValueSymbol and GetExternalSymbolSymbol
helper method, use it to simplify some code. llvm-svn: 93575
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 876f628336f..680afc001c1 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -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
OpenPOWER on IntegriCloud