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 explicitely enabled via the
30 /// -enable-stackmap-liveness flag. The pass skips functions that don't have any
31 /// stackmap or patchpoint intrinsics. The information provided by this pass is
32 /// optional and not required by the aformentioned intrinsics 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 virtual void getAnalysisUsage(AnalysisUsage &AU) const;
47 /// \brief Calculate the liveness information for the given machine function.
48 virtual bool runOnMachineFunction(MachineFunction &MF);
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;
61 /// \brief Print the current register live set for debugging.
62 void printLiveOutSet(raw_ostream &OS) const;
65 } // end llvm namespace
67 #endif // end LLVM_CODEGEN_STACKMAP_LIVENESS_ANALYSIS_H