summaryrefslogtreecommitdiff
path: root/include/llvm/CodeGen/MachineCodeEmitter.h
diff options
context:
space:
mode:
authorNate Begeman <natebegeman@mac.com>2006-04-22 18:53:45 +0000
committerNate Begeman <natebegeman@mac.com>2006-04-22 18:53:45 +0000
commit37efe6764568a3829fee26aba532283131d1a104 (patch)
tree5729b1d1477bb72a5a4f83494638aab63e54f522 /include/llvm/CodeGen/MachineCodeEmitter.h
parent1900c012f5f15063a9349f6646d7dd1654df38f9 (diff)
downloadllvm-37efe6764568a3829fee26aba532283131d1a104.tar.gz
llvm-37efe6764568a3829fee26aba532283131d1a104.tar.bz2
llvm-37efe6764568a3829fee26aba532283131d1a104.tar.xz
JumpTable support! What this represents is working asm and jit support for
x86 and ppc for 100% dense switch statements when relocations are non-PIC. This support will be extended and enhanced in the coming days to support PIC, and less dense forms of jump tables. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27947 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/MachineCodeEmitter.h')
-rw-r--r--include/llvm/CodeGen/MachineCodeEmitter.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/llvm/CodeGen/MachineCodeEmitter.h b/include/llvm/CodeGen/MachineCodeEmitter.h
index f5ee2e6237..f4b7c2290d 100644
--- a/include/llvm/CodeGen/MachineCodeEmitter.h
+++ b/include/llvm/CodeGen/MachineCodeEmitter.h
@@ -18,11 +18,13 @@
#define LLVM_CODEGEN_MACHINECODEEMITTER_H
#include "llvm/Support/DataTypes.h"
+#include <map>
namespace llvm {
class MachineBasicBlock;
class MachineConstantPool;
+class MachineJumpTableInfo;
class MachineFunction;
class MachineRelocation;
class Value;
@@ -47,6 +49,17 @@ public:
/// for the function.
virtual void emitConstantPool(MachineConstantPool *MCP) {}
+ /// initJumpTableInfo - This callback is invoked by the JIT to allocate the
+ /// necessary memory to hold the jump tables.
+ virtual void initJumpTableInfo(MachineJumpTableInfo *MJTI) {}
+
+ /// emitJumpTableInfo - This callback is invoked to output the jump tables
+ /// for the function. In addition to a pointer to the MachineJumpTableInfo,
+ /// this function also takes a map of MBBs to addresses, so that the final
+ /// addresses of the MBBs can be written to the jump tables.
+ virtual void emitJumpTableInfo(MachineJumpTableInfo *MJTI,
+ std::map<MachineBasicBlock*,uint64_t> &MBBM) {}
+
/// startFunctionStub - This callback is invoked when the JIT needs the
/// address of a function that has not been code generated yet. The StubSize
/// specifies the total size required by the stub. Stubs are not allowed to
@@ -94,6 +107,11 @@ public:
//
virtual uint64_t getConstantPoolEntryAddress(unsigned Index) = 0;
+ // getJumpTablelEntryAddress - Return the address of the jump table with index
+ // 'Index' in the function that last called initJumpTableInfo.
+ //
+ virtual uint64_t getJumpTableEntryAddress(unsigned Index) = 0;
+
// allocateGlobal - Allocate some space for a global variable.
virtual unsigned char* allocateGlobal(unsigned size, unsigned alignment) = 0;