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
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
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