SSAContext.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- SSAContext.h ---------------------------------------------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. /// \file
  14. ///
  15. /// This file declares a specialization of the GenericSSAContext<X>
  16. /// class template for LLVM IR.
  17. ///
  18. //===----------------------------------------------------------------------===//
  19. #ifndef LLVM_IR_SSACONTEXT_H
  20. #define LLVM_IR_SSACONTEXT_H
  21. #include "llvm/Support/Printable.h"
  22. namespace llvm {
  23. class BasicBlock;
  24. class Function;
  25. class Instruction;
  26. class Value;
  27. template <typename, bool> class DominatorTreeBase;
  28. template <typename _FunctionT> class GenericSSAContext;
  29. template <> class GenericSSAContext<Function> {
  30. Function *F;
  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. static BasicBlock *getEntryBlock(Function &F);
  38. void setFunction(Function &Fn);
  39. Function *getFunction() const { return F; }
  40. Printable print(BasicBlock *Block) const;
  41. Printable print(Instruction *Inst) const;
  42. Printable print(Value *Value) const;
  43. };
  44. using SSAContext = GenericSSAContext<Function>;
  45. } // namespace llvm
  46. #endif // LLVM_IR_SSACONTEXT_H
  47. #ifdef __GNUC__
  48. #pragma GCC diagnostic pop
  49. #endif