X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FCodeGen%2FLiveVariables.h;h=866b981b394d8cead1851f1aeed8491f6dd85821;hb=a62e52ab181c10738066e65a6dcc6c3cdfa5d806;hp=7820f7414d4f2db87e59e62bcb07aeefa9d01869;hpb=22a2f6d5b05631a21b62e3e103aa1b9469ad0c5c;p=oota-llvm.git diff --git a/include/llvm/CodeGen/LiveVariables.h b/include/llvm/CodeGen/LiveVariables.h index 7820f7414d4..866b981b394 100644 --- a/include/llvm/CodeGen/LiveVariables.h +++ b/include/llvm/CodeGen/LiveVariables.h @@ -1,12 +1,12 @@ //===-- llvm/CodeGen/LiveVariables.h - Live Variable Analysis ---*- C++ -*-===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// -// +// // This file implements the LiveVariable 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 @@ -23,7 +23,7 @@ // 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 @@ -111,7 +111,7 @@ public: /// killed_iterator - Iterate over registers killed by a machine instruction /// typedef std::multimap::iterator killed_iterator; - + /// killed_begin/end - Get access to the range of registers killed by a /// machine instruction. killed_iterator killed_begin(MachineInstr *MI) { @@ -125,6 +125,16 @@ public: return RegistersKilled.equal_range(MI); } + /// KillsRegister - Return true if the specified instruction kills the + /// specified register. + bool KillsRegister(MachineInstr *MI, unsigned Reg) { + std::pair KIP = killed_range(MI); + for (; KIP.first != KIP.second; ++KIP.first) + if (KIP.first->second == Reg) + return true; + return false; + } + killed_iterator dead_begin(MachineInstr *MI) { return RegistersDead.lower_bound(MI); } @@ -233,7 +243,7 @@ public: void MarkVirtRegAliveInBlock(VarInfo &VRInfo, MachineBasicBlock *BB); void HandleVirtRegUse(VarInfo &VRInfo, MachineBasicBlock *MBB, - MachineInstr *MI); + MachineInstr *MI); }; } // End llvm namespace