projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix bug in kill flag updating for post-register-allocation scheduling. When the kill...
[oota-llvm.git]
/
lib
/
CodeGen
/
MachineModuleInfo.cpp
diff --git
a/lib/CodeGen/MachineModuleInfo.cpp
b/lib/CodeGen/MachineModuleInfo.cpp
index 66dd8375eb509771e9c153b4ddf345977c71c649..0a8bf5a3d89aaf2168dd586573b7d68471579d5e 100644
(file)
--- a/
lib/CodeGen/MachineModuleInfo.cpp
+++ b/
lib/CodeGen/MachineModuleInfo.cpp
@@
-24,7
+24,6
@@
#include "llvm/Module.h"
#include "llvm/Support/Dwarf.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Module.h"
#include "llvm/Support/Dwarf.h"
#include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/Streams.h"
using namespace llvm;
using namespace llvm::dwarf;
using namespace llvm;
using namespace llvm::dwarf;
@@
-33,23
+32,23
@@
static RegisterPass<MachineModuleInfo>
X("machinemoduleinfo", "Module Information");
char MachineModuleInfo::ID = 0;
X("machinemoduleinfo", "Module Information");
char MachineModuleInfo::ID = 0;
+// Out of line virtual method.
+MachineModuleInfoImpl::~MachineModuleInfoImpl() {}
+
//===----------------------------------------------------------------------===//
//===----------------------------------------------------------------------===//
-
+
MachineModuleInfo::MachineModuleInfo()
: ImmutablePass(&ID)
MachineModuleInfo::MachineModuleInfo()
: ImmutablePass(&ID)
-, LabelIDList()
-, FrameMoves()
-, LandingPads()
-, Personalities()
+, ObjFileMMI(0)
, CallsEHReturn(0)
, CallsUnwindInit(0)
, CallsEHReturn(0)
, CallsUnwindInit(0)
-, DbgInfoAvailable(false)
-{
- // Always emit "no personality" info
+, DbgInfoAvailable(false) {
+ // Always emit some info, by default "no personality" info.
Personalities.push_back(NULL);
}
Personalities.push_back(NULL);
}
-MachineModuleInfo::~MachineModuleInfo() {
+MachineModuleInfo::~MachineModuleInfo() {
+ delete ObjFileMMI;
}
/// doInitialization - Initialize the state for a new module.
}
/// doInitialization - Initialize the state for a new module.
@@
-75,7
+74,7
@@
void MachineModuleInfo::BeginFunction(MachineFunction *MF) {
void MachineModuleInfo::EndFunction() {
// Clean up frame info.
FrameMoves.clear();
void MachineModuleInfo::EndFunction() {
// Clean up frame info.
FrameMoves.clear();
-
+
// Clean up exception info.
LandingPads.clear();
TypeInfos.clear();
// Clean up exception info.
LandingPads.clear();
TypeInfos.clear();
@@
-88,7
+87,8
@@
void MachineModuleInfo::EndFunction() {
/// AnalyzeModule - Scan the module for global debug information.
///
void MachineModuleInfo::AnalyzeModule(Module &M) {
/// AnalyzeModule - Scan the module for global debug information.
///
void MachineModuleInfo::AnalyzeModule(Module &M) {
- // Insert functions in the llvm.used array into UsedFunctions.
+ // Insert functions in the llvm.used array (but not llvm.compiler.used) into
+ // UsedFunctions.
GlobalVariable *GV = M.getGlobalVariable("llvm.used");
if (!GV || !GV->hasInitializer()) return;
GlobalVariable *GV = M.getGlobalVariable("llvm.used");
if (!GV || !GV->hasInitializer()) return;
@@
-114,7
+114,7
@@
LandingPadInfo &MachineModuleInfo::getOrCreateLandingPadInfo
if (LP.LandingPadBlock == LandingPad)
return LP;
}
if (LP.LandingPadBlock == LandingPad)
return LP;
}
-
+
LandingPads.push_back(LandingPadInfo(LandingPad));
return LandingPads[N];
}
LandingPads.push_back(LandingPadInfo(LandingPad));
return LandingPads[N];
}
@@
-133,7
+133,7
@@
void MachineModuleInfo::addInvoke(MachineBasicBlock *LandingPad,
unsigned MachineModuleInfo::addLandingPad(MachineBasicBlock *LandingPad) {
unsigned LandingPadLabel = NextLabelID();
LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);
unsigned MachineModuleInfo::addLandingPad(MachineBasicBlock *LandingPad) {
unsigned LandingPadLabel = NextLabelID();
LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);
- LP.LandingPadLabel = LandingPadLabel;
+ LP.LandingPadLabel = LandingPadLabel;
return LandingPadLabel;
}
return LandingPadLabel;
}
@@
-147,8
+147,13
@@
void MachineModuleInfo::addPersonality(MachineBasicBlock *LandingPad,
for (unsigned i = 0; i < Personalities.size(); ++i)
if (Personalities[i] == Personality)
return;
for (unsigned i = 0; i < Personalities.size(); ++i)
if (Personalities[i] == Personality)
return;
-
- Personalities.push_back(Personality);
+
+ // If this is the first personality we're adding go
+ // ahead and add it at the beginning.
+ if (Personalities[0] == NULL)
+ Personalities[0] = Personality;
+ else
+ Personalities.push_back(Personality);
}
/// addCatchTypeInfo - Provide the catch typeinfo for a landing pad.
}
/// addCatchTypeInfo - Provide the catch typeinfo for a landing pad.
@@
-223,7
+228,7
@@
void MachineModuleInfo::TidyLandingPads() {
}
}
}
}
-/// getTypeIDFor - Return the type id for the specified typeinfo. This is
+/// getTypeIDFor - Return the type id for the specified typeinfo. This is
/// function wide.
unsigned MachineModuleInfo::getTypeIDFor(GlobalVariable *TI) {
for (unsigned i = 0, N = TypeInfos.size(); i != N; ++i)
/// function wide.
unsigned MachineModuleInfo::getTypeIDFor(GlobalVariable *TI) {
for (unsigned i = 0, N = TypeInfos.size(); i != N; ++i)
@@
-272,24
+277,24
@@
Function *MachineModuleInfo::getPersonality() const {
}
/// getPersonalityIndex - Return unique index for current personality
}
/// getPersonalityIndex - Return unique index for current personality
-/// function. NULL personality function should always get zero index.
+/// function. NULL
/first
personality function should always get zero index.
unsigned MachineModuleInfo::getPersonalityIndex() const {
const Function* Personality = NULL;
unsigned MachineModuleInfo::getPersonalityIndex() const {
const Function* Personality = NULL;
-
+
// Scan landing pads. If there is at least one non-NULL personality - use it.
for (unsigned i = 0; i != LandingPads.size(); ++i)
if (LandingPads[i].Personality) {
Personality = LandingPads[i].Personality;
break;
}
// Scan landing pads. If there is at least one non-NULL personality - use it.
for (unsigned i = 0; i != LandingPads.size(); ++i)
if (LandingPads[i].Personality) {
Personality = LandingPads[i].Personality;
break;
}
-
+
for (unsigned i = 0; i < Personalities.size(); ++i) {
if (Personalities[i] == Personality)
return i;
}
for (unsigned i = 0; i < Personalities.size(); ++i) {
if (Personalities[i] == Personality)
return i;
}
- // This
should never happen
- llvm_unreachable("Personality function should be set!");
+ // This
will happen if the current personality function is
+ // in the zero index.
return 0;
}
return 0;
}
@@
-305,6
+310,7
@@
struct DebugLabelFolder : public MachineFunctionPass {
DebugLabelFolder() : MachineFunctionPass(&ID) {}
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
DebugLabelFolder() : MachineFunctionPass(&ID) {}
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+ AU.setPreservesCFG();
AU.addPreservedID(MachineLoopInfoID);
AU.addPreservedID(MachineDominatorsID);
MachineFunctionPass::getAnalysisUsage(AU);
AU.addPreservedID(MachineLoopInfoID);
AU.addPreservedID(MachineDominatorsID);
MachineFunctionPass::getAnalysisUsage(AU);
@@
-320,12
+326,12
@@
bool DebugLabelFolder::runOnMachineFunction(MachineFunction &MF) {
// Get machine module info.
MachineModuleInfo *MMI = getAnalysisIfAvailable<MachineModuleInfo>();
if (!MMI) return false;
// Get machine module info.
MachineModuleInfo *MMI = getAnalysisIfAvailable<MachineModuleInfo>();
if (!MMI) return false;
-
+
// Track if change is made.
bool MadeChange = false;
// No prior label to begin.
unsigned PriorLabel = 0;
// Track if change is made.
bool MadeChange = false;
// No prior label to begin.
unsigned PriorLabel = 0;
-
+
// Iterate through basic blocks.
for (MachineFunction::iterator BB = MF.begin(), E = MF.end();
BB != E; ++BB) {
// Iterate through basic blocks.
for (MachineFunction::iterator BB = MF.begin(), E = MF.end();
BB != E; ++BB) {
@@
-335,7
+341,7
@@
bool DebugLabelFolder::runOnMachineFunction(MachineFunction &MF) {
if (I->isDebugLabel() && !MMI->isDbgLabelUsed(I->getOperand(0).getImm())){
// The label ID # is always operand #0, an immediate.
unsigned NextLabel = I->getOperand(0).getImm();
if (I->isDebugLabel() && !MMI->isDbgLabelUsed(I->getOperand(0).getImm())){
// The label ID # is always operand #0, an immediate.
unsigned NextLabel = I->getOperand(0).getImm();
-
+
// If there was an immediate prior label.
if (PriorLabel) {
// Remap the current label to prior label.
// If there was an immediate prior label.
if (PriorLabel) {
// Remap the current label to prior label.
@@
-353,15
+359,14
@@
bool DebugLabelFolder::runOnMachineFunction(MachineFunction &MF) {
// No consecutive labels.
PriorLabel = 0;
}
// No consecutive labels.
PriorLabel = 0;
}
-
+
++I;
}
}
++I;
}
}
-
+
return MadeChange;
}
FunctionPass *createDebugLabelFoldingPass() { return new DebugLabelFolder(); }
}
return MadeChange;
}
FunctionPass *createDebugLabelFoldingPass() { return new DebugLabelFolder(); }
}
-