Tom Roeder | 44cb65f | 2014-06-05 19:29:43 +0000 | [diff] [blame] | 1 | //===-- JumpInstrTableInfo.cpp: Info for Jump-Instruction Tables ----------===// |
| 2 | // |
| 3 | // This file is distributed under the University of Illinois Open Source |
| 4 | // License. See LICENSE.TXT for details. |
| 5 | // |
| 6 | //===----------------------------------------------------------------------===// |
| 7 | /// |
| 8 | /// \file |
| 9 | /// \brief Information about jump-instruction tables that have been created by |
| 10 | /// JumpInstrTables pass. |
| 11 | /// |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #define DEBUG_TYPE "jiti" |
| 15 | |
| 16 | #include "llvm/Analysis/JumpInstrTableInfo.h" |
| 17 | #include "llvm/Analysis/Passes.h" |
| 18 | #include "llvm/IR/Function.h" |
| 19 | #include "llvm/IR/Type.h" |
| 20 | |
| 21 | using namespace llvm; |
| 22 | |
| 23 | INITIALIZE_PASS(JumpInstrTableInfo, "jump-instr-table-info", |
| 24 | "Jump-Instruction Table Info", true, true) |
| 25 | char JumpInstrTableInfo::ID = 0; |
| 26 | |
| 27 | ImmutablePass *llvm::createJumpInstrTableInfoPass() { |
| 28 | return new JumpInstrTableInfo(); |
| 29 | } |
| 30 | |
| 31 | JumpInstrTableInfo::JumpInstrTableInfo() : ImmutablePass(ID), Tables() { |
| 32 | initializeJumpInstrTableInfoPass(*PassRegistry::getPassRegistry()); |
| 33 | } |
| 34 | |
| 35 | JumpInstrTableInfo::~JumpInstrTableInfo() {} |
| 36 | |
| 37 | void JumpInstrTableInfo::insertEntry(FunctionType *TableFunTy, Function *Target, |
| 38 | Function *Jump) { |
| 39 | Tables[TableFunTy].push_back(JumpPair(Target, Jump)); |
| 40 | } |