mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 12:50:30 +00:00
Operate on the Machine CFG instead of on the LLVM CFG
llvm-svn: 13302
This commit is contained in:
parent
769668c09a
commit
c09a94de9e
@ -17,6 +17,7 @@
|
||||
|
||||
#define DEBUG_TYPE "liveintervals"
|
||||
#include "LiveIntervals.h"
|
||||
#include "llvm/Value.h"
|
||||
#include "llvm/Analysis/LoopInfo.h"
|
||||
#include "llvm/CodeGen/LiveVariables.h"
|
||||
#include "llvm/CodeGen/MachineFrameInfo.h"
|
||||
@ -26,7 +27,6 @@
|
||||
#include "llvm/Target/MRegisterInfo.h"
|
||||
#include "llvm/Target/TargetInstrInfo.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Support/CFG.h"
|
||||
#include "Support/CommandLine.h"
|
||||
#include "Support/Debug.h"
|
||||
#include "Support/Statistic.h"
|
||||
@ -97,10 +97,9 @@ bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) {
|
||||
unsigned miIndex = 0;
|
||||
for (MachineFunction::iterator mbb = mf_->begin(), mbbEnd = mf_->end();
|
||||
mbb != mbbEnd; ++mbb) {
|
||||
const std::pair<MachineBasicBlock*, unsigned>& entry =
|
||||
lv_->getMachineBasicBlockInfo(mbb);
|
||||
bool inserted = mbbi2mbbMap_.insert(std::make_pair(entry.second,
|
||||
entry.first)).second;
|
||||
unsigned mbbIdx = lv_->getMachineBasicBlockIndex(mbb);
|
||||
bool inserted = mbbi2mbbMap_.insert(std::make_pair(mbbIdx,
|
||||
mbb)).second;
|
||||
assert(inserted && "multiple index -> MachineBasicBlock");
|
||||
|
||||
for (MachineBasicBlock::iterator mi = mbb->begin(), miEnd = mbb->end();
|
||||
@ -182,7 +181,7 @@ bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) {
|
||||
DEBUG(
|
||||
for (MachineFunction::iterator mbbi = mf_->begin(), mbbe = mf_->end();
|
||||
mbbi != mbbe; ++mbbi) {
|
||||
std::cerr << mbbi->getBasicBlock()->getName() << ":\n";
|
||||
std::cerr << ((Value*)mbbi->getBasicBlock())->getName() << ":\n";
|
||||
for (MachineBasicBlock::iterator mii = mbbi->begin(),
|
||||
mie = mbbi->end(); mii != mie; ++mii) {
|
||||
std::cerr << getInstructionIndex(mii) << '\t';
|
||||
@ -404,13 +403,13 @@ void LiveIntervals::computeIntervals()
|
||||
{
|
||||
DEBUG(std::cerr << "********** COMPUTING LIVE INTERVALS **********\n");
|
||||
DEBUG(std::cerr << "********** Function: "
|
||||
<< mf_->getFunction()->getName() << '\n');
|
||||
<< ((Value*)mf_->getFunction())->getName() << '\n');
|
||||
|
||||
for (MbbIndex2MbbMap::iterator
|
||||
it = mbbi2mbbMap_.begin(), itEnd = mbbi2mbbMap_.end();
|
||||
it != itEnd; ++it) {
|
||||
MachineBasicBlock* mbb = it->second;
|
||||
DEBUG(std::cerr << mbb->getBasicBlock()->getName() << ":\n");
|
||||
DEBUG(std::cerr << ((Value*)mbb->getBasicBlock())->getName() << ":\n");
|
||||
|
||||
for (MachineBasicBlock::iterator mi = mbb->begin(), miEnd = mbb->end();
|
||||
mi != miEnd; ++mi) {
|
||||
@ -451,7 +450,7 @@ void LiveIntervals::joinIntervals()
|
||||
for (MachineFunction::iterator mbbi = mf_->begin(), mbbe = mf_->end();
|
||||
mbbi != mbbe; ++mbbi) {
|
||||
MachineBasicBlock* mbb = mbbi;
|
||||
DEBUG(std::cerr << mbb->getBasicBlock()->getName() << ":\n");
|
||||
DEBUG(std::cerr << ((Value*)mbb->getBasicBlock())->getName() << ":\n");
|
||||
|
||||
for (MachineBasicBlock::iterator mi = mbb->begin(), mie = mbb->end();
|
||||
mi != mie; ++mi) {
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "llvm/CodeGen/LiveVariables.h"
|
||||
#include "llvm/Target/TargetInstrInfo.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Support/CFG.h"
|
||||
#include "Support/STLExtras.h"
|
||||
using namespace llvm;
|
||||
|
||||
@ -195,14 +194,12 @@ bool PNE::EliminatePHINodes(MachineFunction &MF, MachineBasicBlock &MBB) {
|
||||
// at an appropriate point later.
|
||||
//
|
||||
bool ValueIsLive = false;
|
||||
const BasicBlock *BB = opBlock.getBasicBlock();
|
||||
for (succ_const_iterator SI = succ_begin(BB), E = succ_end(BB);
|
||||
SI != E && !ValueIsLive; ++SI) {
|
||||
const std::pair<MachineBasicBlock*, unsigned> &
|
||||
SuccInfo = LV->getBasicBlockInfo(*SI);
|
||||
for (MachineBasicBlock::succ_iterator SI = opBlock.succ_begin(),
|
||||
E = opBlock.succ_end(); SI != E && !ValueIsLive; ++SI) {
|
||||
MachineBasicBlock *MBB = *SI;
|
||||
|
||||
// Is it alive in this successor?
|
||||
unsigned SuccIdx = SuccInfo.second;
|
||||
unsigned SuccIdx = LV->getMachineBasicBlockIndex(MBB);
|
||||
if (SuccIdx < InRegVI.AliveBlocks.size() &&
|
||||
InRegVI.AliveBlocks[SuccIdx]) {
|
||||
ValueIsLive = true;
|
||||
@ -210,7 +207,6 @@ bool PNE::EliminatePHINodes(MachineFunction &MF, MachineBasicBlock &MBB) {
|
||||
}
|
||||
|
||||
// Is it killed in this successor?
|
||||
MachineBasicBlock *MBB = SuccInfo.first;
|
||||
for (unsigned i = 0, e = InRegVI.Kills.size(); i != e; ++i)
|
||||
if (InRegVI.Kills[i].first == MBB) {
|
||||
ValueIsLive = true;
|
||||
|
Loading…
Reference in New Issue
Block a user