[llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp

Duraid Madina duraid at octopus.com.au
Sat Apr 2 04:22:02 PST 2005



Changes in directory llvm/lib/CodeGen:

AsmPrinter.cpp updated: 1.15 -> 1.16
---
Log message:

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(" / ")")



---
Diffs of the changes:  (+10 -5)

 AsmPrinter.cpp |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)


Index: llvm/lib/CodeGen/AsmPrinter.cpp
diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.15 llvm/lib/CodeGen/AsmPrinter.cpp:1.16
--- llvm/lib/CodeGen/AsmPrinter.cpp:1.15	Mon Feb 14 15:40:26 2005
+++ llvm/lib/CodeGen/AsmPrinter.cpp	Sat Apr  2 06:21:50 2005
@@ -67,11 +67,16 @@
       O << (unsigned long long)CI->getValue();
   else if (const ConstantUInt *CI = dyn_cast<ConstantUInt>(CV))
     O << CI->getValue();
-  else if (isa<GlobalValue>((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<ConstantExpr>(CV)) {
+  else if (isa<GlobalValue>((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<Function>((Value*)CV))
+      O << FunctionAddrPrefix << Mang->getValueName(CV) << FunctionAddrSuffix;
+    else
+      O << GlobalVarAddrPrefix << Mang->getValueName(CV) << GlobalVarAddrSuffix;
+  } else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV)) {
     const TargetData &TD = TM.getTargetData();
     switch(CE->getOpcode()) {
     case Instruction::GetElementPtr: {






More information about the llvm-commits mailing list