summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorMatthijs Kooijman <matthijs@stdin.nl>2008-10-13 12:37:16 +0000
committerMatthijs Kooijman <matthijs@stdin.nl>2008-10-13 12:37:16 +0000
commitc8d7988da8522afe5cf373b0965b79e8879a8b05 (patch)
tree950392090881f95c73eca38be8e4f6b69e7a1381 /llvm/lib/CodeGen
parent35e1387ac6c0ba8c6c8b959775a4478c2a292dff (diff)
downloadbcm5719-llvm-c8d7988da8522afe5cf373b0965b79e8879a8b05.tar.gz
bcm5719-llvm-c8d7988da8522afe5cf373b0965b79e8879a8b05.zip
Make MachineFunction not crash when TargetMachine::getRegisterInfo() returns
NULL, but just hide some debug output then. llvm-svn: 57437
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/MachineFunction.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp
index bbc69a96239..1ba4be8478c 100644
--- a/llvm/lib/CodeGen/MachineFunction.cpp
+++ b/llvm/lib/CodeGen/MachineFunction.cpp
@@ -110,8 +110,11 @@ void ilist_traits<MachineBasicBlock>::deleteNode(MachineBasicBlock *MBB) {
MachineFunction::MachineFunction(const Function *F,
const TargetMachine &TM)
: Annotation(MF_AID), Fn(F), Target(TM) {
- RegInfo = new (Allocator.Allocate<MachineRegisterInfo>())
- MachineRegisterInfo(*TM.getRegisterInfo());
+ if (TM.getRegisterInfo())
+ RegInfo = new (Allocator.Allocate<MachineRegisterInfo>())
+ MachineRegisterInfo(*TM.getRegisterInfo());
+ else
+ RegInfo = 0;
MFInfo = 0;
FrameInfo = new (Allocator.Allocate<MachineFrameInfo>())
MachineFrameInfo(*TM.getFrameInfo());
@@ -132,7 +135,8 @@ MachineFunction::~MachineFunction() {
BasicBlocks.clear();
InstructionRecycler.clear(Allocator);
BasicBlockRecycler.clear(Allocator);
- RegInfo->~MachineRegisterInfo(); Allocator.Deallocate(RegInfo);
+ if (RegInfo)
+ RegInfo->~MachineRegisterInfo(); Allocator.Deallocate(RegInfo);
if (MFInfo) {
MFInfo->~MachineFunctionInfo(); Allocator.Deallocate(MFInfo);
}
@@ -255,7 +259,7 @@ void MachineFunction::print(std::ostream &OS) const {
const TargetRegisterInfo *TRI = getTarget().getRegisterInfo();
- if (!RegInfo->livein_empty()) {
+ if (RegInfo && !RegInfo->livein_empty()) {
OS << "Live Ins:";
for (MachineRegisterInfo::livein_iterator
I = RegInfo->livein_begin(), E = RegInfo->livein_end(); I != E; ++I) {
@@ -269,7 +273,7 @@ void MachineFunction::print(std::ostream &OS) const {
}
OS << "\n";
}
- if (!RegInfo->liveout_empty()) {
+ if (RegInfo && !RegInfo->liveout_empty()) {
OS << "Live Outs:";
for (MachineRegisterInfo::liveout_iterator
I = RegInfo->liveout_begin(), E = RegInfo->liveout_end(); I != E; ++I)
OpenPOWER on IntegriCloud