xref: /llvm-project/llvm/include/llvm/CodeGen/MachineSSAContext.h (revision 1562b70eaf6e0b95910fa684dfc53bd5ca6252e7)
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/MachineBasicBlock.h"
20 #include "llvm/Support/Printable.h"
21 
22 namespace llvm {
23 class MachineInstr;
24 class MachineFunction;
25 class Register;
26 
27 inline auto instrs(const MachineBasicBlock &BB) { return BB.instrs(); }
28 
29 template <> struct GenericSSATraits<MachineFunction> {
30   using BlockT = MachineBasicBlock;
31   using FunctionT = MachineFunction;
32   using InstructionT = MachineInstr;
33   using ValueRefT = Register;
34   using ConstValueRefT = Register;
35   using UseT = MachineOperand;
36 };
37 
38 using MachineSSAContext = GenericSSAContext<MachineFunction>;
39 } // namespace llvm
40 
41 #endif // LLVM_CODEGEN_MACHINESSACONTEXT_H
42