Remove attribution from file headers, per discussion on llvmdev.
[oota-llvm.git] / lib / CodeGen / PhysRegTracker.h
index d2ff82a237d59b7a59b9caa6a505ced7c1cd7f98..b300d4da0b6b37488e5a169d3afecf0ec5c3a075 100644 (file)
@@ -2,8 +2,8 @@
 //
 //                     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 is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
 //
 #ifndef LLVM_CODEGEN_PHYSREGTRACKER_H
 #define LLVM_CODEGEN_PHYSREGTRACKER_H
 
-#include "llvm/CodeGen/MachineFunction.h"
-#include <vector>
+#include "llvm/Target/MRegisterInfo.h"
 
 namespace llvm {
 
     class PhysRegTracker {
-    private:
         const MRegisterInfo* mri_;
         std::vector<unsigned> regUse_;
 
     public:
-        PhysRegTracker(MachineFunction* mf)
-            : mri_(mf ? mf->getTarget().getRegisterInfo() : NULL) {
-            if (mri_) {
-                regUse_.assign(mri_->getNumRegs(), 0);
-            }
+        explicit PhysRegTracker(const MRegisterInfo& mri)
+            : mri_(&mri),
+              regUse_(mri_->getNumRegs(), 0) {
         }
 
         PhysRegTracker(const PhysRegTracker& rhs)
@@ -50,10 +46,8 @@ namespace llvm {
             assert(MRegisterInfo::isPhysicalRegister(physReg) &&
                    "should be physical register!");
             ++regUse_[physReg];
-            for (const unsigned* as = mri_->getAliasSet(physReg); *as; ++as) {
-                physReg = *as;
-                ++regUse_[physReg];
-            }
+            for (const unsigned* as = mri_->getAliasSet(physReg); *as; ++as)
+                ++regUse_[*as];
         }
 
         void delRegUse(unsigned physReg) {
@@ -62,9 +56,8 @@ namespace llvm {
             assert(regUse_[physReg] != 0);
             --regUse_[physReg];
             for (const unsigned* as = mri_->getAliasSet(physReg); *as; ++as) {
-                physReg = *as;
-                assert(regUse_[physReg] != 0);
-                --regUse_[physReg];
+                assert(regUse_[*as] != 0);
+                --regUse_[*as];
             }
         }