aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/TargetInstrInfoImpl.cpp
diff options
context:
space:
mode:
authorNicolas Geoffray <nicolas.geoffray@lip6.fr>2008-04-16 20:10:13 +0000
committerNicolas Geoffray <nicolas.geoffray@lip6.fr>2008-04-16 20:10:13 +0000
commitcb162a0601c07804318bea53afe3f10f87567ef0 (patch)
tree17e026641b730ae73981f77df025c5543c674201 /lib/CodeGen/TargetInstrInfoImpl.cpp
parentb6992de7fe6531839dcc66c5add607bf3975c9e2 (diff)
downloadexternal_llvm-cb162a0601c07804318bea53afe3f10f87567ef0.zip
external_llvm-cb162a0601c07804318bea53afe3f10f87567ef0.tar.gz
external_llvm-cb162a0601c07804318bea53afe3f10f87567ef0.tar.bz2
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.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/CodeGen/TargetInstrInfoImpl.cpp b/lib/CodeGen/TargetInstrInfoImpl.cpp
index 4b8c669..1bb08ab 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;
+}