diff options
author | Chris Lattner <sabre@nondot.org> | 2003-06-06 04:00:05 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-06-06 04:00:05 +0000 |
commit | 302de590017e64f65e810e722eaedb67205cb30e (patch) | |
tree | 0080129660467223a6ebcf8c23f25863a7e748c0 /lib | |
parent | 3339459e48def88347aa7cb6545d2c579489bcb3 (diff) | |
download | external_llvm-302de590017e64f65e810e722eaedb67205cb30e.zip external_llvm-302de590017e64f65e810e722eaedb67205cb30e.tar.gz external_llvm-302de590017e64f65e810e722eaedb67205cb30e.tar.bz2 |
Add statistic for # machine instrs emitted
Add GROSS HACK to get CompilationCallback to work when compiled in release mode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6646 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/X86/X86CodeEmitter.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/Target/X86/X86CodeEmitter.cpp b/lib/Target/X86/X86CodeEmitter.cpp index f41300d..687cbc7 100644 --- a/lib/Target/X86/X86CodeEmitter.cpp +++ b/lib/Target/X86/X86CodeEmitter.cpp @@ -12,8 +12,12 @@ #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/Value.h" +#include "Support/Statistic.h" namespace { + Statistic<> + NumEmitted("x86-emitter", "Number of machine instructions emitted"); + class JITResolver { MachineCodeEmitter &MCE; @@ -71,11 +75,17 @@ unsigned JITResolver::getLazyResolver(Function *F) { void JITResolver::CompilationCallback() { unsigned *StackPtr = (unsigned*)__builtin_frame_address(0); unsigned RetAddr = (unsigned)(intptr_t)__builtin_return_address(0); - assert(StackPtr[1] == RetAddr && "Could not find return address on the stack!"); bool isStub = ((unsigned char*)RetAddr)[0] == 0xCD; // Interrupt marker? + // FIXME FIXME FIXME FIXME: __builtin_frame_address doesn't work if frame + // pointer elimination has been performed. Having a variable sized alloca + // disables frame pointer elimination currently, even if it's dead. This is a + // gross hack. + alloca(10+isStub); + // FIXME FIXME FIXME FIXME + // The call instruction should have pushed the return value onto the stack... RetAddr -= 4; // Backtrack to the reference itself... @@ -429,6 +439,8 @@ static unsigned sizeOfPtr(const TargetInstrDescriptor &Desc) { } void Emitter::emitInstruction(MachineInstr &MI) { + NumEmitted++; // Keep track of the # of mi's emitted + unsigned Opcode = MI.getOpcode(); const TargetInstrDescriptor &Desc = II->get(Opcode); |