summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2018-06-04 16:12:33 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2018-06-04 16:12:33 +0000
commit38eba07f5f0267f415b9b3eac7820fb1caccdb91 (patch)
tree6f4adac95f806017f6262dee8217285ce42d4c92
parent47acfadfe75390a1f2133566c88824f6ea8e0ee1 (diff)
[NVPTX] Delete dead code from the AsmPrinter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333924 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/NVPTX/NVPTXAsmPrinter.cpp98
-rw-r--r--lib/Target/NVPTX/NVPTXAsmPrinter.h44
2 files changed, 0 insertions, 142 deletions
diff --git a/lib/Target/NVPTX/NVPTXAsmPrinter.cpp b/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
index a346e3335e1..beba5ef4c46 100644
--- a/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
+++ b/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
@@ -84,7 +84,6 @@
#include <cstdint>
#include <cstring>
#include <new>
-#include <sstream>
#include <string>
#include <utility>
#include <vector>
@@ -1960,65 +1959,6 @@ void NVPTXAsmPrinter::bufferAggregateConstant(const Constant *CPV,
llvm_unreachable("unsupported constant type in printAggregateConstant()");
}
-// buildTypeNameMap - Run through symbol table looking for type names.
-//
-
-bool NVPTXAsmPrinter::ignoreLoc(const MachineInstr &MI) {
- switch (MI.getOpcode()) {
- default:
- return false;
- case NVPTX::CallArgBeginInst:
- case NVPTX::CallArgEndInst0:
- case NVPTX::CallArgEndInst1:
- case NVPTX::CallArgF32:
- case NVPTX::CallArgF64:
- case NVPTX::CallArgI16:
- case NVPTX::CallArgI32:
- case NVPTX::CallArgI32imm:
- case NVPTX::CallArgI64:
- case NVPTX::CallArgParam:
- case NVPTX::CallVoidInst:
- case NVPTX::CallVoidInstReg:
- case NVPTX::Callseq_End:
- case NVPTX::CallVoidInstReg64:
- case NVPTX::DeclareParamInst:
- case NVPTX::DeclareRetMemInst:
- case NVPTX::DeclareRetRegInst:
- case NVPTX::DeclareRetScalarInst:
- case NVPTX::DeclareScalarParamInst:
- case NVPTX::DeclareScalarRegInst:
- case NVPTX::StoreParamF32:
- case NVPTX::StoreParamF64:
- case NVPTX::StoreParamI16:
- case NVPTX::StoreParamI32:
- case NVPTX::StoreParamI64:
- case NVPTX::StoreParamI8:
- case NVPTX::StoreRetvalF32:
- case NVPTX::StoreRetvalF64:
- case NVPTX::StoreRetvalI16:
- case NVPTX::StoreRetvalI32:
- case NVPTX::StoreRetvalI64:
- case NVPTX::StoreRetvalI8:
- case NVPTX::LastCallArgF32:
- case NVPTX::LastCallArgF64:
- case NVPTX::LastCallArgI16:
- case NVPTX::LastCallArgI32:
- case NVPTX::LastCallArgI32imm:
- case NVPTX::LastCallArgI64:
- case NVPTX::LastCallArgParam:
- case NVPTX::LoadParamMemF32:
- case NVPTX::LoadParamMemF64:
- case NVPTX::LoadParamMemI16:
- case NVPTX::LoadParamMemI32:
- case NVPTX::LoadParamMemI64:
- case NVPTX::LoadParamMemI8:
- case NVPTX::PrototypeInst:
- case NVPTX::DBG_VALUE:
- return true;
- }
- return false;
-}
-
/// lowerConstantForGV - Return an MCExpr for the given Constant. This is mostly
/// a copy from AsmPrinter::lowerConstant, except customized to only handle
/// expressions that are representable in PTX and create
@@ -2319,44 +2259,6 @@ void NVPTXAsmPrinter::printMemOperand(const MachineInstr *MI, int opNum,
}
}
-void NVPTXAsmPrinter::emitSrcInText(StringRef filename, unsigned line) {
- std::stringstream temp;
- LineReader *reader = this->getReader(filename);
- temp << "\n//";
- temp << filename.str();
- temp << ":";
- temp << line;
- temp << " ";
- temp << reader->readLine(line);
- temp << "\n";
- this->OutStreamer->EmitRawText(temp.str());
-}
-
-LineReader *NVPTXAsmPrinter::getReader(const std::string &filename) {
- if (!reader) {
- reader = new LineReader(filename);
- }
-
- if (reader->fileName() != filename) {
- delete reader;
- reader = new LineReader(filename);
- }
-
- return reader;
-}
-
-std::string LineReader::readLine(unsigned lineNum) {
- if (lineNum < theCurLine) {
- theCurLine = 0;
- fstr.seekg(0, std::ios::beg);
- }
- while (theCurLine < lineNum) {
- fstr.getline(buff, 500);
- theCurLine++;
- }
- return buff;
-}
-
// Force static initialization.
extern "C" void LLVMInitializeNVPTXAsmPrinter() {
RegisterAsmPrinter<NVPTXAsmPrinter> X(getTheNVPTXTarget32());
diff --git a/lib/Target/NVPTX/NVPTXAsmPrinter.h b/lib/Target/NVPTX/NVPTXAsmPrinter.h
index 9fe9c1e736f..02d1a041a15 100644
--- a/lib/Target/NVPTX/NVPTXAsmPrinter.h
+++ b/lib/Target/NVPTX/NVPTXAsmPrinter.h
@@ -41,7 +41,6 @@
#include "llvm/Target/TargetMachine.h"
#include <algorithm>
#include <cassert>
-#include <fstream>
#include <map>
#include <memory>
#include <string>
@@ -60,27 +59,6 @@ namespace llvm {
class MCOperand;
-class LineReader {
-private:
- unsigned theCurLine;
- std::ifstream fstr;
- char buff[512];
- std::string theFileName;
- SmallVector<unsigned, 32> lineOffset;
-
-public:
- LineReader(std::string filename) {
- theCurLine = 0;
- fstr.open(filename.c_str());
- theFileName = filename;
- }
-
- ~LineReader() { fstr.close(); }
-
- std::string fileName() { return theFileName; }
- std::string readLine(unsigned line);
-};
-
class LLVM_LIBRARY_VISIBILITY NVPTXAsmPrinter : public AsmPrinter {
class AggBuffer {
@@ -217,8 +195,6 @@ class LLVM_LIBRARY_VISIBILITY NVPTXAsmPrinter : public AsmPrinter {
friend class AggBuffer;
- void emitSrcInText(StringRef filename, unsigned line);
-
private:
StringRef getPassName() const override { return "NVPTX Assembly Printer"; }
@@ -271,8 +247,6 @@ protected:
bool doFinalization(Module &M) override;
private:
- std::string CurrentBankselLabelInBasicBlock;
-
bool GlobalsEmitted;
// This is specific per MachineFunction.
@@ -287,17 +261,9 @@ private:
// Cache the subtarget here.
const NVPTXSubtarget *nvptxSubtarget;
- // Build the map between type name and ID based on module's type
- // symbol table.
- std::map<Type *, std::string> TypeNameMap;
-
// List of variables demoted to a function scope.
std::map<const Function *, std::vector<const GlobalVariable *>> localDecls;
- // To record filename to ID mapping
- std::map<std::string, unsigned> filenameMap;
- void recordAndEmitFilenames(Module &);
-
void emitPTXGlobalVariable(const GlobalVariable *GVar, raw_ostream &O);
void emitPTXAddressSpace(unsigned int AddressSpace, raw_ostream &O) const;
std::string getPTXFundamentalTypeStr(Type *Ty, bool = true) const;
@@ -317,10 +283,6 @@ private:
bool isLoopHeaderOfNoUnroll(const MachineBasicBlock &MBB) const;
- LineReader *reader = nullptr;
-
- LineReader *getReader(const std::string &);
-
// Used to control the need to emit .generic() in the initializer of
// module scope variables.
// Although ptx supports the hybrid mode like the following,
@@ -340,10 +302,6 @@ public:
EmitGeneric(static_cast<NVPTXTargetMachine &>(TM).getDrvInterface() ==
NVPTX::CUDA) {}
- ~NVPTXAsmPrinter() override {
- delete reader;
- }
-
bool runOnMachineFunction(MachineFunction &F) override;
void getAnalysisUsage(AnalysisUsage &AU) const override {
@@ -351,8 +309,6 @@ public:
AsmPrinter::getAnalysisUsage(AU);
}
- bool ignoreLoc(const MachineInstr &);
-
std::string getVirtualRegisterName(unsigned) const;
};