//===-- llvm/CodeGen/LiveVariables.h - Live Variable Analysis ---*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file implements the LiveVariables analysis pass. For each machine // instruction in the function, this pass calculates the set of registers that // are immediately dead after the instruction (i.e., the instruction calculates // the value, but it is never used) and the set of registers that are used by // the instruction, but are never used after the instruction (i.e., they are // killed). // // This class computes live variables using a sparse implementation based on // the machine code SSA form. This class computes live variable information for // each virtual and _register allocatable_ physical register in a function. It // uses the dominance properties of SSA form to efficiently compute live // variables for virtual registers, and assumes that physical registers are only // live within a single basic block (allowing it to do a single local analysis // to resolve physical register lifetimes in each basic block). If a physical // register is not register allocatable, it is not tracked. This is useful for // things like the stack pointer and condition codes. // //===----------------------------------------------------------------------===// #ifndef LLVM_CODEGEN_LIVEVARIABLES_H #define LLVM_CODEGEN_LIVEVARIABLES_H #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/IndexedMap.h" #include "llvm/ADT/SmallSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SparseBitVector.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachinePassManager.h" #include "llvm/CodeGen/TargetRegisterInfo.h" #include "llvm/InitializePasses.h" #include "llvm/PassRegistry.h" namespace llvm { class MachineBasicBlock; class MachineRegisterInfo; class LiveVariables { … }; class LiveVariablesAnalysis : public AnalysisInfoMixin<LiveVariablesAnalysis> { … }; class LiveVariablesPrinterPass : public PassInfoMixin<LiveVariablesPrinterPass> { … }; class LiveVariablesWrapperPass : public MachineFunctionPass { … }; } // End llvm namespace #endif