Finegrainify namespacification
[oota-llvm.git] / lib / CodeGen / RegAlloc / LiveRangeInfo.cpp
index 928d04538ccfdc136b3444ce859f49c3642ca6b1..380680448d31e7c9105c8dec4846c052cf61cf32 100644 (file)
@@ -1,21 +1,30 @@
 //===-- LiveRangeInfo.cpp -------------------------------------------------===//
 // 
+//                     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.
+// 
+//===----------------------------------------------------------------------===//
+// 
 //  Live range construction for coloring-based register allocation for LLVM.
 // 
 //===----------------------------------------------------------------------===//
 
+#include "IGNode.h"
 #include "LiveRangeInfo.h"
 #include "RegAllocCommon.h"
 #include "RegClass.h"
-#include "IGNode.h"
+#include "llvm/Function.h"
 #include "llvm/CodeGen/MachineInstr.h"
 #include "llvm/CodeGen/MachineFunction.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/TargetInstrInfo.h"
 #include "llvm/Target/TargetRegInfo.h"
-#include "llvm/Function.h"
 #include "Support/SetOperations.h"
 
+namespace llvm {
+
 unsigned LiveRange::getRegClassID() const { return getRegClass()->getID(); }
 
 LiveRangeInfo::LiveRangeInfo(const Function *F, const TargetMachine &tm,
@@ -175,7 +184,7 @@ void LiveRangeInfo::constructLiveRanges() {
       // for each operand that is defined by the instruction
       for (MachineInstr::val_op_iterator OpI = MInst->begin(),
              OpE = MInst->end(); OpI != OpE; ++OpI)
-       if (OpI.isDefOnly() || OpI.isDefAndUse()) {     
+       if (OpI.isDef()) {     
          const Value *Def = *OpI;
           bool isCC = (OpI.getMachineOperand().getType()
                        == MachineOperand::MO_CCRegister);
@@ -194,8 +203,7 @@ void LiveRangeInfo::constructLiveRanges() {
       // iterate over implicit MI operands and create a new LR
       // for each operand that is defined by the instruction
       for (unsigned i = 0; i < MInst->getNumImplicitRefs(); ++i) 
-       if (MInst->getImplicitOp(i).opIsDefOnly() ||
-            MInst->getImplicitOp(i).opIsDefAndUse()) {     
+       if (MInst->getImplicitOp(i).isDef()) {
          const Value *Def = MInst->getImplicitRef(i);
           LiveRange* LR = createOrAddToLiveRange(Def, /*isCC*/ false);
 
@@ -210,7 +218,6 @@ void LiveRangeInfo::constructLiveRanges() {
        }
 
     } // for all machine instructions in the BB
-
   } // for all BBs in function
 
   // Now we have to suggest clors for call and return arg live ranges.
@@ -271,8 +278,7 @@ void LiveRangeInfo::suggestRegs4CallRets() {
 // Checks if live range LR interferes with any node assigned or suggested to
 // be assigned the specified color
 // 
-inline bool InterferesWithColor(const LiveRange& LR, unsigned color)
-{
+inline bool InterferesWithColor(const LiveRange& LR, unsigned color) {
   IGNode* lrNode = LR.getUserIGNode();
   for (unsigned n=0, NN = lrNode->getNumOfNeighbors(); n < NN; n++) {
     LiveRange *neighLR = lrNode->getAdjIGNode(n)->getParentLR();
@@ -292,8 +298,7 @@ inline bool InterferesWithColor(const LiveRange& LR, unsigned color)
 // (4) LR2 has color and LR1 interferes with any LR that has the same color
 // 
 inline bool InterfsPreventCoalescing(const LiveRange& LROfDef,
-                                     const LiveRange& LROfUse)
-{
+                                     const LiveRange& LROfUse) {
   // (4) if they have different suggested colors, cannot coalesce
   if (LROfDef.hasSuggestedColor() && LROfUse.hasSuggestedColor())
     return true;
@@ -336,7 +341,7 @@ void LiveRangeInfo::coalesceLRs()
       // iterate over  MI operands to find defs
       for(MachineInstr::const_val_op_iterator DefI = MI->begin(),
             DefE = MI->end(); DefI != DefE; ++DefI) {
-       if (DefI.isDefOnly() || DefI.isDefAndUse()) { // this operand is modified
+       if (DefI.isDef()) { // this operand is modified
          LiveRange *LROfDef = getLiveRangeForValue( *DefI );
          RegClass *RCOfDef = LROfDef->getRegClass();
 
@@ -407,3 +412,5 @@ void LiveRangeInfo::printLiveRanges() {
     }
   }
 }
+
+} // End llvm namespace