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 | ae84bbdbedb996b1e1aac8304f8f26f37a4a32de (patch) | |
| tree | e73f0a0743d267032c05cc1fae0bb97679dfecf8 /llvm/lib/CodeGen | |
| parent | a15cee1036a5e5c699328a1992a698b84f5d4880 (diff) | |
| download | bcm5719-llvm-ae84bbdbedb996b1e1aac8304f8f26f37a4a32de.tar.gz bcm5719-llvm-ae84bbdbedb996b1e1aac8304f8f26f37a4a32de.zip | |
Infrastructure for getting the machine code size of a function and an instruction. X86, PowerPC and ARM are implemented
llvm-svn: 49809
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/TargetInstrInfoImpl.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/TargetInstrInfoImpl.cpp b/llvm/lib/CodeGen/TargetInstrInfoImpl.cpp index 4b8c669a25a..1bb08ab93bb 100644 --- a/llvm/lib/CodeGen/TargetInstrInfoImpl.cpp +++ b/llvm/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; +} |

