Debian Codegraph @

suite/synctools/tablegen/include/llvm/CodeGen/MachineSSAContext.h

raw symbols SCIP
1 //===- MachineSSAContext.h --------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 /// \file
9 ///
10 /// This file declares a specialization of the GenericSSAContext<X>
11 /// template class for Machine IR.
12 ///
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_CODEGEN_MACHINESSACONTEXT_H
16 #define LLVM_CODEGEN_MACHINESSACONTEXT_H
17
18 #include "llvm/ADT/GenericSSAContext.h"
19 #include "llvm/CodeGen/MachineRegisterInfo.h"
20 #include "llvm/Support/Printable.h"
21
22 #include <memory>
23
24 namespace llvm {
25 class MachineInstr;
26 class MachineBasicBlock;
27 class MachineFunction;
28 class Register;
29 template <typename, bool> class DominatorTreeBase;
30
31 inline auto successors(MachineBasicBlock *BB) { return BB->successors(); }
32 inline auto predecessors(MachineBasicBlock *BB) { return BB->predecessors(); }
33
34 template <> class GenericSSAContext<MachineFunction> {
35 const MachineRegisterInfo *RegInfo = nullptr;
36 MachineFunction *MF;
37
38 public:
39 using BlockT = MachineBasicBlock;
40 using FunctionT = MachineFunction;
41 using InstructionT = MachineInstr;
42 using ValueRefT = Register;
43 using DominatorTreeT = DominatorTreeBase<BlockT, false>;
44
45 static MachineBasicBlock *getEntryBlock(MachineFunction &F);
46
47 void setFunction(MachineFunction &Fn);
48 MachineFunction *getFunction() const { return MF; }
49
50 Printable print(MachineBasicBlock *Block) const;
51 Printable print(MachineInstr *Inst) const;
52 Printable print(Register Value) const;
53 };
54
55 using MachineSSAContext = GenericSSAContext<MachineFunction>;
56 } // namespace llvm
57
58 #endif // LLVM_CODEGEN_MACHINESSACONTEXT_H