From 855a51974134e818232e52d63a2c3b2b48c8e244 Mon Sep 17 00:00:00 2001 From: Duraid Madina Date: Sat, 2 Apr 2005 12:21:51 +0000 Subject: add support for prefix/suffix strings to go around GlobalValue(s) (which may or be function pointers) in the asmprinter. For the moment, this changes nothing, except the IA64 backend which can use this to write: data8.ua @fptr(blah__blah__mangled_function_name) (by setting FunctionAddrPrefix/Suffix to "@fptr(" / ")") git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21024 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/AsmPrinter.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'lib/CodeGen/AsmPrinter.cpp') diff --git a/lib/CodeGen/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter.cpp index 4e77a78d81..6b4afb7dd8 100644 --- a/lib/CodeGen/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter.cpp @@ -67,11 +67,16 @@ void AsmPrinter::emitConstantValueOnly(const Constant *CV) { O << (unsigned long long)CI->getValue(); else if (const ConstantUInt *CI = dyn_cast(CV)) O << CI->getValue(); - else if (isa((Value*)CV)) - // This is a constant address for a global variable or function. Use the - // name of the variable or function as the address value. - O << Mang->getValueName(CV); - else if (const ConstantExpr *CE = dyn_cast(CV)) { + else if (isa((Value*)CV)) { + // This is a constant address for a global variable or function. Use the + // name of the variable or function as the address value, possibly + // decorating it with GlobalVarAddrPrefix/Suffix or + // FunctionAddrPrefix/Suffix (these all default to "" ) + if (isa((Value*)CV)) + O << FunctionAddrPrefix << Mang->getValueName(CV) << FunctionAddrSuffix; + else + O << GlobalVarAddrPrefix << Mang->getValueName(CV) << GlobalVarAddrSuffix; + } else if (const ConstantExpr *CE = dyn_cast(CV)) { const TargetData &TD = TM.getTargetData(); switch(CE->getOpcode()) { case Instruction::GetElementPtr: { -- cgit v1.2.3-70-g09d2