Added SMS for superblocks as an option (experimental)
[oota-llvm.git] / lib / Target / SparcV9 / MachineFunctionInfo.cpp
index eb66aa00ec28ec9e1de14cb00a56eb294907d634..f97cb1fcf4e9761b017b4f34322ec3cf974bce68 100644 (file)
@@ -1,12 +1,12 @@
-//===-- MachineFunctionInfo.cpp -------------------------------------------===//
-// 
+//===-- SparcV9FunctionInfo.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.
-// 
+//
 //===----------------------------------------------------------------------===//
-// 
+//
 // This implements the SparcV9 specific MachineFunctionInfo class.
 //
 //===----------------------------------------------------------------------===//
 #include "llvm/Target/TargetFrameInfo.h"
 using namespace llvm;
 
-MachineFunctionInfo *MachineFunction::getInfo() const {
-  if (!MFInfo) {
-    MFInfo = new MachineFunctionInfo(*const_cast<MachineFunction*>(this));
-  }
-  return static_cast<MachineFunctionInfo*>(MFInfo);
-}
-
-
-
 static unsigned
 ComputeMaxOptionalArgsSize(const TargetMachine& target, const Function *F,
                            unsigned &maxOptionalNumArgs)
 {
   unsigned maxSize = 0;
-  
+
   for (Function::const_iterator BB = F->begin(), BBE = F->end(); BB !=BBE; ++BB)
     for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I != E; ++I)
       if (const CallInst *callInst = dyn_cast<CallInst>(I))
@@ -43,16 +34,16 @@ ComputeMaxOptionalArgsSize(const TargetMachine& target, const Function *F,
           int numExtra = numOperands-6;
           if (numExtra <= 0)
             continue;
-          
+
           unsigned sizeForThisCall = numExtra * 8;
-          
+
           if (maxSize < sizeForThisCall)
             maxSize = sizeForThisCall;
-          
+
           if ((int)maxOptionalNumArgs < numExtra)
             maxOptionalNumArgs = (unsigned) numExtra;
         }
-  
+
   return maxSize;
 }
 
@@ -64,7 +55,7 @@ ComputeMaxOptionalArgsSize(const TargetMachine& target, const Function *F,
 // This function is similar to the corresponding function in EmitAssembly.cpp
 // but they are unrelated.  This one does not align at more than a
 // double-word boundary whereas that one might.
-// 
+//
 inline unsigned
 SizeToAlignment(unsigned size, const TargetMachine& target)
 {
@@ -78,7 +69,7 @@ SizeToAlignment(unsigned size, const TargetMachine& target)
 }
 
 
-void MachineFunctionInfo::CalculateArgSize() {
+void SparcV9FunctionInfo::CalculateArgSize() {
   maxOptionalArgsSize = ComputeMaxOptionalArgsSize(MF.getTarget(),
                                                   MF.getFunction(),
                                                    maxOptionalNumArgs);
@@ -86,7 +77,7 @@ void MachineFunctionInfo::CalculateArgSize() {
 }
 
 int
-MachineFunctionInfo::computeOffsetforLocalVar(const Value* val,
+SparcV9FunctionInfo::computeOffsetforLocalVar(const Value* val,
                                              unsigned &getPaddedSize,
                                              unsigned  sizeToUse)
 {
@@ -112,14 +103,14 @@ MachineFunctionInfo::computeOffsetforLocalVar(const Value* val,
 }
 
 
-int MachineFunctionInfo::allocateLocalVar(const Value* val,
+int SparcV9FunctionInfo::allocateLocalVar(const Value* val,
                                           unsigned sizeToUse) {
   assert(! automaticVarsAreaFrozen &&
          "Size of auto vars area has been used to compute an offset so "
          "no more automatic vars should be allocated!");
-  
+
   // Check if we've allocated a stack slot for this value already
-  // 
+  //
   hash_map<const Value*, int>::const_iterator pair = offsets.find(val);
   if (pair != offsets.end())
     return pair->second;
@@ -132,31 +123,31 @@ int MachineFunctionInfo::allocateLocalVar(const Value* val,
 }
 
 int
-MachineFunctionInfo::allocateSpilledValue(const Type* type)
+SparcV9FunctionInfo::allocateSpilledValue(const Type* type)
 {
   assert(! spillsAreaFrozen &&
          "Size of reg spills area has been used to compute an offset so "
          "no more register spill slots should be allocated!");
-  
+
   unsigned size  = MF.getTarget().getTargetData().getTypeSize(type);
   unsigned char align = MF.getTarget().getTargetData().getTypeAlignment(type);
-  
+
   bool growUp;
   int firstOffset = MF.getTarget().getFrameInfo()->getRegSpillAreaOffset(MF, growUp);
-  
+
   int offset = growUp? firstOffset + getRegSpillsSize()
                      : firstOffset - (getRegSpillsSize() + size);
 
   int aligned = MF.getTarget().getFrameInfo()->adjustAlignment(offset, growUp, align);
   size += abs(aligned - offset); // include alignment padding in size
-  
+
   incrementRegSpillsSize(size);  // update size of reg. spills area
 
   return aligned;
 }
 
 int
-MachineFunctionInfo::pushTempValue(unsigned size)
+SparcV9FunctionInfo::pushTempValue(unsigned size)
 {
   unsigned align = SizeToAlignment(size, MF.getTarget());
 
@@ -175,6 +166,6 @@ MachineFunctionInfo::pushTempValue(unsigned size)
   return aligned;
 }
 
-void MachineFunctionInfo::popAllTempValues() {
+void SparcV9FunctionInfo::popAllTempValues() {
   resetTmpAreaSize();            // clear tmp area to reuse
 }