mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-12 15:30:46 +00:00
[NVPTX] Remove dead code.
I've chosen to remove NVPTXInstrInfo::CanTailMerge but not NVPTXInstrInfo::isLoadInstr and isStoreInstr (which are also dead) because while the latter two are reasonably useful utilities, the former cannot be used safely: It relies on successful address space inference to identify writes to shared memory, but addrspace inference is a best-effort thing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289740 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
61cd9ae50b
commit
8c54b40add
@ -110,19 +110,6 @@ bool NVPTXInstrInfo::isStoreInstr(const MachineInstr &MI,
|
||||
return isStore;
|
||||
}
|
||||
|
||||
bool NVPTXInstrInfo::CanTailMerge(const MachineInstr *MI) const {
|
||||
unsigned addrspace = 0;
|
||||
if (MI->getOpcode() == NVPTX::INT_BARRIER0)
|
||||
return false;
|
||||
if (isLoadInstr(*MI, addrspace))
|
||||
if (addrspace == NVPTX::PTXLdStInstCode::SHARED)
|
||||
return false;
|
||||
if (isStoreInstr(*MI, addrspace))
|
||||
if (addrspace == NVPTX::PTXLdStInstCode::SHARED)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// AnalyzeBranch - Analyze the branching code at the end of MBB, returning
|
||||
/// true if it cannot be understood (e.g. it's a switch dispatch or isn't
|
||||
/// implemented for a target). Upon success, this returns false and returns
|
||||
|
@ -57,7 +57,6 @@ public:
|
||||
bool isLoadInstr(const MachineInstr &MI, unsigned &AddrSpace) const;
|
||||
bool isStoreInstr(const MachineInstr &MI, unsigned &AddrSpace) const;
|
||||
|
||||
virtual bool CanTailMerge(const MachineInstr *MI) const;
|
||||
// Branch analysis.
|
||||
bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
|
||||
MachineBasicBlock *&FBB,
|
||||
|
@ -314,110 +314,4 @@ bool getAlign(const CallInst &I, unsigned index, unsigned &align) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// The following are some useful utilities for debugging
|
||||
|
||||
BasicBlock *getParentBlock(Value *v) {
|
||||
if (BasicBlock *B = dyn_cast<BasicBlock>(v))
|
||||
return B;
|
||||
|
||||
if (Instruction *I = dyn_cast<Instruction>(v))
|
||||
return I->getParent();
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Function *getParentFunction(Value *v) {
|
||||
if (Function *F = dyn_cast<Function>(v))
|
||||
return F;
|
||||
|
||||
if (Instruction *I = dyn_cast<Instruction>(v))
|
||||
return I->getParent()->getParent();
|
||||
|
||||
if (BasicBlock *B = dyn_cast<BasicBlock>(v))
|
||||
return B->getParent();
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Dump a block by name
|
||||
void dumpBlock(Value *v, char *blockName) {
|
||||
Function *F = getParentFunction(v);
|
||||
if (!F)
|
||||
return;
|
||||
|
||||
for (Function::iterator it = F->begin(), ie = F->end(); it != ie; ++it) {
|
||||
BasicBlock *B = &*it;
|
||||
if (strcmp(B->getName().data(), blockName) == 0) {
|
||||
B->dump();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Find an instruction by name
|
||||
Instruction *getInst(Value *base, char *instName) {
|
||||
Function *F = getParentFunction(base);
|
||||
if (!F)
|
||||
return nullptr;
|
||||
|
||||
for (inst_iterator it = inst_begin(F), ie = inst_end(F); it != ie; ++it) {
|
||||
Instruction *I = &*it;
|
||||
if (strcmp(I->getName().data(), instName) == 0) {
|
||||
return I;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Dump an instruction by name
|
||||
void dumpInst(Value *base, char *instName) {
|
||||
Instruction *I = getInst(base, instName);
|
||||
if (I)
|
||||
I->dump();
|
||||
}
|
||||
|
||||
// Dump an instruction and all dependent instructions
|
||||
void dumpInstRec(Value *v, std::set<Instruction *> *visited) {
|
||||
if (Instruction *I = dyn_cast<Instruction>(v)) {
|
||||
|
||||
if (visited->find(I) != visited->end())
|
||||
return;
|
||||
|
||||
visited->insert(I);
|
||||
|
||||
for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i)
|
||||
dumpInstRec(I->getOperand(i), visited);
|
||||
|
||||
I->dump();
|
||||
}
|
||||
}
|
||||
|
||||
// Dump an instruction and all dependent instructions
|
||||
void dumpInstRec(Value *v) {
|
||||
std::set<Instruction *> visited;
|
||||
|
||||
//BasicBlock *B = getParentBlock(v);
|
||||
|
||||
dumpInstRec(v, &visited);
|
||||
}
|
||||
|
||||
// Dump the parent for Instruction, block or function
|
||||
void dumpParent(Value *v) {
|
||||
if (Instruction *I = dyn_cast<Instruction>(v)) {
|
||||
I->getParent()->dump();
|
||||
return;
|
||||
}
|
||||
|
||||
if (BasicBlock *B = dyn_cast<BasicBlock>(v)) {
|
||||
B->getParent()->dump();
|
||||
return;
|
||||
}
|
||||
|
||||
if (Function *F = dyn_cast<Function>(v)) {
|
||||
F->getParent()->dump();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace llvm
|
||||
|
@ -63,15 +63,6 @@ bool isKernelFunction(const Function &);
|
||||
bool getAlign(const Function &, unsigned index, unsigned &);
|
||||
bool getAlign(const CallInst &, unsigned index, unsigned &);
|
||||
|
||||
BasicBlock *getParentBlock(Value *v);
|
||||
Function *getParentFunction(Value *v);
|
||||
void dumpBlock(Value *v, char *blockName);
|
||||
Instruction *getInst(Value *base, char *instName);
|
||||
void dumpInst(Value *base, char *instName);
|
||||
void dumpInstRec(Value *v, std::set<Instruction *> *visited);
|
||||
void dumpInstRec(Value *v);
|
||||
void dumpParent(Value *v);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -65,7 +65,6 @@ public:
|
||||
bool runOnFunction(Function &) override;
|
||||
|
||||
private:
|
||||
bool handleFunction(Function *ReflectFunction);
|
||||
void setVarMap();
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user