mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-10 02:25:47 +00:00
Make MachineFunction not crash when TargetMachine::getRegisterInfo() returns
NULL, but just hide some debug output then. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57437 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -110,8 +110,11 @@ void ilist_traits<MachineBasicBlock>::deleteNode(MachineBasicBlock *MBB) {
|
|||||||
MachineFunction::MachineFunction(const Function *F,
|
MachineFunction::MachineFunction(const Function *F,
|
||||||
const TargetMachine &TM)
|
const TargetMachine &TM)
|
||||||
: Annotation(MF_AID), Fn(F), Target(TM) {
|
: Annotation(MF_AID), Fn(F), Target(TM) {
|
||||||
RegInfo = new (Allocator.Allocate<MachineRegisterInfo>())
|
if (TM.getRegisterInfo())
|
||||||
MachineRegisterInfo(*TM.getRegisterInfo());
|
RegInfo = new (Allocator.Allocate<MachineRegisterInfo>())
|
||||||
|
MachineRegisterInfo(*TM.getRegisterInfo());
|
||||||
|
else
|
||||||
|
RegInfo = 0;
|
||||||
MFInfo = 0;
|
MFInfo = 0;
|
||||||
FrameInfo = new (Allocator.Allocate<MachineFrameInfo>())
|
FrameInfo = new (Allocator.Allocate<MachineFrameInfo>())
|
||||||
MachineFrameInfo(*TM.getFrameInfo());
|
MachineFrameInfo(*TM.getFrameInfo());
|
||||||
@@ -132,7 +135,8 @@ MachineFunction::~MachineFunction() {
|
|||||||
BasicBlocks.clear();
|
BasicBlocks.clear();
|
||||||
InstructionRecycler.clear(Allocator);
|
InstructionRecycler.clear(Allocator);
|
||||||
BasicBlockRecycler.clear(Allocator);
|
BasicBlockRecycler.clear(Allocator);
|
||||||
RegInfo->~MachineRegisterInfo(); Allocator.Deallocate(RegInfo);
|
if (RegInfo)
|
||||||
|
RegInfo->~MachineRegisterInfo(); Allocator.Deallocate(RegInfo);
|
||||||
if (MFInfo) {
|
if (MFInfo) {
|
||||||
MFInfo->~MachineFunctionInfo(); Allocator.Deallocate(MFInfo);
|
MFInfo->~MachineFunctionInfo(); Allocator.Deallocate(MFInfo);
|
||||||
}
|
}
|
||||||
@@ -255,7 +259,7 @@ void MachineFunction::print(std::ostream &OS) const {
|
|||||||
|
|
||||||
const TargetRegisterInfo *TRI = getTarget().getRegisterInfo();
|
const TargetRegisterInfo *TRI = getTarget().getRegisterInfo();
|
||||||
|
|
||||||
if (!RegInfo->livein_empty()) {
|
if (RegInfo && !RegInfo->livein_empty()) {
|
||||||
OS << "Live Ins:";
|
OS << "Live Ins:";
|
||||||
for (MachineRegisterInfo::livein_iterator
|
for (MachineRegisterInfo::livein_iterator
|
||||||
I = RegInfo->livein_begin(), E = RegInfo->livein_end(); I != E; ++I) {
|
I = RegInfo->livein_begin(), E = RegInfo->livein_end(); I != E; ++I) {
|
||||||
@@ -269,7 +273,7 @@ void MachineFunction::print(std::ostream &OS) const {
|
|||||||
}
|
}
|
||||||
OS << "\n";
|
OS << "\n";
|
||||||
}
|
}
|
||||||
if (!RegInfo->liveout_empty()) {
|
if (RegInfo && !RegInfo->liveout_empty()) {
|
||||||
OS << "Live Outs:";
|
OS << "Live Outs:";
|
||||||
for (MachineRegisterInfo::liveout_iterator
|
for (MachineRegisterInfo::liveout_iterator
|
||||||
I = RegInfo->liveout_begin(), E = RegInfo->liveout_end(); I != E; ++I)
|
I = RegInfo->liveout_begin(), E = RegInfo->liveout_end(); I != E; ++I)
|
||||||
|
Reference in New Issue
Block a user