1 //===-- JumpInstrTableInfo.h: Info for Jump-Instruction Tables --*- C++ -*-===//
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
6 //===----------------------------------------------------------------------===//
9 /// \brief Information about jump-instruction tables that have been created by
10 /// JumpInstrTables pass.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_ANALYSIS_JUMPINSTRTABLEINFO_H
15 #define LLVM_ANALYSIS_JUMPINSTRTABLEINFO_H
17 #include "llvm/ADT/DenseMap.h"
18 #include "llvm/Pass.h"
26 /// This class stores information about jump-instruction tables created by the
27 /// JumpInstrTables pass (in lib/CodeGen/JumpInstrTables.cpp). Each table is a
28 /// map from a function type to a vector of pairs. The first element of each
29 /// pair is the function that has the jumptable annotation. The second element
30 /// is a function that was declared by JumpInstrTables and used to replace all
31 /// address-taking sites for the original function.
33 /// The information in this pass is used in AsmPrinter
34 /// (lib/CodeGen/AsmPrinter/AsmPrinter.cpp) to generate the required assembly
35 /// for the jump-instruction tables.
36 class JumpInstrTableInfo : public ImmutablePass {
41 virtual ~JumpInstrTableInfo();
42 const char *getPassName() const override {
43 return "Jump-Instruction Table Info";
46 typedef std::pair<Function *, Function *> JumpPair;
47 typedef DenseMap<FunctionType *, std::vector<JumpPair> > JumpTables;
49 /// Inserts an entry in a table, adding the table if it doesn't exist.
50 void insertEntry(FunctionType *TableFunTy, Function *Target, Function *Jump);
53 const JumpTables &getTables() const { return Tables; }
60 #endif /* LLVM_ANALYSIS_JUMPINSTRTABLEINFO_H */