summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineFunction.cpp
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@apple.com>2009-04-20 18:36:57 +0000
committerBob Wilson <bob.wilson@apple.com>2009-04-20 18:36:57 +0000
commitf8b85477aed2dff0ddeb6f6c4290db7de393eca2 (patch)
tree7c96da5efc90d3514deea3ac01cc9c0cc2bef33d /llvm/lib/CodeGen/MachineFunction.cpp
parent958d5eb0326c47cc8ece7dd5637ba77800f4b616 (diff)
downloadbcm5719-llvm-f8b85477aed2dff0ddeb6f6c4290db7de393eca2.tar.gz
bcm5719-llvm-f8b85477aed2dff0ddeb6f6c4290db7de393eca2.zip
Move duplicated AddLiveIn function from X86 and ARM backends to be a method
in the MachineFunction class, renaming it to addLiveIn for consistency with the same method in MachineBasicBlock. Thanks for Anton for suggesting this. llvm-svn: 69615
Diffstat (limited to 'llvm/lib/CodeGen/MachineFunction.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineFunction.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp
index fc0e99fe4bb..e0cdad7783b 100644
--- a/llvm/lib/CodeGen/MachineFunction.cpp
+++ b/llvm/lib/CodeGen/MachineFunction.cpp
@@ -385,6 +385,16 @@ MachineFunction& MachineFunction::get(const Function *F)
return *mc;
}
+/// addLiveIn - Add the specified physical register as a live-in value and
+/// create a corresponding virtual register for it.
+unsigned MachineFunction::addLiveIn(unsigned PReg,
+ const TargetRegisterClass *RC) {
+ assert(RC->contains(PReg) && "Not the correct regclass!");
+ unsigned VReg = getRegInfo().createVirtualRegister(RC);
+ getRegInfo().addLiveIn(PReg, VReg);
+ return VReg;
+}
+
/// getOrCreateDebugLocID - Look up the DebugLocTuple index with the given
/// source file, line, and column. If none currently exists, create a new
/// DebugLocTuple, and insert it into the DebugIdMap.
OpenPOWER on IntegriCloud