Convert tabs to spaces

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21439 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Misha Brukman 2005-04-22 04:01:18 +00:00
parent 00876a2808
commit dedf2bd5a3
13 changed files with 42 additions and 47 deletions

View File

@ -180,11 +180,11 @@ void EquivClassGraphs::buildIndirectFunctionSets(Module &M) {
// This is the first callee from this call site. // This is the first callee from this call site.
LastInst = I->first; LastInst = I->first;
FirstFunc = I->second; FirstFunc = I->second;
// Instead of storing the lastInst For Indirection call Sites we store // Instead of storing the lastInst For Indirection call Sites we store
// the DSNode for the function ptr arguemnt // the DSNode for the function ptr arguemnt
Function *thisFunc = LastInst->getParent()->getParent(); Function *thisFunc = LastInst->getParent()->getParent();
DSGraph &TFG = CBU->getDSGraph(*thisFunc); DSGraph &TFG = CBU->getDSGraph(*thisFunc);
DSNode *calleeNode = TFG.getNodeForValue(CS.getCalledValue()).getNode(); DSNode *calleeNode = TFG.getNodeForValue(CS.getCalledValue()).getNode();
OneCalledFunction[calleeNode] = FirstFunc; OneCalledFunction[calleeNode] = FirstFunc;
FuncECs.insert(I->second); FuncECs.insert(I->second);
} else { } else {
@ -192,9 +192,9 @@ void EquivClassGraphs::buildIndirectFunctionSets(Module &M) {
// Union the callee in with the other functions. // Union the callee in with the other functions.
FuncECs.unionSets(FirstFunc, I->second); FuncECs.unionSets(FirstFunc, I->second);
#ifndef NDEBUG #ifndef NDEBUG
Function *thisFunc = LastInst->getParent()->getParent(); Function *thisFunc = LastInst->getParent()->getParent();
DSGraph &TFG = CBU->getDSGraph(*thisFunc); DSGraph &TFG = CBU->getDSGraph(*thisFunc);
DSNode *calleeNode = TFG.getNodeForValue(CS.getCalledValue()).getNode(); DSNode *calleeNode = TFG.getNodeForValue(CS.getCalledValue()).getNode();
assert(OneCalledFunction.count(calleeNode) > 0 && "Missed a call?"); assert(OneCalledFunction.count(calleeNode) > 0 && "Missed a call?");
#endif #endif
} }

View File

@ -38,7 +38,7 @@ ExprType::ExprType(Value *Val) {
} }
ExprType::ExprType(const ConstantInt *scale, Value *var, ExprType::ExprType(const ConstantInt *scale, Value *var,
const ConstantInt *offset) { const ConstantInt *offset) {
Scale = var ? scale : 0; Var = var; Offset = offset; Scale = var ? scale : 0; Var = var; Offset = offset;
ExprTy = Scale ? ScaledLinear : (Var ? Linear : Constant); ExprTy = Scale ? ScaledLinear : (Var ? Linear : Constant);
if (Scale && Scale->isNullValue()) { // Simplify 0*Var + const if (Scale && Scale->isNullValue()) { // Simplify 0*Var + const
@ -169,7 +169,7 @@ static inline const ConstantInt *Mul(const ConstantInt *Arg1,
Constant *Result = ConstantExpr::get(Instruction::Mul, (Constant*)Arg1, Constant *Result = ConstantExpr::get(Instruction::Mul, (Constant*)Arg1,
(Constant*)Arg2); (Constant*)Arg2);
assert(Result && Result->getType() == Arg1->getType() && assert(Result && Result->getType() == Arg1->getType() &&
"Couldn't perform multiplication!"); "Couldn't perform multiplication!");
ConstantInt *ResultI = cast<ConstantInt>(Result); ConstantInt *ResultI = cast<ConstantInt>(Result);
// Check to see if the result is one of the special cases that we want to // Check to see if the result is one of the special cases that we want to
@ -207,15 +207,15 @@ static ExprType handleAddition(ExprType Left, ExprType Right, Value *V) {
switch (Left.ExprTy) { switch (Left.ExprTy) {
case ExprType::Constant: case ExprType::Constant:
return ExprType(Right.Scale, Right.Var, return ExprType(Right.Scale, Right.Var,
DefZero(Right.Offset, Ty) + DefZero(Left.Offset, Ty)); DefZero(Right.Offset, Ty) + DefZero(Left.Offset, Ty));
case ExprType::Linear: // RHS side must be linear or scaled case ExprType::Linear: // RHS side must be linear or scaled
case ExprType::ScaledLinear: // RHS must be scaled case ExprType::ScaledLinear: // RHS must be scaled
if (Left.Var != Right.Var) // Are they the same variables? if (Left.Var != Right.Var) // Are they the same variables?
return V; // if not, we don't know anything! return V; // if not, we don't know anything!
return ExprType(DefOne(Left.Scale , Ty) + DefOne(Right.Scale , Ty), return ExprType(DefOne(Left.Scale , Ty) + DefOne(Right.Scale , Ty),
Right.Var, Right.Var,
DefZero(Left.Offset, Ty) + DefZero(Right.Offset, Ty)); DefZero(Left.Offset, Ty) + DefZero(Right.Offset, Ty));
default: default:
assert(0 && "Dont' know how to handle this case!"); assert(0 && "Dont' know how to handle this case!");
return ExprType(); return ExprType();
@ -233,7 +233,7 @@ static inline ExprType negate(const ExprType &E, Value *V) {
if (NegOne == 0) return V; // Couldn't subtract values... if (NegOne == 0) return V; // Couldn't subtract values...
return ExprType(DefOne (E.Scale , Ty) * NegOne, E.Var, return ExprType(DefOne (E.Scale , Ty) * NegOne, E.Var,
DefZero(E.Offset, Ty) * NegOne); DefZero(E.Offset, Ty) * NegOne);
} }
@ -283,7 +283,7 @@ ExprType llvm::ClassifyExpr(Value *Expr) {
ExprType Left(ClassifyExpr(I->getOperand(0))); ExprType Left(ClassifyExpr(I->getOperand(0)));
if (Right.Offset == 0) return Left; // shl x, 0 = x if (Right.Offset == 0) return Left; // shl x, 0 = x
assert(Right.Offset->getType() == Type::UByteTy && assert(Right.Offset->getType() == Type::UByteTy &&
"Shift amount must always be a unsigned byte!"); "Shift amount must always be a unsigned byte!");
uint64_t ShiftAmount = cast<ConstantUInt>(Right.Offset)->getValue(); uint64_t ShiftAmount = cast<ConstantUInt>(Right.Offset)->getValue();
ConstantInt *Multiplier = getUnsignedConstant(1ULL << ShiftAmount, Ty); ConstantInt *Multiplier = getUnsignedConstant(1ULL << ShiftAmount, Ty);
@ -301,7 +301,7 @@ ExprType llvm::ClassifyExpr(Value *Expr) {
return Expr; return Expr;
return ExprType(DefOne(Left.Scale, Ty) * Multiplier, Left.Var, return ExprType(DefOne(Left.Scale, Ty) * Multiplier, Left.Var,
DefZero(Left.Offset, Ty) * Multiplier); DefZero(Left.Offset, Ty) * Multiplier);
} // end case Instruction::Shl } // end case Instruction::Shl
case Instruction::Mul: { case Instruction::Mul: {
@ -316,7 +316,7 @@ ExprType llvm::ClassifyExpr(Value *Expr) {
const ConstantInt *Offs = Left.Offset; const ConstantInt *Offs = Left.Offset;
if (Offs == 0) return ExprType(); if (Offs == 0) return ExprType();
return ExprType( DefOne(Right.Scale , Ty) * Offs, Right.Var, return ExprType( DefOne(Right.Scale , Ty) * Offs, Right.Var,
DefZero(Right.Offset, Ty) * Offs); DefZero(Right.Offset, Ty) * Offs);
} // end case Instruction::Mul } // end case Instruction::Mul
case Instruction::Cast: { case Instruction::Cast: {

View File

@ -50,8 +50,8 @@ void FindUsedTypes::IncorporateValue(const Value *V) {
if (const Constant *C = dyn_cast<Constant>(V)) { if (const Constant *C = dyn_cast<Constant>(V)) {
if (!isa<GlobalValue>(C)) if (!isa<GlobalValue>(C))
for (User::const_op_iterator OI = C->op_begin(), OE = C->op_end(); for (User::const_op_iterator OI = C->op_begin(), OE = C->op_end();
OI != OE; ++OI) OI != OE; ++OI)
IncorporateValue(*OI); IncorporateValue(*OI);
} }
} }

View File

@ -109,8 +109,8 @@ namespace {
if (FunctionRecord *FR = getFunctionInfo(F)) if (FunctionRecord *FR = getFunctionInfo(F))
if (FR->FunctionEffect == 0) if (FR->FunctionEffect == 0)
return DoesNotAccessMemory; return DoesNotAccessMemory;
else if ((FR->FunctionEffect & Mod) == 0) else if ((FR->FunctionEffect & Mod) == 0)
return OnlyReadsMemory; return OnlyReadsMemory;
return AliasAnalysis::getModRefBehavior(F, CS, Info); return AliasAnalysis::getModRefBehavior(F, CS, Info);
} }

View File

@ -56,7 +56,7 @@ void IntervalPartition::addIntervalToPartition(Interval *I) {
void IntervalPartition::updatePredecessors(Interval *Int) { void IntervalPartition::updatePredecessors(Interval *Int) {
BasicBlock *Header = Int->getHeaderNode(); BasicBlock *Header = Int->getHeaderNode();
for (Interval::succ_iterator I = Int->Successors.begin(), for (Interval::succ_iterator I = Int->Successors.begin(),
E = Int->Successors.end(); I != E; ++I) E = Int->Successors.end(); I != E; ++I)
getBlockInterval(*I)->Predecessors.push_back(Header); getBlockInterval(*I)->Predecessors.push_back(Header);
} }

View File

@ -109,7 +109,7 @@ void LoopInfo::Calculate(const DominatorSet &DS) {
BasicBlock *RootNode = DS.getRoot(); BasicBlock *RootNode = DS.getRoot();
for (df_iterator<BasicBlock*> NI = df_begin(RootNode), for (df_iterator<BasicBlock*> NI = df_begin(RootNode),
NE = df_end(RootNode); NI != NE; ++NI) NE = df_end(RootNode); NI != NE; ++NI)
if (Loop *L = ConsiderForLoop(*NI, DS)) if (Loop *L = ConsiderForLoop(*NI, DS))
TopLevelLoops.push_back(L); TopLevelLoops.push_back(L);
} }
@ -191,7 +191,7 @@ Loop *LoopInfo::ConsiderForLoop(BasicBlock *BB, const DominatorSet &DS) {
// If there are any loops nested within this loop, create them now! // If there are any loops nested within this loop, create them now!
for (std::vector<BasicBlock*>::iterator I = L->Blocks.begin(), for (std::vector<BasicBlock*>::iterator I = L->Blocks.begin(),
E = L->Blocks.end(); I != E; ++I) E = L->Blocks.end(); I != E; ++I)
if (Loop *NewLoop = ConsiderForLoop(*I, DS)) { if (Loop *NewLoop = ConsiderForLoop(*I, DS)) {
L->SubLoops.push_back(NewLoop); L->SubLoops.push_back(NewLoop);
NewLoop->ParentLoop = L; NewLoop->ParentLoop = L;
@ -201,7 +201,7 @@ Loop *LoopInfo::ConsiderForLoop(BasicBlock *BB, const DominatorSet &DS) {
// loop can be found for them. // loop can be found for them.
// //
for (std::vector<BasicBlock*>::iterator I = L->Blocks.begin(), for (std::vector<BasicBlock*>::iterator I = L->Blocks.begin(),
E = L->Blocks.end(); I != E; ++I) { E = L->Blocks.end(); I != E; ++I) {
std::map<BasicBlock*, Loop*>::iterator BBMI = BBMap.lower_bound(*I); std::map<BasicBlock*, Loop*>::iterator BBMI = BBMap.lower_bound(*I);
if (BBMI == BBMap.end() || BBMI->first != *I) // Not in map yet... if (BBMI == BBMap.end() || BBMI->first != *I) // Not in map yet...
BBMap.insert(BBMI, std::make_pair(*I, L)); // Must be at this level BBMap.insert(BBMI, std::make_pair(*I, L)); // Must be at this level

View File

@ -88,7 +88,7 @@ bool PostDominatorSet::runOnFunction(Function &F) {
if (Roots.size() > 1) if (Roots.size() > 1)
WorkingSet.insert(0); WorkingSet.insert(0);
} }
WorkingSet.insert(BB); // A block always dominates itself WorkingSet.insert(BB); // A block always dominates itself
DomSetType &BBSet = Doms[BB]; DomSetType &BBSet = Doms[BB];
if (BBSet != WorkingSet) { if (BBSet != WorkingSet) {
@ -138,8 +138,8 @@ void ImmediatePostDominators::calcIDoms(const DominatorSetBase &DS) {
// dominator set size will be one less than BB's... // dominator set size will be one less than BB's...
// //
if (DS.getDominators(*I).size() == DomSetSize - 1) { if (DS.getDominators(*I).size() == DomSetSize - 1) {
IDoms[BB] = *I; IDoms[BB] = *I;
break; break;
} }
} }
} }
@ -196,7 +196,7 @@ void PostDominatorTree::calculate(const PostDominatorSet &DS) {
// //
Node *IDomNode = Nodes[*I]; Node *IDomNode = Nodes[*I];
assert(IDomNode && "No node for IDOM?"); assert(IDomNode && "No node for IDOM?");
// Add a new tree node for this BasicBlock, and link it as a child of // Add a new tree node for this BasicBlock, and link it as a child of
// IDomNode // IDomNode
Nodes[BB] = IDomNode->addChild(new Node(BB, IDomNode)); Nodes[BB] = IDomNode->addChild(new Node(BB, IDomNode));
@ -240,7 +240,7 @@ PostDominanceFrontier::calculate(const PostDominatorTree &DT,
DomSetType::const_iterator CDFI = ChildDF.begin(), CDFE = ChildDF.end(); DomSetType::const_iterator CDFI = ChildDF.begin(), CDFE = ChildDF.end();
for (; CDFI != CDFE; ++CDFI) { for (; CDFI != CDFE; ++CDFI) {
if (!Node->dominates(DT[*CDFI])) if (!Node->dominates(DT[*CDFI]))
S.insert(*CDFI); S.insert(*CDFI);
} }
} }

View File

@ -151,7 +151,7 @@ void SlotCalculator::processModule() {
unsigned FirstNonStringID = 0; unsigned FirstNonStringID = 0;
for (unsigned i = 0, e = Plane.size(); i != e; ++i) for (unsigned i = 0, e = Plane.size(); i != e; ++i)
if (isa<ConstantAggregateZero>(Plane[i]) || if (isa<ConstantAggregateZero>(Plane[i]) ||
(isa<ConstantArray>(Plane[i]) && (isa<ConstantArray>(Plane[i]) &&
cast<ConstantArray>(Plane[i])->isString())) { cast<ConstantArray>(Plane[i])->isString())) {
// Check to see if we have to shuffle this string around. If not, // Check to see if we have to shuffle this string around. If not,
// don't do anything. // don't do anything.

View File

@ -32,7 +32,7 @@ namespace {
// Eliminate PHI instructions by inserting copies into predecessor blocks. // Eliminate PHI instructions by inserting copies into predecessor blocks.
// //
for (MachineFunction::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I) for (MachineFunction::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I)
Changed |= EliminatePHINodes(Fn, *I); Changed |= EliminatePHINodes(Fn, *I);
//std::cerr << "AFTER PHI NODE ELIM:\n"; //std::cerr << "AFTER PHI NODE ELIM:\n";
//Fn.dump(); //Fn.dump();
@ -52,7 +52,7 @@ namespace {
}; };
RegisterPass<PNE> X("phi-node-elimination", RegisterPass<PNE> X("phi-node-elimination",
"Eliminate PHI nodes for register allocation"); "Eliminate PHI nodes for register allocation");
} }

View File

@ -91,7 +91,7 @@ namespace {
/// getStackSpaceFor - This allocates space for the specified virtual /// getStackSpaceFor - This allocates space for the specified virtual
/// register to be held on the stack. /// register to be held on the stack.
int RegAllocSimple::getStackSpaceFor(unsigned VirtReg, int RegAllocSimple::getStackSpaceFor(unsigned VirtReg,
const TargetRegisterClass *RC) { const TargetRegisterClass *RC) {
// Find the location VirtReg would belong... // Find the location VirtReg would belong...
std::map<unsigned, int>::iterator I = std::map<unsigned, int>::iterator I =
StackSlotForVirtReg.lower_bound(VirtReg); StackSlotForVirtReg.lower_bound(VirtReg);

View File

@ -981,7 +981,7 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,
case ISD::OR: case ISD::OR:
if (!C2)return N1; // X or 0 -> X if (!C2)return N1; // X or 0 -> X
if (N2C->isAllOnesValue()) if (N2C->isAllOnesValue())
return N2; // X or -1 -> -1 return N2; // X or -1 -> -1
break; break;
case ISD::XOR: case ISD::XOR:
if (!C2) return N1; // X xor 0 -> X if (!C2) return N1; // X xor 0 -> X
@ -1005,7 +1005,7 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,
return getNode(ISD::AND, VT, LHS, RHS); return getNode(ISD::AND, VT, LHS, RHS);
} }
} }
// X xor -1 -> not(x) ? // X xor -1 -> not(x) ?
} }
break; break;
} }
@ -1647,13 +1647,11 @@ void SDNode::dump() const {
dyn_cast<GlobalAddressSDNode>(this)) { dyn_cast<GlobalAddressSDNode>(this)) {
std::cerr << "<"; std::cerr << "<";
WriteAsOperand(std::cerr, GADN->getGlobal()) << ">"; WriteAsOperand(std::cerr, GADN->getGlobal()) << ">";
} else if (const FrameIndexSDNode *FIDN = } else if (const FrameIndexSDNode *FIDN = dyn_cast<FrameIndexSDNode>(this)) {
dyn_cast<FrameIndexSDNode>(this)) {
std::cerr << "<" << FIDN->getIndex() << ">"; std::cerr << "<" << FIDN->getIndex() << ">";
} else if (const ConstantPoolSDNode *CP = dyn_cast<ConstantPoolSDNode>(this)){ } else if (const ConstantPoolSDNode *CP = dyn_cast<ConstantPoolSDNode>(this)){
std::cerr << "<" << CP->getIndex() << ">"; std::cerr << "<" << CP->getIndex() << ">";
} else if (const BasicBlockSDNode *BBDN = } else if (const BasicBlockSDNode *BBDN = dyn_cast<BasicBlockSDNode>(this)) {
dyn_cast<BasicBlockSDNode>(this)) {
std::cerr << "<"; std::cerr << "<";
const Value *LBB = (const Value*)BBDN->getBasicBlock()->getBasicBlock(); const Value *LBB = (const Value*)BBDN->getBasicBlock()->getBasicBlock();
if (LBB) if (LBB)

View File

@ -418,7 +418,7 @@ void SelectionDAGLowering::visitBr(BranchInst &I) {
// If this is not a fall-through branch, emit the branch. // If this is not a fall-through branch, emit the branch.
if (Succ0MBB != NextBlock) if (Succ0MBB != NextBlock)
DAG.setRoot(DAG.getNode(ISD::BR, MVT::Other, getRoot(), DAG.setRoot(DAG.getNode(ISD::BR, MVT::Other, getRoot(),
DAG.getBasicBlock(Succ0MBB))); DAG.getBasicBlock(Succ0MBB)));
} else { } else {
MachineBasicBlock *Succ1MBB = FuncInfo.MBBMap[I.getSuccessor(1)]; MachineBasicBlock *Succ1MBB = FuncInfo.MBBMap[I.getSuccessor(1)];
@ -427,14 +427,14 @@ void SelectionDAGLowering::visitBr(BranchInst &I) {
// If the condition is false, fall through. This means we should branch // If the condition is false, fall through. This means we should branch
// if the condition is true to Succ #0. // if the condition is true to Succ #0.
DAG.setRoot(DAG.getNode(ISD::BRCOND, MVT::Other, getRoot(), DAG.setRoot(DAG.getNode(ISD::BRCOND, MVT::Other, getRoot(),
Cond, DAG.getBasicBlock(Succ0MBB))); Cond, DAG.getBasicBlock(Succ0MBB)));
} else if (Succ0MBB == NextBlock) { } else if (Succ0MBB == NextBlock) {
// If the condition is true, fall through. This means we should branch if // If the condition is true, fall through. This means we should branch if
// the condition is false to Succ #1. Invert the condition first. // the condition is false to Succ #1. Invert the condition first.
SDOperand True = DAG.getConstant(1, Cond.getValueType()); SDOperand True = DAG.getConstant(1, Cond.getValueType());
Cond = DAG.getNode(ISD::XOR, Cond.getValueType(), Cond, True); Cond = DAG.getNode(ISD::XOR, Cond.getValueType(), Cond, True);
DAG.setRoot(DAG.getNode(ISD::BRCOND, MVT::Other, getRoot(), DAG.setRoot(DAG.getNode(ISD::BRCOND, MVT::Other, getRoot(),
Cond, DAG.getBasicBlock(Succ1MBB))); Cond, DAG.getBasicBlock(Succ1MBB)));
} else { } else {
std::vector<SDOperand> Ops; std::vector<SDOperand> Ops;
Ops.push_back(getRoot()); Ops.push_back(getRoot());
@ -537,7 +537,7 @@ void SelectionDAGLowering::visitGetElementPtr(User &I) {
// N = N + Offset // N = N + Offset
uint64_t Offset = TD.getStructLayout(StTy)->MemberOffsets[Field]; uint64_t Offset = TD.getStructLayout(StTy)->MemberOffsets[Field];
N = DAG.getNode(ISD::ADD, N.getValueType(), N, N = DAG.getNode(ISD::ADD, N.getValueType(), N,
getIntPtrConstant(Offset)); getIntPtrConstant(Offset));
} }
Ty = StTy->getElementType(Field); Ty = StTy->getElementType(Field);
} else { } else {
@ -558,7 +558,6 @@ void SelectionDAGLowering::visitGetElementPtr(User &I) {
IdxN = DAG.getNode(ISD::TRUNCATE, Scale.getValueType(), IdxN); IdxN = DAG.getNode(ISD::TRUNCATE, Scale.getValueType(), IdxN);
IdxN = DAG.getNode(ISD::MUL, N.getValueType(), IdxN, Scale); IdxN = DAG.getNode(ISD::MUL, N.getValueType(), IdxN, Scale);
N = DAG.getNode(ISD::ADD, N.getValueType(), N, IdxN); N = DAG.getNode(ISD::ADD, N.getValueType(), N, IdxN);
} }
} }

View File

@ -73,13 +73,11 @@ std::string DOTGraphTraits<SelectionDAG*>::getNodeLabel(const SDNode *Node,
} else if (const GlobalAddressSDNode *GADN = } else if (const GlobalAddressSDNode *GADN =
dyn_cast<GlobalAddressSDNode>(Node)) { dyn_cast<GlobalAddressSDNode>(Node)) {
Op += ": " + GADN->getGlobal()->getName(); Op += ": " + GADN->getGlobal()->getName();
} else if (const FrameIndexSDNode *FIDN = } else if (const FrameIndexSDNode *FIDN = dyn_cast<FrameIndexSDNode>(Node)) {
dyn_cast<FrameIndexSDNode>(Node)) {
Op += " " + itostr(FIDN->getIndex()); Op += " " + itostr(FIDN->getIndex());
} else if (const ConstantPoolSDNode *CP = dyn_cast<ConstantPoolSDNode>(Node)){ } else if (const ConstantPoolSDNode *CP = dyn_cast<ConstantPoolSDNode>(Node)){
Op += "<" + utostr(CP->getIndex()) + ">"; Op += "<" + utostr(CP->getIndex()) + ">";
} else if (const BasicBlockSDNode *BBDN = } else if (const BasicBlockSDNode *BBDN = dyn_cast<BasicBlockSDNode>(Node)) {
dyn_cast<BasicBlockSDNode>(Node)) {
Op = "BB: "; Op = "BB: ";
const Value *LBB = (const Value*)BBDN->getBasicBlock()->getBasicBlock(); const Value *LBB = (const Value*)BBDN->getBasicBlock()->getBasicBlock();
if (LBB) if (LBB)