Accept Twine's to AsmPrinter::getTempSymbol (refactoring for an incoming change)
[oota-llvm.git] / include / llvm / CodeGen / StackMapLivenessAnalysis.h
1 //===--- StackMapLivenessAnalysis - StackMap Liveness Analysis --*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This pass calculates the liveness for each basic block in a function and
11 // attaches the register live-out information to a stackmap or patchpoint
12 // intrinsic if present.
13 //
14 //===----------------------------------------------------------------------===//
15
16 #ifndef LLVM_CODEGEN_STACKMAP_LIVENESS_ANALYSIS_H
17 #define LLVM_CODEGEN_STACKMAP_LIVENESS_ANALYSIS_H
18
19 #include "llvm/CodeGen/LivePhysRegs.h"
20 #include "llvm/CodeGen/MachineFunctionPass.h"
21
22
23 namespace llvm {
24
25 /// \brief This pass calculates the liveness information for each basic block in
26 /// a function and attaches the register live-out information to a stackmap or
27 /// patchpoint intrinsic if present.
28 ///
29 /// This is an optional pass that has to be explicitly enabled via the
30 /// -enable-stackmap-liveness and/or -enable-patchpoint-liveness flag. The pass
31 /// skips functions that don't have any stackmap or patchpoint intrinsics. The
32 /// information provided by this pass is optional and not required by the
33 /// aformentioned intrinsics to function.
34 class StackMapLiveness : public MachineFunctionPass {
35   MachineFunction *MF;
36   const TargetRegisterInfo *TRI;
37   LivePhysRegs LiveRegs;
38 public:
39   static char ID;
40
41   /// \brief Default construct and initialize the pass.
42   StackMapLiveness();
43
44   /// \brief Tell the pass manager which passes we depend on and what
45   /// information we preserve.
46   void getAnalysisUsage(AnalysisUsage &AU) const override;
47
48   /// \brief Calculate the liveness information for the given machine function.
49   bool runOnMachineFunction(MachineFunction &MF) override;
50
51 private:
52   /// \brief Performs the actual liveness calculation for the function.
53   bool calculateLiveness();
54
55   /// \brief Add the current register live set to the instruction.
56   void addLiveOutSetToMI(MachineInstr &MI);
57
58   /// \brief Create a register mask and initialize it with the registers from
59   /// the register live set.
60   uint32_t *createRegisterMask() const;
61 };
62
63 } // llvm namespace
64
65 #endif // LLVM_CODEGEN_STACKMAP_LIVENESS_ANALYSIS_H