Add a small missed optimization: turn X == C ? X : Y into X == C ? C : Y. This
[llvm/stm8.git] / lib / CodeGen / LiveDebugVariables.h
bloba6e40a198456289df776ade772bb2ed683d5f128
1 //===- LiveDebugVariables.h - Tracking debug info variables ----*- c++ -*--===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file provides the interface to the LiveDebugVariables analysis.
12 // The analysis removes DBG_VALUE instructions for virtual registers and tracks
13 // live user variables in a data structure that can be updated during register
14 // allocation.
16 // After register allocation new DBG_VALUE instructions are emitted to reflect
17 // the new locations of user variables.
19 //===----------------------------------------------------------------------===//
21 #ifndef LLVM_CODEGEN_LIVEDEBUGVARIABLES_H
22 #define LLVM_CODEGEN_LIVEDEBUGVARIABLES_H
24 #include "llvm/CodeGen/MachineFunctionPass.h"
26 namespace llvm {
28 class VirtRegMap;
30 class LiveDebugVariables : public MachineFunctionPass {
31 void *pImpl;
32 public:
33 static char ID; // Pass identification, replacement for typeid
35 LiveDebugVariables();
36 ~LiveDebugVariables();
38 /// renameRegister - Move any user variables in OldReg to NewReg:SubIdx.
39 /// @param OldReg Old virtual register that is going away.
40 /// @param NewReg New register holding the user variables.
41 /// @param SubIdx If NewReg is a virtual register, SubIdx may indicate a sub-
42 /// register.
43 void renameRegister(unsigned OldReg, unsigned NewReg, unsigned SubIdx);
45 /// emitDebugValues - Emit new DBG_VALUE instructions reflecting the changes
46 /// that happened during register allocation.
47 /// @param VRM Rename virtual registers according to map.
48 void emitDebugValues(VirtRegMap *VRM);
50 /// dump - Print data structures to dbgs().
51 void dump();
53 private:
55 virtual bool runOnMachineFunction(MachineFunction &);
56 virtual void releaseMemory();
57 virtual void getAnalysisUsage(AnalysisUsage &) const;
61 } // namespace llvm
63 #endif // LLVM_CODEGEN_LIVEDEBUGVARIABLES_H