Fix problems linking against the reoptimizer; _llvm_regAllocState must have
[oota-llvm.git] / lib / CodeGen / RegAllocSimple.cpp
index 31b637496cf6958775e54f54c9396d804868a404..a210790b8dd77f0313d02be7fae97e4c9ac01c23 100644 (file)
@@ -1,4 +1,11 @@
 //===-- RegAllocSimple.cpp - A simple generic register allocator ----------===//
+// 
+//                     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 a simple register allocator. *Very* simple: It immediate
 // spills every value right after it is computed, and it reloads all used
@@ -7,6 +14,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#define DEBUG_TYPE "regalloc"
 #include "llvm/CodeGen/Passes.h"
 #include "llvm/CodeGen/MachineFunctionPass.h"
 #include "llvm/CodeGen/MachineInstr.h"
@@ -14,6 +22,7 @@
 #include "llvm/CodeGen/MachineFrameInfo.h"
 #include "llvm/Target/TargetInstrInfo.h"
 #include "llvm/Target/TargetMachine.h"
+#include "Support/Debug.h"
 #include "Support/Statistic.h"
 #include <iostream>
 
@@ -56,7 +65,7 @@ namespace {
     void AllocateBasicBlock(MachineBasicBlock &MBB);
 
     /// getStackSpaceFor - This returns the offset of the specified virtual
-    /// register on the stack, allocating space if neccesary.
+    /// register on the stack, allocating space if necessary.
     int getStackSpaceFor(unsigned VirtReg, const TargetRegisterClass *RC);
 
     /// Given a virtual register, return a compatible physical register that is
@@ -151,13 +160,13 @@ void RegAllocSimple::AllocateBasicBlock(MachineBasicBlock &MBB) {
     // are used by the instruction (including implicit uses)
     unsigned Opcode = MI->getOpcode();
     const TargetInstrDescriptor &Desc = TM->getInstrInfo().get(Opcode);
-    if (const unsigned *Regs = Desc.ImplicitUses)
-      while (*Regs)
-       RegsUsed[*Regs++] = true;
+    const unsigned *Regs = Desc.ImplicitUses;
+    while (*Regs)
+      RegsUsed[*Regs++] = true;
     
-    if (const unsigned *Regs = Desc.ImplicitDefs)
-      while (*Regs)
-       RegsUsed[*Regs++] = true;
+    Regs = Desc.ImplicitDefs;
+    while (*Regs)
+      RegsUsed[*Regs++] = true;
     
     // Loop over uses, move from memory into registers
     for (int i = MI->getNumOperands() - 1; i >= 0; --i) {
@@ -222,6 +231,6 @@ bool RegAllocSimple::runOnMachineFunction(MachineFunction &Fn) {
   return true;
 }
 
-Pass *createSimpleRegisterAllocator() {
+FunctionPass *createSimpleRegisterAllocator() {
   return new RegAllocSimple();
 }