diff options
author | Chris Lattner <sabre@nondot.org> | 2010-01-25 23:26:13 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-01-25 23:26:13 +0000 |
commit | 071c62fad0b25ad4131e7f984173a796c1e63f61 (patch) | |
tree | c77e476ec267d26cf4f93ad52dfb5b07fc78b6c5 /include/llvm/CodeGen/MachineFunction.h | |
parent | b1e803985d3378538ae9cff7eed4102c002d1e22 (diff) |
Rearrange handling of jump tables. Highlights:
1. MachineJumpTableInfo is now created lazily for a function the first time
it actually makes a jump table instead of for every function.
2. The encoding of jump table entries is now described by the
MachineJumpTableInfo::JTEntryKind enum. This enum is determined by the
TLI::getJumpTableEncoding() hook, instead of by lots of code scattered
throughout the compiler that "knows" that jump table entries are always
32-bits in pic mode (for example).
3. The size and alignment of jump table entries is now calculated based on
their kind, instead of at machinefunction creation time.
Future work includes using the EntryKind in more places in the compiler,
eliminating other logic that "knows" the layout of jump tables in various
situations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94470 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/MachineFunction.h')
-rw-r--r-- | include/llvm/CodeGen/MachineFunction.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/include/llvm/CodeGen/MachineFunction.h b/include/llvm/CodeGen/MachineFunction.h index 6ca51bfdf3..d2e89acc7c 100644 --- a/include/llvm/CodeGen/MachineFunction.h +++ b/include/llvm/CodeGen/MachineFunction.h @@ -143,11 +143,16 @@ public: const MachineFrameInfo *getFrameInfo() const { return FrameInfo; } /// getJumpTableInfo - Return the jump table info object for the current - /// function. This object contains information about jump tables for switch - /// instructions in the current function. - /// - MachineJumpTableInfo *getJumpTableInfo() { return JumpTableInfo; } + /// function. This object contains information about jump tables in the + /// current function. If the current function has no jump tables, this will + /// return null. const MachineJumpTableInfo *getJumpTableInfo() const { return JumpTableInfo; } + MachineJumpTableInfo *getJumpTableInfo() { return JumpTableInfo; } + + /// getOrCreateJumpTableInfo - Get the JumpTableInfo for this function, if it + /// does already exist, allocate one. + MachineJumpTableInfo *getOrCreateJumpTableInfo(unsigned JTEntryKind); + /// getConstantPool - Return the constant pool object for the current /// function. |