-MachineFunction& MachineFunction::get(const Function *F)
-{
- MachineFunction *mc = (MachineFunction*)F->getAnnotation(MF_AID);
- assert(mc && "Call construct() method first to allocate the object");
- return *mc;
-}
-
-/// lookUpDebugLocId - Look up the DebugLocTuple index with the given
-/// filename, line, and column. It may add a new filename and / or
-/// a new DebugLocTuple.
-unsigned MachineFunction::lookUpDebugLocId(const char *Filename, unsigned Line,
- unsigned Col) {
- unsigned FileId;
- StringMap<unsigned>::iterator I =
- DebugLocInfo.DebugFilenamesMap.find(Filename);
- if (I != DebugLocInfo.DebugFilenamesMap.end())
- FileId = I->second;
- else {
- // Add a new filename.
- FileId = DebugLocInfo.NumFilenames++;
- DebugLocInfo.DebugFilenames.push_back(Filename);
- DebugLocInfo.DebugFilenamesMap[Filename] = FileId;
- }
-
- struct DebugLocTuple Tuple(FileId, Line, Col);
- DebugIdMapType::iterator II = DebugLocInfo.DebugIdMap.find(Tuple);
+/// 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.
+unsigned MachineFunction::getOrCreateDebugLocID(MDNode *CompileUnit,
+ unsigned Line, unsigned Col) {
+ DebugLocTuple Tuple(CompileUnit, Line, Col);
+ DenseMap<DebugLocTuple, unsigned>::iterator II
+ = DebugLocInfo.DebugIdMap.find(Tuple);