xref: /freebsd/contrib/llvm-project/llvm/include/llvm/IR/SSAContext.h (revision 5f757f3ff9144b609b3c433dfd370cc6bdc191ad)
1 //===- SSAContext.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 /// class template for LLVM IR.
12 ///
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_IR_SSACONTEXT_H
16 #define LLVM_IR_SSACONTEXT_H
17 
18 #include "llvm/ADT/GenericSSAContext.h"
19 #include "llvm/IR/BasicBlock.h"
20 
21 namespace llvm {
22 class BasicBlock;
23 class Function;
24 class Instruction;
25 class Value;
26 
27 inline auto instrs(const BasicBlock &BB) {
28   return llvm::make_range(BB.begin(), BB.end());
29 }
30 
31 template <> struct GenericSSATraits<Function> {
32   using BlockT = BasicBlock;
33   using FunctionT = Function;
34   using InstructionT = Instruction;
35   using ValueRefT = Value *;
36   using ConstValueRefT = const Value *;
37   using UseT = Use;
38 };
39 
40 using SSAContext = GenericSSAContext<Function>;
41 
42 } // namespace llvm
43 
44 #endif // LLVM_IR_SSACONTEXT_H
45