1 //===--- StackMapLivenessAnalysis - StackMap Liveness Analysis --*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This pass calculates the liveness for each basic block in a function and
11 // attaches the register live-out information to a patchpoint intrinsic (if
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_CODEGEN_STACKMAP_LIVENESS_ANALYSIS_H
17 #define LLVM_CODEGEN_STACKMAP_LIVENESS_ANALYSIS_H
19 #include "llvm/CodeGen/LivePhysRegs.h"
20 #include "llvm/CodeGen/MachineFunctionPass.h"
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 patchpoint
27 /// intrinsic if present.
29 /// This pass can be disabled via the -enable-patchpoint-liveness=false flag.
30 /// The pass skips functions that don't have any patchpoint intrinsics. The
31 /// information provided by this pass is optional and not required by the
32 /// aformentioned intrinsic to function.
33 class StackMapLiveness : public MachineFunctionPass {
35 const TargetRegisterInfo *TRI;
36 LivePhysRegs LiveRegs;
40 /// \brief Default construct and initialize the pass.
43 /// \brief Tell the pass manager which passes we depend on and what
44 /// information we preserve.
45 void getAnalysisUsage(AnalysisUsage &AU) const override;
47 /// \brief Calculate the liveness information for the given machine function.
48 bool runOnMachineFunction(MachineFunction &MF) override;
51 /// \brief Performs the actual liveness calculation for the function.
52 bool calculateLiveness();
54 /// \brief Add the current register live set to the instruction.
55 void addLiveOutSetToMI(MachineInstr &MI);
57 /// \brief Create a register mask and initialize it with the registers from
58 /// the register live set.
59 uint32_t *createRegisterMask() const;
64 #endif // LLVM_CODEGEN_STACKMAP_LIVENESS_ANALYSIS_H