[llvm] r205216 - PR19099 - revert r203483
Eli Bendersky
eliben at google.com
Mon Mar 31 09:11:58 PDT 2014
Author: eliben
Date: Mon Mar 31 11:11:57 2014
New Revision: 205216
URL: http://llvm.org/viewvc/llvm-project?rev=205216&view=rev
Log:
PR19099 - revert r203483
Now that r205212 was committed, r203483 is no longer necessary; it was a
temporary workaround that only handled a small number of the problematic cases.
Modified:
llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.h
Modified: llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp?rev=205216&r1=205215&r2=205216&view=diff
==============================================================================
--- llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp Mon Mar 31 11:11:57 2014
@@ -684,7 +684,7 @@ void NVPTXAsmPrinter::emitDeclaration(co
else
O << ".func ";
printReturnValStr(F, O);
- O << getSymbolName(F) << "\n";
+ O << *getSymbol(F) << "\n";
emitFunctionParamList(F, O);
O << ";\n";
}
@@ -1203,7 +1203,7 @@ void NVPTXAsmPrinter::printModuleLevelGV
else
O << getPTXFundamentalTypeStr(ETy, false);
O << " ";
- O << getSymbolName(GVar);
+ O << *getSymbol(GVar);
// Ptx allows variable initilization only for constant and global state
// spaces.
@@ -1239,15 +1239,15 @@ void NVPTXAsmPrinter::printModuleLevelGV
bufferAggregateConstant(Initializer, &aggBuffer);
if (aggBuffer.numSymbols) {
if (nvptxSubtarget.is64Bit()) {
- O << " .u64 " << getSymbolName(GVar) << "[";
+ O << " .u64 " << *getSymbol(GVar) << "[";
O << ElementSize / 8;
} else {
- O << " .u32 " << getSymbolName(GVar) << "[";
+ O << " .u32 " << *getSymbol(GVar) << "[";
O << ElementSize / 4;
}
O << "]";
} else {
- O << " .b8 " << getSymbolName(GVar) << "[";
+ O << " .b8 " << *getSymbol(GVar) << "[";
O << ElementSize;
O << "]";
}
@@ -1255,7 +1255,7 @@ void NVPTXAsmPrinter::printModuleLevelGV
aggBuffer.print();
O << "}";
} else {
- O << " .b8 " << getSymbolName(GVar);
+ O << " .b8 " << *getSymbol(GVar);
if (ElementSize) {
O << "[";
O << ElementSize;
@@ -1263,7 +1263,7 @@ void NVPTXAsmPrinter::printModuleLevelGV
}
}
} else {
- O << " .b8 " << getSymbolName(GVar);
+ O << " .b8 " << *getSymbol(GVar);
if (ElementSize) {
O << "[";
O << ElementSize;
@@ -1370,7 +1370,7 @@ void NVPTXAsmPrinter::emitPTXGlobalVaria
O << " .";
O << getPTXFundamentalTypeStr(ETy);
O << " ";
- O << getSymbolName(GVar);
+ O << *getSymbol(GVar);
return;
}
@@ -1385,7 +1385,7 @@ void NVPTXAsmPrinter::emitPTXGlobalVaria
case Type::ArrayTyID:
case Type::VectorTyID:
ElementSize = TD->getTypeStoreSize(ETy);
- O << " .b8 " << getSymbolName(GVar) << "[";
+ O << " .b8 " << *getSymbol(GVar) << "[";
if (ElementSize) {
O << itostr(ElementSize);
}
@@ -1440,7 +1440,7 @@ void NVPTXAsmPrinter::printParamName(Fun
int paramIndex, raw_ostream &O) {
if ((nvptxSubtarget.getDrvInterface() == NVPTX::NVCL) ||
(nvptxSubtarget.getDrvInterface() == NVPTX::CUDA))
- O << getSymbolName(I->getParent()) << "_param_" << paramIndex;
+ O << *getSymbol(I->getParent()) << "_param_" << paramIndex;
else {
std::string argName = I->getName();
const char *p = argName.c_str();
@@ -1499,13 +1499,13 @@ void NVPTXAsmPrinter::emitFunctionParamL
if (llvm::isImage(*I)) {
std::string sname = I->getName();
if (llvm::isImageWriteOnly(*I))
- O << "\t.param .surfref " << getSymbolName(F) << "_param_"
+ O << "\t.param .surfref " << *getSymbol(F) << "_param_"
<< paramIndex;
else // Default image is read_only
- O << "\t.param .texref " << getSymbolName(F) << "_param_"
+ O << "\t.param .texref " << *getSymbol(F) << "_param_"
<< paramIndex;
} else // Should be llvm::isSampler(*I)
- O << "\t.param .samplerref " << getSymbolName(F) << "_param_"
+ O << "\t.param .samplerref " << *getSymbol(F) << "_param_"
<< paramIndex;
continue;
}
@@ -1752,13 +1752,13 @@ void NVPTXAsmPrinter::printScalarConstan
return;
}
if (const GlobalValue *GVar = dyn_cast<GlobalValue>(CPV)) {
- O << getSymbolName(GVar);
+ O << *getSymbol(GVar);
return;
}
if (const ConstantExpr *Cexpr = dyn_cast<ConstantExpr>(CPV)) {
const Value *v = Cexpr->stripPointerCasts();
if (const GlobalValue *GVar = dyn_cast<GlobalValue>(v)) {
- O << getSymbolName(GVar);
+ O << *getSymbol(GVar);
return;
} else {
O << *LowerConstant(CPV, *this);
@@ -2072,7 +2072,7 @@ void NVPTXAsmPrinter::printOperand(const
break;
case MachineOperand::MO_GlobalAddress:
- O << getSymbolName(MO.getGlobal());
+ O << *getSymbol(MO.getGlobal());
break;
case MachineOperand::MO_MachineBasicBlock:
@@ -2133,33 +2133,6 @@ LineReader *NVPTXAsmPrinter::getReader(s
return reader;
}
-std::string NVPTXAsmPrinter::getSymbolName(const GlobalValue *GV) const {
- // Obtain the original symbol name.
- MCSymbol *Sym = getSymbol(GV);
- std::string OriginalName;
- raw_string_ostream OriginalNameStream(OriginalName);
- Sym->print(OriginalNameStream);
- OriginalNameStream.flush();
-
- // MCSymbol already does symbol-name sanitizing, so names it produces are
- // valid for object files. The only two characters valida in that context
- // and indigestible by the PTX assembler are '.' and '@'.
- std::string CleanName;
- raw_string_ostream CleanNameStream(CleanName);
- for (unsigned I = 0, E = OriginalName.size(); I != E; ++I) {
- char C = OriginalName[I];
- if (C == '.') {
- CleanNameStream << "_$_";
- } else if (C == '@') {
- CleanNameStream << "_%_";
- } else {
- CleanNameStream << C;
- }
- }
-
- return CleanNameStream.str();
-}
-
std::string LineReader::readLine(unsigned lineNum) {
if (lineNum < theCurLine) {
theCurLine = 0;
Modified: llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.h?rev=205216&r1=205215&r2=205216&view=diff
==============================================================================
--- llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.h (original)
+++ llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.h Mon Mar 31 11:11:57 2014
@@ -276,11 +276,6 @@ private:
LineReader *reader;
LineReader *getReader(std::string);
-
- // Get the symbol name of the given global symbol.
- //
- // Cleans up the name so it's a valid in PTX assembly.
- std::string getSymbolName(const GlobalValue *GV) const;
public:
NVPTXAsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
: AsmPrinter(TM, Streamer),
More information about the llvm-commits
mailing list