mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-31 15:53:42 +00:00
A single MachineInstr operand may now be both a def and a use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2825 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5023bd4a64
commit
9afa88c3a7
@ -7,6 +7,7 @@
|
||||
#include "BBLiveVar.h"
|
||||
#include "llvm/Analysis/LiveVar/FunctionLiveVarInfo.h"
|
||||
#include "llvm/CodeGen/MachineInstr.h"
|
||||
#include "llvm/CodeGen/MachineCodeForBasicBlock.h"
|
||||
#include "llvm/Support/CFG.h"
|
||||
#include "Support/SetOperations.h"
|
||||
#include <iostream>
|
||||
@ -50,7 +51,7 @@ BBLiveVar::BBLiveVar(const BasicBlock &bb, unsigned id)
|
||||
|
||||
void BBLiveVar::calcDefUseSets() {
|
||||
// get the iterator for machine instructions
|
||||
const MachineCodeForBasicBlock &MIVec = BB.getMachineInstrVec();
|
||||
const MachineCodeForBasicBlock &MIVec = MachineCodeForBasicBlock::get(&BB);
|
||||
|
||||
// iterate over all the machine instructions in BB
|
||||
for (MachineCodeForBasicBlock::const_reverse_iterator MII = MIVec.rbegin(),
|
||||
@ -82,13 +83,13 @@ void BBLiveVar::calcDefUseSets() {
|
||||
if (isa<BasicBlock>(Op))
|
||||
continue; // don't process labels
|
||||
|
||||
if (!OpI.isDef()) { // add to Uses only if this operand is a use
|
||||
|
||||
if (!OpI.isDef() || OpI.isDefAndUse()) {
|
||||
// add to Uses only if this operand is a use
|
||||
//
|
||||
// *** WARNING: The following code for handling dummy PHI machine
|
||||
// instructions is untested. The previous code was broken and I
|
||||
// fixed it, but it turned out to be unused as long as Phi elimination
|
||||
// is performed during instruction selection.
|
||||
// fixed it, but it turned out to be unused as long as Phi
|
||||
// elimination is performed during instruction selection.
|
||||
//
|
||||
// Put Phi operands in UseSet for the incoming edge, not node.
|
||||
// They must not "hide" later defs, and must be handled specially
|
||||
@ -118,7 +119,7 @@ void BBLiveVar::calcDefUseSets() {
|
||||
if (Op->getType() == Type::LabelTy) // don't process labels
|
||||
continue;
|
||||
|
||||
if (!MI->implicitRefIsDefined(i))
|
||||
if (!MI->implicitRefIsDefined(i) || MI->implicitRefIsDefinedAndUsed(i) )
|
||||
addUse(Op);
|
||||
}
|
||||
} // for all machine instructions
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "llvm/Analysis/LiveVar/FunctionLiveVarInfo.h"
|
||||
#include "BBLiveVar.h"
|
||||
#include "llvm/CodeGen/MachineInstr.h"
|
||||
#include "llvm/CodeGen/MachineCodeForBasicBlock.h"
|
||||
#include "llvm/Support/CFG.h"
|
||||
#include "Support/PostOrderIterator.h"
|
||||
#include "Support/SetOperations.h"
|
||||
@ -216,13 +217,15 @@ static void applyTranferFuncForMInst(ValueSet &LVS, const MachineInstr *MInst) {
|
||||
for (MachineInstr::const_val_op_iterator OpI = MInst->begin(),
|
||||
OpE = MInst->end(); OpI != OpE; ++OpI) {
|
||||
if (!isa<BasicBlock>(*OpI)) // don't process labels
|
||||
if (!OpI.isDef()) // add only if this operand is a use
|
||||
// add only if this operand is a use
|
||||
if (!OpI.isDef() || OpI.isDefAndUse() )
|
||||
LVS.insert(*OpI); // An operand is a use - so add to use set
|
||||
}
|
||||
|
||||
// do for implicit operands as well
|
||||
for (unsigned i = 0, e = MInst->getNumImplicitRefs(); i != e; ++i)
|
||||
if (!MInst->implicitRefIsDefined(i))
|
||||
if (!MInst->implicitRefIsDefined(i) ||
|
||||
MInst->implicitRefIsDefinedAndUsed(i))
|
||||
LVS.insert(MInst->getImplicitRef(i));
|
||||
}
|
||||
|
||||
@ -233,7 +236,7 @@ static void applyTranferFuncForMInst(ValueSet &LVS, const MachineInstr *MInst) {
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void FunctionLiveVarInfo::calcLiveVarSetsForBB(const BasicBlock *BB) {
|
||||
const MachineCodeForBasicBlock &MIVec = BB->getMachineInstrVec();
|
||||
const MachineCodeForBasicBlock &MIVec = MachineCodeForBasicBlock::get(BB);
|
||||
|
||||
if (DEBUG_LV >= LV_DEBUG_Instr)
|
||||
std::cerr << "\n======For BB " << BB->getName()
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "BBLiveVar.h"
|
||||
#include "llvm/Analysis/LiveVar/FunctionLiveVarInfo.h"
|
||||
#include "llvm/CodeGen/MachineInstr.h"
|
||||
#include "llvm/CodeGen/MachineCodeForBasicBlock.h"
|
||||
#include "llvm/Support/CFG.h"
|
||||
#include "Support/SetOperations.h"
|
||||
#include <iostream>
|
||||
@ -50,7 +51,7 @@ BBLiveVar::BBLiveVar(const BasicBlock &bb, unsigned id)
|
||||
|
||||
void BBLiveVar::calcDefUseSets() {
|
||||
// get the iterator for machine instructions
|
||||
const MachineCodeForBasicBlock &MIVec = BB.getMachineInstrVec();
|
||||
const MachineCodeForBasicBlock &MIVec = MachineCodeForBasicBlock::get(&BB);
|
||||
|
||||
// iterate over all the machine instructions in BB
|
||||
for (MachineCodeForBasicBlock::const_reverse_iterator MII = MIVec.rbegin(),
|
||||
@ -82,13 +83,13 @@ void BBLiveVar::calcDefUseSets() {
|
||||
if (isa<BasicBlock>(Op))
|
||||
continue; // don't process labels
|
||||
|
||||
if (!OpI.isDef()) { // add to Uses only if this operand is a use
|
||||
|
||||
if (!OpI.isDef() || OpI.isDefAndUse()) {
|
||||
// add to Uses only if this operand is a use
|
||||
//
|
||||
// *** WARNING: The following code for handling dummy PHI machine
|
||||
// instructions is untested. The previous code was broken and I
|
||||
// fixed it, but it turned out to be unused as long as Phi elimination
|
||||
// is performed during instruction selection.
|
||||
// fixed it, but it turned out to be unused as long as Phi
|
||||
// elimination is performed during instruction selection.
|
||||
//
|
||||
// Put Phi operands in UseSet for the incoming edge, not node.
|
||||
// They must not "hide" later defs, and must be handled specially
|
||||
@ -118,7 +119,7 @@ void BBLiveVar::calcDefUseSets() {
|
||||
if (Op->getType() == Type::LabelTy) // don't process labels
|
||||
continue;
|
||||
|
||||
if (!MI->implicitRefIsDefined(i))
|
||||
if (!MI->implicitRefIsDefined(i) || MI->implicitRefIsDefinedAndUsed(i) )
|
||||
addUse(Op);
|
||||
}
|
||||
} // for all machine instructions
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "llvm/Analysis/LiveVar/FunctionLiveVarInfo.h"
|
||||
#include "BBLiveVar.h"
|
||||
#include "llvm/CodeGen/MachineInstr.h"
|
||||
#include "llvm/CodeGen/MachineCodeForBasicBlock.h"
|
||||
#include "llvm/Support/CFG.h"
|
||||
#include "Support/PostOrderIterator.h"
|
||||
#include "Support/SetOperations.h"
|
||||
@ -216,13 +217,15 @@ static void applyTranferFuncForMInst(ValueSet &LVS, const MachineInstr *MInst) {
|
||||
for (MachineInstr::const_val_op_iterator OpI = MInst->begin(),
|
||||
OpE = MInst->end(); OpI != OpE; ++OpI) {
|
||||
if (!isa<BasicBlock>(*OpI)) // don't process labels
|
||||
if (!OpI.isDef()) // add only if this operand is a use
|
||||
// add only if this operand is a use
|
||||
if (!OpI.isDef() || OpI.isDefAndUse() )
|
||||
LVS.insert(*OpI); // An operand is a use - so add to use set
|
||||
}
|
||||
|
||||
// do for implicit operands as well
|
||||
for (unsigned i = 0, e = MInst->getNumImplicitRefs(); i != e; ++i)
|
||||
if (!MInst->implicitRefIsDefined(i))
|
||||
if (!MInst->implicitRefIsDefined(i) ||
|
||||
MInst->implicitRefIsDefinedAndUsed(i))
|
||||
LVS.insert(MInst->getImplicitRef(i));
|
||||
}
|
||||
|
||||
@ -233,7 +236,7 @@ static void applyTranferFuncForMInst(ValueSet &LVS, const MachineInstr *MInst) {
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void FunctionLiveVarInfo::calcLiveVarSetsForBB(const BasicBlock *BB) {
|
||||
const MachineCodeForBasicBlock &MIVec = BB->getMachineInstrVec();
|
||||
const MachineCodeForBasicBlock &MIVec = MachineCodeForBasicBlock::get(BB);
|
||||
|
||||
if (DEBUG_LV >= LV_DEBUG_Instr)
|
||||
std::cerr << "\n======For BB " << BB->getName()
|
||||
|
Loading…
x
Reference in New Issue
Block a user