Skip to content
This repository has been archived by the owner on Apr 23, 2020. It is now read-only.

Commit

Permalink
* Order #includes as per style guide
Browse files Browse the repository at this point in the history
* Doxygen-ify comments
* Make code layout more consistent


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9431 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
mbrukman committed Oct 23, 2003
1 parent a1f6435 commit 0d82a54
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 92 deletions.
58 changes: 29 additions & 29 deletions lib/CodeGen/RegAlloc/LiveRange.h
Expand Up @@ -18,58 +18,58 @@
#ifndef LIVERANGE_H
#define LIVERANGE_H

#include "llvm/CodeGen/ValueSet.h"
#include "llvm/Value.h"
#include "llvm/CodeGen/ValueSet.h"

class RegClass;
class IGNode;

class LiveRange : public ValueSet {
RegClass *MyRegClass; // register classs (e.g., int, FP) for this LR
RegClass *MyRegClass; // register class (e.g., int, FP) for this LR

// doesSpanAcrossCalls - Does this live range span across calls?
// This information is used by graph
// coloring algo to avoid allocating volatile colors to live ranges
// that span across calls (since they have to be saved/restored)
//
/// doesSpanAcrossCalls - Does this live range span across calls?
/// This information is used by graph coloring algo to avoid allocating
/// volatile colors to live ranges that span across calls (since they have to
/// be saved/restored)
///
bool doesSpanAcrossCalls;

IGNode *UserIGNode; // IGNode which uses this LR
int Color; // color assigned to this live range
bool mustSpill; // whether this LR must be spilt

// mustSaveAcrossCalls - whether this LR must be saved accross calls
// ***TODO REMOVE this
//
/// mustSaveAcrossCalls - whether this LR must be saved accross calls
/// ***TODO REMOVE this
///
bool mustSaveAcrossCalls;

// SuggestedColor - if this LR has a suggested color, can it be
// really alloated? A suggested color cannot be allocated when the
// suggested color is volatile and when there are call
// interferences.
//
/// SuggestedColor - if this LR has a suggested color, can it be
/// really alloated? A suggested color cannot be allocated when the
/// suggested color is volatile and when there are call
/// interferences.
///
int SuggestedColor; // The suggested color for this LR

// CanUseSuggestedCol - It is possible that a suggested color for
// this live range is not available before graph coloring (e.g., it
// can be allocated to another live range which interferes with
// this)
//
/// CanUseSuggestedCol - It is possible that a suggested color for
/// this live range is not available before graph coloring (e.g., it
/// can be allocated to another live range which interferes with
/// this)
///
bool CanUseSuggestedCol;

// SpilledStackOffsetFromFP - If this LR is spilled, its stack
// offset from *FP*. The spilled offsets must always be relative to
// the FP.
//
/// SpilledStackOffsetFromFP - If this LR is spilled, its stack
/// offset from *FP*. The spilled offsets must always be relative to
/// the FP.
///
int SpilledStackOffsetFromFP;

// HasSpillOffset 0 Whether this live range has a spill offset
//
/// HasSpillOffset 0 Whether this live range has a spill offset
///
bool HasSpillOffset;

// The spill cost of this live range. Calculated using loop depth of
// each reference to each Value in the live range
//
/// The spill cost of this live range. Calculated using loop depth of
/// each reference to each Value in the live range
///
unsigned SpillCost;

public:
Expand Down
11 changes: 4 additions & 7 deletions lib/CodeGen/RegAlloc/LiveRangeInfo.cpp
Expand Up @@ -11,16 +11,16 @@
//
//===----------------------------------------------------------------------===//

#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"

unsigned LiveRange::getRegClassID() const { return getRegClass()->getID(); }
Expand Down Expand Up @@ -217,7 +217,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.
Expand Down Expand Up @@ -278,8 +277,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();
Expand All @@ -299,8 +297,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;
Expand Down
22 changes: 12 additions & 10 deletions lib/CodeGen/RegAlloc/LiveRangeInfo.h
Expand Up @@ -87,20 +87,22 @@ class LiveRangeInfo {
std::vector<RegClass *> & RCList);


// Destructor to destroy all LiveRanges in the LiveRange Map
/// Destructor to destroy all LiveRanges in the LiveRange Map
///
~LiveRangeInfo();

// Main entry point for live range construction
//
void constructLiveRanges();

// return the common live range map for this method
//
/// return the common live range map for this method
///
inline const LiveRangeMapType *getLiveRangeMap() const
{ return &LiveRangeMap; }

// Method used to get the live range containing a Value.
// This may return NULL if no live range exists for a Value (eg, some consts)
/// Method used to get the live range containing a Value.
/// This may return NULL if no live range exists for a Value (eg, some consts)
///
inline LiveRange *getLiveRangeForValue(const Value *Val) {
return LiveRangeMap[Val];
}
Expand All @@ -109,13 +111,13 @@ class LiveRangeInfo {
return I->second;
}

// Method for coalescing live ranges. Called only after interference info
// is calculated.
//
/// Method for coalescing live ranges. Called only after interference info
/// is calculated.
///
void coalesceLRs();

// debugging method to print the live ranges
//
/// debugging method to print the live ranges
///
void printLiveRanges();
};

Expand Down
58 changes: 29 additions & 29 deletions lib/Target/SparcV9/RegAlloc/LiveRange.h
Expand Up @@ -18,58 +18,58 @@
#ifndef LIVERANGE_H
#define LIVERANGE_H

#include "llvm/CodeGen/ValueSet.h"
#include "llvm/Value.h"
#include "llvm/CodeGen/ValueSet.h"

class RegClass;
class IGNode;

class LiveRange : public ValueSet {
RegClass *MyRegClass; // register classs (e.g., int, FP) for this LR
RegClass *MyRegClass; // register class (e.g., int, FP) for this LR

// doesSpanAcrossCalls - Does this live range span across calls?
// This information is used by graph
// coloring algo to avoid allocating volatile colors to live ranges
// that span across calls (since they have to be saved/restored)
//
/// doesSpanAcrossCalls - Does this live range span across calls?
/// This information is used by graph coloring algo to avoid allocating
/// volatile colors to live ranges that span across calls (since they have to
/// be saved/restored)
///
bool doesSpanAcrossCalls;

IGNode *UserIGNode; // IGNode which uses this LR
int Color; // color assigned to this live range
bool mustSpill; // whether this LR must be spilt

// mustSaveAcrossCalls - whether this LR must be saved accross calls
// ***TODO REMOVE this
//
/// mustSaveAcrossCalls - whether this LR must be saved accross calls
/// ***TODO REMOVE this
///
bool mustSaveAcrossCalls;

// SuggestedColor - if this LR has a suggested color, can it be
// really alloated? A suggested color cannot be allocated when the
// suggested color is volatile and when there are call
// interferences.
//
/// SuggestedColor - if this LR has a suggested color, can it be
/// really alloated? A suggested color cannot be allocated when the
/// suggested color is volatile and when there are call
/// interferences.
///
int SuggestedColor; // The suggested color for this LR

// CanUseSuggestedCol - It is possible that a suggested color for
// this live range is not available before graph coloring (e.g., it
// can be allocated to another live range which interferes with
// this)
//
/// CanUseSuggestedCol - It is possible that a suggested color for
/// this live range is not available before graph coloring (e.g., it
/// can be allocated to another live range which interferes with
/// this)
///
bool CanUseSuggestedCol;

// SpilledStackOffsetFromFP - If this LR is spilled, its stack
// offset from *FP*. The spilled offsets must always be relative to
// the FP.
//
/// SpilledStackOffsetFromFP - If this LR is spilled, its stack
/// offset from *FP*. The spilled offsets must always be relative to
/// the FP.
///
int SpilledStackOffsetFromFP;

// HasSpillOffset 0 Whether this live range has a spill offset
//
/// HasSpillOffset 0 Whether this live range has a spill offset
///
bool HasSpillOffset;

// The spill cost of this live range. Calculated using loop depth of
// each reference to each Value in the live range
//
/// The spill cost of this live range. Calculated using loop depth of
/// each reference to each Value in the live range
///
unsigned SpillCost;

public:
Expand Down
11 changes: 4 additions & 7 deletions lib/Target/SparcV9/RegAlloc/LiveRangeInfo.cpp
Expand Up @@ -11,16 +11,16 @@
//
//===----------------------------------------------------------------------===//

#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"

unsigned LiveRange::getRegClassID() const { return getRegClass()->getID(); }
Expand Down Expand Up @@ -217,7 +217,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.
Expand Down Expand Up @@ -278,8 +277,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();
Expand All @@ -299,8 +297,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;
Expand Down
22 changes: 12 additions & 10 deletions lib/Target/SparcV9/RegAlloc/LiveRangeInfo.h
Expand Up @@ -87,20 +87,22 @@ class LiveRangeInfo {
std::vector<RegClass *> & RCList);


// Destructor to destroy all LiveRanges in the LiveRange Map
/// Destructor to destroy all LiveRanges in the LiveRange Map
///
~LiveRangeInfo();

// Main entry point for live range construction
//
void constructLiveRanges();

// return the common live range map for this method
//
/// return the common live range map for this method
///
inline const LiveRangeMapType *getLiveRangeMap() const
{ return &LiveRangeMap; }

// Method used to get the live range containing a Value.
// This may return NULL if no live range exists for a Value (eg, some consts)
/// Method used to get the live range containing a Value.
/// This may return NULL if no live range exists for a Value (eg, some consts)
///
inline LiveRange *getLiveRangeForValue(const Value *Val) {
return LiveRangeMap[Val];
}
Expand All @@ -109,13 +111,13 @@ class LiveRangeInfo {
return I->second;
}

// Method for coalescing live ranges. Called only after interference info
// is calculated.
//
/// Method for coalescing live ranges. Called only after interference info
/// is calculated.
///
void coalesceLRs();

// debugging method to print the live ranges
//
/// debugging method to print the live ranges
///
void printLiveRanges();
};

Expand Down

0 comments on commit 0d82a54

Please sign in to comment.