summaryrefslogtreecommitdiff
path: root/lib/Target
diff options
context:
space:
mode:
authorVikram S. Adve <vadve@cs.uiuc.edu>2002-07-08 22:56:34 +0000
committerVikram S. Adve <vadve@cs.uiuc.edu>2002-07-08 22:56:34 +0000
commit9afa88c3a73187b9454085651807896002e020ca (patch)
treef3ed8a8de43d3ed48cb6b6dc841157ae28b70d81 /lib/Target
parent5023bd4a64e6a6926c5a158bbe9957136e554f10 (diff)
downloadllvm-9afa88c3a73187b9454085651807896002e020ca.tar.gz
llvm-9afa88c3a73187b9454085651807896002e020ca.tar.bz2
llvm-9afa88c3a73187b9454085651807896002e020ca.tar.xz
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
Diffstat (limited to 'lib/Target')
-rw-r--r--lib/Target/SparcV9/LiveVar/BBLiveVar.cpp13
-rw-r--r--lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp9
2 files changed, 13 insertions, 9 deletions
diff --git a/lib/Target/SparcV9/LiveVar/BBLiveVar.cpp b/lib/Target/SparcV9/LiveVar/BBLiveVar.cpp
index efad03616b..0b2979bf39 100644
--- a/lib/Target/SparcV9/LiveVar/BBLiveVar.cpp
+++ b/lib/Target/SparcV9/LiveVar/BBLiveVar.cpp
@@ -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
diff --git a/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp b/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp
index 297b64a93c..774bdc7cd7 100644
--- a/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp
+++ b/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp
@@ -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()