LLVM API Documentation
00001 //===--- StackMapLivenessAnalysis - StackMap Liveness Analysis --*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This pass calculates the liveness for each basic block in a function and 00011 // attaches the register live-out information to a patchpoint intrinsic (if 00012 // present). 00013 // 00014 //===----------------------------------------------------------------------===// 00015 00016 #ifndef LLVM_CODEGEN_STACKMAPLIVENESSANALYSIS_H 00017 #define LLVM_CODEGEN_STACKMAPLIVENESSANALYSIS_H 00018 00019 #include "llvm/CodeGen/LivePhysRegs.h" 00020 #include "llvm/CodeGen/MachineFunctionPass.h" 00021 00022 00023 namespace llvm { 00024 00025 /// \brief This pass calculates the liveness information for each basic block in 00026 /// a function and attaches the register live-out information to a patchpoint 00027 /// intrinsic if present. 00028 /// 00029 /// This pass can be disabled via the -enable-patchpoint-liveness=false flag. 00030 /// The pass skips functions that don't have any patchpoint intrinsics. The 00031 /// information provided by this pass is optional and not required by the 00032 /// aformentioned intrinsic to function. 00033 class StackMapLiveness : public MachineFunctionPass { 00034 MachineFunction *MF; 00035 const TargetRegisterInfo *TRI; 00036 LivePhysRegs LiveRegs; 00037 public: 00038 static char ID; 00039 00040 /// \brief Default construct and initialize the pass. 00041 StackMapLiveness(); 00042 00043 /// \brief Tell the pass manager which passes we depend on and what 00044 /// information we preserve. 00045 void getAnalysisUsage(AnalysisUsage &AU) const override; 00046 00047 /// \brief Calculate the liveness information for the given machine function. 00048 bool runOnMachineFunction(MachineFunction &MF) override; 00049 00050 private: 00051 /// \brief Performs the actual liveness calculation for the function. 00052 bool calculateLiveness(); 00053 00054 /// \brief Add the current register live set to the instruction. 00055 void addLiveOutSetToMI(MachineInstr &MI); 00056 00057 /// \brief Create a register mask and initialize it with the registers from 00058 /// the register live set. 00059 uint32_t *createRegisterMask() const; 00060 }; 00061 00062 } // llvm namespace 00063 00064 #endif