aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/CodeGen/MachineInstr.h
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2013-01-05 05:05:51 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2013-01-05 05:05:51 +0000
commit84be3d5a73313eb19f2f9e0512153cd2e6f46c54 (patch)
treeec82b39fa7c0b622de7a2194bf3a0d4b5971fe98 /include/llvm/CodeGen/MachineInstr.h
parentf1d015f3429f611c423f943c75f86e6823810dc3 (diff)
downloadexternal_llvm-84be3d5a73313eb19f2f9e0512153cd2e6f46c54.zip
external_llvm-84be3d5a73313eb19f2f9e0512153cd2e6f46c54.tar.gz
external_llvm-84be3d5a73313eb19f2f9e0512153cd2e6f46c54.tar.bz2
Don't call destructors on MachineInstr and MachineOperand.
The series of patches leading up to this one makes llc -O0 run 8% faster. When deallocating a MachineFunction, there is no need to visit all MachineInstr and MachineOperand objects to deallocate them. All their memory come from a BumpPtrAllocator that is about to be purged, and they have empty destructors anyway. This only applies when deallocating the MachineFunction. DeleteMachineInstr() should still be used to recycle MI memory during the codegen passes. Remove the LeakDetector support for MachineInstr. I've never seen it used before, and now it definitely doesn't work. With this patch, leaked MachineInstrs would be much less of a problem since all of their memory will be reclaimed by ~MachineFunction(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171599 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/MachineInstr.h')
-rw-r--r--include/llvm/CodeGen/MachineInstr.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h
index 3c7b213..76738e2 100644
--- a/include/llvm/CodeGen/MachineInstr.h
+++ b/include/llvm/CodeGen/MachineInstr.h
@@ -43,6 +43,10 @@ class MachineMemOperand;
//===----------------------------------------------------------------------===//
/// MachineInstr - Representation of each machine instruction.
///
+/// This class isn't a POD type, but it must have a trivial destructor. When a
+/// MachineFunction is deleted, all the contained MachineInstrs are deallocated
+/// without having their destructor called.
+///
class MachineInstr : public ilist_node<MachineInstr> {
public:
typedef MachineMemOperand **mmo_iterator;
@@ -90,6 +94,8 @@ private:
MachineInstr(const MachineInstr&) LLVM_DELETED_FUNCTION;
void operator=(const MachineInstr&) LLVM_DELETED_FUNCTION;
+ // Use MachineFunction::DeleteMachineInstr() instead.
+ ~MachineInstr() LLVM_DELETED_FUNCTION;
// Intrusive list support
friend struct ilist_traits<MachineInstr>;
@@ -106,8 +112,6 @@ private:
MachineInstr(MachineFunction&, const MCInstrDesc &MCID,
const DebugLoc dl, bool NoImp = false);
- ~MachineInstr();
-
// MachineInstrs are pool-allocated and owned by MachineFunction.
friend class MachineFunction;