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 stackmap or patchpoint
12 // intrinsic if present.
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 stackmap or
27 /// patchpoint intrinsic if present.
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 {
36 const TargetRegisterInfo *TRI;
37 LivePhysRegs LiveRegs;
41 /// \brief Default construct and initialize the pass.
44 /// \brief Tell the pass manager which passes we depend on and what
45 /// information we preserve.
46 virtual void getAnalysisUsage(AnalysisUsage &AU) const;
48 /// \brief Calculate the liveness information for the given machine function.
49 virtual bool runOnMachineFunction(MachineFunction &MF);
52 /// \brief Performs the actual liveness calculation for the function.
53 bool calculateLiveness();
55 /// \brief Add the current register live set to the instruction.
56 void addLiveOutSetToMI(MachineInstr &MI);
58 /// \brief Create a register mask and initialize it with the registers from
59 /// the register live set.
60 uint32_t *createRegisterMask() const;
65 #endif // LLVM_CODEGEN_STACKMAP_LIVENESS_ANALYSIS_H