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/Support/Printable.h"
19 
20 namespace llvm {
21 class BasicBlock;
22 class Function;
23 class Instruction;
24 class Value;
25 template <typename, bool> class DominatorTreeBase;
26 template <typename _FunctionT> class GenericSSAContext;
27 
28 template <> class GenericSSAContext<Function> {
29   Function *F;
30 
31 public:
32   using BlockT = BasicBlock;
33   using FunctionT = Function;
34   using InstructionT = Instruction;
35   using ValueRefT = Value *;
36   using DominatorTreeT = DominatorTreeBase<BlockT, false>;
37 
38   static BasicBlock *getEntryBlock(Function &F);
39 
40   void setFunction(Function &Fn);
41   Function *getFunction() const { return F; }
42 
43   Printable print(BasicBlock *Block) const;
44   Printable print(Instruction *Inst) const;
45   Printable print(Value *Value) const;
46 };
47 
48 using SSAContext = GenericSSAContext<Function>;
49 
50 } // namespace llvm
51 
52 #endif // LLVM_IR_SSACONTEXT_H
53