mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 20:23:11 +01:00
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. llvm-svn: 205216
This commit is contained in:
parent
c4f1a539d2
commit
e88e55d85c
@ -684,7 +684,7 @@ void NVPTXAsmPrinter::emitDeclaration(const Function *F, raw_ostream &O) {
|
||||
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(const GlobalVariable *GVar,
|
||||
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(const GlobalVariable *GVar,
|
||||
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(const GlobalVariable *GVar,
|
||||
aggBuffer.print();
|
||||
O << "}";
|
||||
} else {
|
||||
O << " .b8 " << getSymbolName(GVar);
|
||||
O << " .b8 " << *getSymbol(GVar);
|
||||
if (ElementSize) {
|
||||
O << "[";
|
||||
O << ElementSize;
|
||||
@ -1263,7 +1263,7 @@ void NVPTXAsmPrinter::printModuleLevelGV(const GlobalVariable *GVar,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
O << " .b8 " << getSymbolName(GVar);
|
||||
O << " .b8 " << *getSymbol(GVar);
|
||||
if (ElementSize) {
|
||||
O << "[";
|
||||
O << ElementSize;
|
||||
@ -1370,7 +1370,7 @@ void NVPTXAsmPrinter::emitPTXGlobalVariable(const GlobalVariable *GVar,
|
||||
O << " .";
|
||||
O << getPTXFundamentalTypeStr(ETy);
|
||||
O << " ";
|
||||
O << getSymbolName(GVar);
|
||||
O << *getSymbol(GVar);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1385,7 +1385,7 @@ void NVPTXAsmPrinter::emitPTXGlobalVariable(const GlobalVariable *GVar,
|
||||
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(Function::const_arg_iterator I,
|
||||
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::emitFunctionParamList(const Function *F, raw_ostream &O) {
|
||||
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::printScalarConstant(const Constant *CPV, raw_ostream &O) {
|
||||
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 MachineInstr *MI, int opNum,
|
||||
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(std::string filename) {
|
||||
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;
|
||||
|
@ -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),
|
||||
|
Loading…
Reference in New Issue
Block a user