summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter.cpp
diff options
context:
space:
mode:
authorDuraid Madina <duraid@octopus.com.au>2005-04-02 12:21:51 +0000
committerDuraid Madina <duraid@octopus.com.au>2005-04-02 12:21:51 +0000
commit73a316d712d5be9b8ec8446be6578e83fb885e9b (patch)
treedd52048573099fdcdd6ff9ce477d5069df537632 /llvm/lib/CodeGen/AsmPrinter.cpp
parentc935c833d13d1f04ceeb79b6683f0630c69e06f5 (diff)
downloadbcm5719-llvm-73a316d712d5be9b8ec8446be6578e83fb885e9b.tar.gz
bcm5719-llvm-73a316d712d5be9b8ec8446be6578e83fb885e9b.zip
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(" / ")") llvm-svn: 21024
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter.cpp
index 4e77a78d81b..6b4afb7dd8f 100644
--- a/llvm/lib/CodeGen/AsmPrinter.cpp
+++ b/llvm/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<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: {
OpenPOWER on IntegriCloud