123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- #pragma once
- #ifdef __GNUC__
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wunused-parameter"
- #endif
- #ifndef LLVM_CODEGEN_MACHINEJUMPTABLEINFO_H
- #define LLVM_CODEGEN_MACHINEJUMPTABLEINFO_H
- #include "llvm/Support/Printable.h"
- #include <cassert>
- #include <vector>
- namespace llvm {
- class MachineBasicBlock;
- class DataLayout;
- class raw_ostream;
- struct MachineJumpTableEntry {
-
- std::vector<MachineBasicBlock*> MBBs;
- explicit MachineJumpTableEntry(const std::vector<MachineBasicBlock*> &M)
- : MBBs(M) {}
- };
- class MachineJumpTableInfo {
- public:
-
-
- enum JTEntryKind {
-
-
- EK_BlockAddress,
-
-
-
- EK_GPRel64BlockAddress,
-
-
-
- EK_GPRel32BlockAddress,
-
-
-
-
-
-
-
- EK_LabelDifference32,
-
-
- EK_Inline,
-
-
- EK_Custom32
- };
- private:
- JTEntryKind EntryKind;
- std::vector<MachineJumpTableEntry> JumpTables;
- public:
- explicit MachineJumpTableInfo(JTEntryKind Kind): EntryKind(Kind) {}
- JTEntryKind getEntryKind() const { return EntryKind; }
-
- unsigned getEntrySize(const DataLayout &TD) const;
-
- unsigned getEntryAlignment(const DataLayout &TD) const;
-
-
- unsigned createJumpTableIndex(const std::vector<MachineBasicBlock*> &DestBBs);
-
-
- bool isEmpty() const { return JumpTables.empty(); }
- const std::vector<MachineJumpTableEntry> &getJumpTables() const {
- return JumpTables;
- }
-
-
- void RemoveJumpTable(unsigned Idx) {
- JumpTables[Idx].MBBs.clear();
- }
-
- bool RemoveMBBFromJumpTables(MachineBasicBlock *MBB);
-
-
- bool ReplaceMBBInJumpTables(MachineBasicBlock *Old, MachineBasicBlock *New);
-
-
- bool ReplaceMBBInJumpTable(unsigned Idx, MachineBasicBlock *Old,
- MachineBasicBlock *New);
-
-
-
- void print(raw_ostream &OS) const;
-
-
- void dump() const;
- };
- Printable printJumpTableEntryReference(unsigned Idx);
- }
- #endif
- #ifdef __GNUC__
- #pragma GCC diagnostic pop
- #endif
|