diff options
author | Nicolas Geoffray <nicolas.geoffray@lip6.fr> | 2008-04-16 20:10:13 +0000 |
---|---|---|
committer | Nicolas Geoffray <nicolas.geoffray@lip6.fr> | 2008-04-16 20:10:13 +0000 |
commit | 52e724ad7e679ee590f4bd763d55280586a8f1bc (patch) | |
tree | 17e026641b730ae73981f77df025c5543c674201 /lib/CodeGen/TargetInstrInfoImpl.cpp | |
parent | dc00858e11d243bd2c7cb39bbb92c557b123573e (diff) |
Infrastructure for getting the machine code size of a function and an instruction. X86, PowerPC and ARM are implemented
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49809 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/TargetInstrInfoImpl.cpp')
-rw-r--r-- | lib/CodeGen/TargetInstrInfoImpl.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/CodeGen/TargetInstrInfoImpl.cpp b/lib/CodeGen/TargetInstrInfoImpl.cpp index 4b8c669a25..1bb08ab93b 100644 --- a/lib/CodeGen/TargetInstrInfoImpl.cpp +++ b/lib/CodeGen/TargetInstrInfoImpl.cpp @@ -94,3 +94,14 @@ void TargetInstrInfoImpl::reMaterialize(MachineBasicBlock &MBB, MBB.insert(I, MI); } +unsigned +TargetInstrInfoImpl::GetFunctionSizeInBytes(const MachineFunction &MF) const { + unsigned FnSize = 0; + for (MachineFunction::const_iterator MBBI = MF.begin(), E = MF.end(); + MBBI != E; ++MBBI) { + const MachineBasicBlock &MBB = *MBBI; + for (MachineBasicBlock::const_iterator I = MBB.begin(),E = MBB.end(); I != E; ++I) + FnSize += GetInstSizeInBytes(I); + } + return FnSize; +} |