Subversion Repositories QNX 8.QNX8 LLVM/Clang compiler suite

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
14 pmbaty 1
//===- GenericSSAContext.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 defines the little GenericSSAContext<X> template class
11
/// that can be used to implement IR analyses as templates.
12
/// Specializing these templates allows the analyses to be used over
13
/// both LLVM IR and Machine IR.
14
///
15
//===----------------------------------------------------------------------===//
16
 
17
#ifndef LLVM_ADT_GENERICSSACONTEXT_H
18
#define LLVM_ADT_GENERICSSACONTEXT_H
19
 
20
#include "llvm/Support/Printable.h"
21
 
22
namespace llvm {
23
 
24
template <typename _FunctionT> class GenericSSAContext {
25
public:
26
  // Specializations should provide the following types that are similar to how
27
  // LLVM IR is structured:
28
 
29
  // The smallest unit of the IR is a ValueT. The SSA context uses a ValueRefT,
30
  // which is a pointer to a ValueT, since Machine IR does not have the
31
  // equivalent of a ValueT.
32
  //
33
  // using ValueRefT = ...
34
 
35
  // An InstT is a subclass of ValueT that itself defines one or more ValueT
36
  // objects.
37
  //
38
  // using InstT = ... must be a subclass of Value
39
 
40
  // A BlockT is a sequence of InstT, and forms a node of the CFG. It
41
  // has global methods predecessors() and successors() that return
42
  // the list of incoming CFG edges and outgoing CFG edges
43
  // respectively.
44
  //
45
  // using BlockT = ...
46
 
47
  // A FunctionT represents a CFG along with arguments and return values. It is
48
  // the smallest complete unit of code in a Module.
49
  //
50
  // The compiler produces an error here if this class is implicitly
51
  // specialized due to an instantiation. An explicit specialization
52
  // of this template needs to be added before the instantiation point
53
  // indicated by the compiler.
54
  using FunctionT = typename _FunctionT::invalidTemplateInstanceError;
55
 
56
  // Every FunctionT has a unique BlockT marked as its entry.
57
  //
58
  // static BlockT* getEntryBlock(FunctionT &F);
59
 
60
  // Initialize the SSA context with information about the FunctionT being
61
  // processed.
62
  //
63
  // void setFunction(FunctionT &function);
64
  // FunctionT* getFunction() const;
65
 
66
  // Methods to print various objects.
67
  //
68
  // Printable print(BlockT *block) const;
69
  // Printable print(InstructionT *inst) const;
70
  // Printable print(ValueRefT value) const;
71
};
72
} // namespace llvm
73
 
74
#endif // LLVM_ADT_GENERICSSACONTEXT_H