My guess is that RegInfo should only call the Allocator.Deallocator if it's not

null.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74147 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling
2009-06-25 00:32:48 +00:00
parent cc4e605721
commit dd37b360d7

View File

@ -124,25 +124,28 @@ MachineFunction::MachineFunction(const Function *F,
MachineFrameInfo(*TM.getFrameInfo()); MachineFrameInfo(*TM.getFrameInfo());
ConstantPool = new (Allocator.Allocate<MachineConstantPool>()) ConstantPool = new (Allocator.Allocate<MachineConstantPool>())
MachineConstantPool(TM.getTargetData()); MachineConstantPool(TM.getTargetData());
// Set up jump table. // Set up jump table.
const TargetData &TD = *TM.getTargetData(); const TargetData &TD = *TM.getTargetData();
bool IsPic = TM.getRelocationModel() == Reloc::PIC_; bool IsPic = TM.getRelocationModel() == Reloc::PIC_;
unsigned EntrySize = IsPic ? 4 : TD.getPointerSize(); unsigned EntrySize = IsPic ? 4 : TD.getPointerSize();
unsigned Alignment = IsPic ? TD.getABITypeAlignment(Type::Int32Ty) unsigned TyAlignment = IsPic ? TD.getABITypeAlignment(Type::Int32Ty)
: TD.getPointerABIAlignment(); : TD.getPointerABIAlignment();
JumpTableInfo = new (Allocator.Allocate<MachineJumpTableInfo>()) JumpTableInfo = new (Allocator.Allocate<MachineJumpTableInfo>())
MachineJumpTableInfo(EntrySize, Alignment); MachineJumpTableInfo(EntrySize, TyAlignment);
} }
MachineFunction::~MachineFunction() { MachineFunction::~MachineFunction() {
BasicBlocks.clear(); BasicBlocks.clear();
InstructionRecycler.clear(Allocator); InstructionRecycler.clear(Allocator);
BasicBlockRecycler.clear(Allocator); BasicBlockRecycler.clear(Allocator);
if (RegInfo) if (RegInfo) {
RegInfo->~MachineRegisterInfo(); Allocator.Deallocate(RegInfo); RegInfo->~MachineRegisterInfo();
Allocator.Deallocate(RegInfo);
}
if (MFInfo) { if (MFInfo) {
MFInfo->~MachineFunctionInfo(); Allocator.Deallocate(MFInfo); MFInfo->~MachineFunctionInfo();
Allocator.Deallocate(MFInfo);
} }
FrameInfo->~MachineFrameInfo(); Allocator.Deallocate(FrameInfo); FrameInfo->~MachineFrameInfo(); Allocator.Deallocate(FrameInfo);
ConstantPool->~MachineConstantPool(); Allocator.Deallocate(ConstantPool); ConstantPool->~MachineConstantPool(); Allocator.Deallocate(ConstantPool);