diff options
| author | Dan Bailey <dan@dneg.com> | 2011-11-11 14:45:12 +0000 |
|---|---|---|
| committer | Dan Bailey <dan@dneg.com> | 2011-11-11 14:45:12 +0000 |
| commit | 089cc5323220c2d94c9dce918b8ef2f35d3fe6cf (patch) | |
| tree | 5310ca0674b02473ae2338dbd521a303d4fb0850 /llvm/lib/Target/PTX/InstPrinter/PTXInstPrinter.cpp | |
| parent | 80cd65bfa9d97c520632e18000b4c571458882f5 (diff) | |
| download | bcm5719-llvm-089cc5323220c2d94c9dce918b8ef2f35d3fe6cf.tar.gz bcm5719-llvm-089cc5323220c2d94c9dce918b8ef2f35d3fe6cf.zip | |
allow non-device function calls in PTX when natively handling device-side printf
llvm-svn: 144388
Diffstat (limited to 'llvm/lib/Target/PTX/InstPrinter/PTXInstPrinter.cpp')
| -rw-r--r-- | llvm/lib/Target/PTX/InstPrinter/PTXInstPrinter.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/llvm/lib/Target/PTX/InstPrinter/PTXInstPrinter.cpp b/llvm/lib/Target/PTX/InstPrinter/PTXInstPrinter.cpp index aabb404dad6..2f6c92d11cc 100644 --- a/llvm/lib/Target/PTX/InstPrinter/PTXInstPrinter.cpp +++ b/llvm/lib/Target/PTX/InstPrinter/PTXInstPrinter.cpp @@ -96,9 +96,23 @@ void PTXInstPrinter::printCall(const MCInst *MI, raw_ostream &O) { O << "), "; } - O << *(MI->getOperand(Index++).getExpr()) << ", ("; - + const MCExpr* Expr = MI->getOperand(Index++).getExpr(); unsigned NumArgs = MI->getOperand(Index++).getImm(); + + // if the function call is to printf or puts, change to vprintf + if (const MCSymbolRefExpr *SymRefExpr = dyn_cast<MCSymbolRefExpr>(Expr)) { + const MCSymbol &Sym = SymRefExpr->getSymbol(); + if (Sym.getName() == "printf" || Sym.getName() == "puts") { + O << "vprintf"; + } else { + O << Sym.getName(); + } + } else { + O << *Expr; + } + + O << ", ("; + if (NumArgs > 0) { printOperand(MI, Index++, O); for (unsigned i = 1; i < NumArgs; ++i) { |

