39 files changed:
// class Cilkifier
//
// Code generation pass that transforms code to identify where Cilk keywords
// class Cilkifier
//
// Code generation pass that transforms code to identify where Cilk keywords
-// should be inserted. This relies on dis -c to print out the keywords.
+// should be inserted. This relies on `llvm-dis -c' to print out the keywords.
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
else
syncI = new CallInst(DummySyncFunc, std::vector<Value*>(), "", I);
else
syncI = new CallInst(DummySyncFunc, std::vector<Value*>(), "", I);
- // Remember the sync for each spawn to eliminate rendundant ones later
+ // Remember the sync for each spawn to eliminate redundant ones later
spawnToSyncsMap[cast<CallInst>(root)].insert(syncI);
return;
spawnToSyncsMap[cast<CallInst>(root)].insert(syncI);
return;
#undef CAN_USE_BIND1ST_ON_REFERENCE_TYPE_ARGS
#ifdef CAN_USE_BIND1ST_ON_REFERENCE_TYPE_ARGS
#undef CAN_USE_BIND1ST_ON_REFERENCE_TYPE_ARGS
#ifdef CAN_USE_BIND1ST_ON_REFERENCE_TYPE_ARGS
- // Use this undecipherable STLese because erase invalidates iterators.
+ // Use this indecipherable STLese because erase invalidates iterators.
// Otherwise we have to copy sets as above.
hash_set<Function*>::iterator extrasBegin =
std::remove_if(parallelFunctions.begin(), parallelFunctions.end(),
// Otherwise we have to copy sets as above.
hash_set<Function*>::iterator extrasBegin =
std::remove_if(parallelFunctions.begin(), parallelFunctions.end(),
SymbolTable::const_iterator PI = SrcST->find(Type::TypeTy);
if (PI == SrcST->end()) return false; // No named types, do nothing.
SymbolTable::const_iterator PI = SrcST->find(Type::TypeTy);
if (PI == SrcST->end()) return false; // No named types, do nothing.
- // Some types cannot be resolved immediately becuse they depend on other types
- // being resolved to each other first. This contains a list of types we are
- // waiting to recheck.
+ // Some types cannot be resolved immediately because they depend on other
+ // types being resolved to each other first. This contains a list of types we
+ // are waiting to recheck.
std::vector<std::string> DelayedTypesToResolve;
const SymbolTable::VarMap &VM = PI->second;
std::vector<std::string> DelayedTypesToResolve;
const SymbolTable::VarMap &VM = PI->second;
/// Function. MachineBasicBlocks are numbered from begin() to end()
/// in the Function's corresponding MachineFunction. Each successive
/// MachineBasicBlock increments the numbering by the number of instructions
/// Function. MachineBasicBlocks are numbered from begin() to end()
/// in the Function's corresponding MachineFunction. Each successive
/// MachineBasicBlock increments the numbering by the number of instructions
-/// it contains. The side-effect of this method is to fill in the paramete
+/// it contains. The side-effect of this method is to fill in the parameter
/// KEY with the mapping of MachineBasicBlocks to numbers. KEY
/// is keyed on MachineInstrs, so each MachineBasicBlock is represented
/// therein by its first MachineInstr.
/// KEY with the mapping of MachineBasicBlocks to numbers. KEY
/// is keyed on MachineInstrs, so each MachineBasicBlock is represented
/// therein by its first MachineInstr.
RestoreRegisters(DoubleFP, FSR, FPRS, CCR);
RestoreRegisters(DoubleFP, FSR, FPRS, CCR);
- // Change the return address to reexecute the restore, then the jump. However,
- // we can't just modify %i7 here, because we return to the function that will
- // restore the floating-point registers for us. Thus, we just return the value
- // we want it to be, and the parent will take care of setting %i7 correctly.
+ // Change the return address to re-execute the restore, then the jump.
+ // However, we can't just modify %i7 here, because we return to the function
+ // that will restore the floating-point registers for us. Thus, we just return
+ // the value we want it to be, and the parent will take care of setting %i7
+ // correctly.
DEBUG(std::cerr << "Callback returning to: 0x"
<< std::hex << (CameFrom-Offset-12) << "\n");
#if defined(sparc) || defined(__sparc__) || defined(__sparcv9)
DEBUG(std::cerr << "Callback returning to: 0x"
<< std::hex << (CameFrom-Offset-12) << "\n");
#if defined(sparc) || defined(__sparc__) || defined(__sparcv9)
// only numbered 0-31, hence can already fit into 5 bits (and 6)
DEBUG(std::cerr << "FP single reg, returning: " << fakeReg << "\n");
} else if (regType == UltraSparcRegInfo::FPDoubleRegType) {
// only numbered 0-31, hence can already fit into 5 bits (and 6)
DEBUG(std::cerr << "FP single reg, returning: " << fakeReg << "\n");
} else if (regType == UltraSparcRegInfo::FPDoubleRegType) {
- // FIXME: This assumes that we only have 5-bit register fiels!
+ // FIXME: This assumes that we only have 5-bit register fields!
// From Sparc Manual, page 40.
// The bit layout becomes: b[4], b[3], b[2], b[1], b[5]
fakeReg |= (fakeReg >> 5) & 1;
// From Sparc Manual, page 40.
// The bit layout becomes: b[4], b[3], b[2], b[1], b[5]
fakeReg |= (fakeReg >> 5) & 1;
int64_t CallInstTarget = (rv - CurrPC) >> 2;
if (CallInstTarget >= (1<<29) || CallInstTarget <= -(1<<29)) {
DEBUG(std::cerr << "Making far call!\n");
int64_t CallInstTarget = (rv - CurrPC) >> 2;
if (CallInstTarget >= (1<<29) || CallInstTarget <= -(1<<29)) {
DEBUG(std::cerr << "Making far call!\n");
- // addresss is out of bounds for the 30-bit call,
+ // address is out of bounds for the 30-bit call,
// make an indirect jump-and-link
emitFarCall(rv);
// this invalidates the instruction so that the call with an incorrect
// make an indirect jump-and-link
emitFarCall(rv);
// this invalidates the instruction so that the call with an incorrect
- // if we didn't find a color becuase the LR was single precision or
+ // if we didn't find a color because the LR was single precision or
// all f32-f63 range is filled, we try to allocate a register from
// the f0 - f31 region
// all f32-f63 range is filled, we try to allocate a register from
// the f0 - f31 region
- LR->setColor(ColorFound); // first color found in prefered order
+ LR->setColor(ColorFound); // first color found in preferred order
LR->markForSaveAcrossCalls();
} else {
// we are here because no color could be found
LR->markForSaveAcrossCalls();
} else {
// we are here because no color could be found
- // Now the arg is coming on stack. Since the LR recieved a register,
+ // Now the arg is coming on stack. Since the LR received a register,
// we just have to load the arg on stack into that register
//
const TargetFrameInfo& frameInfo = target.getFrameInfo();
// we just have to load the arg on stack into that register
//
const TargetFrameInfo& frameInfo = target.getFrameInfo();
else {
// Now the arg is coming on stack. Since the LR did NOT
else {
// Now the arg is coming on stack. Since the LR did NOT
- // recieved a register as well, it is allocated a stack position. We
+ // received a register as well, it is allocated a stack position. We
// can simply change the stack position of the LR. We can do this,
// since this method is called before any other method that makes
// uses of the stack pos of the LR (e.g., updateMachineInstr)
// can simply change the stack position of the LR. We can do this,
// since this method is called before any other method that makes
// uses of the stack pos of the LR (e.g., updateMachineInstr)
/// handleSpecialFP - Handle special instructions which behave unlike other
/// handleSpecialFP - Handle special instructions which behave unlike other
-/// floating point instructions. This is primarily inteaded for use by pseudo
+/// floating point instructions. This is primarily intended for use by pseudo
/// instructions.
///
void FPS::handleSpecialFP(MachineBasicBlock::iterator &I) {
/// instructions.
///
void FPS::handleSpecialFP(MachineBasicBlock::iterator &I) {
return;
}
case cByte: case cShort: case cInt:
return;
}
case cByte: case cShort: case cInt:
- break; // Small integerals, handled below...
+ break; // Small integrals, handled below...
default: assert(0 && "Unknown class!");
}
default: assert(0 && "Unknown class!");
}
/// handleSpecialFP - Handle special instructions which behave unlike other
/// handleSpecialFP - Handle special instructions which behave unlike other
-/// floating point instructions. This is primarily inteaded for use by pseudo
+/// floating point instructions. This is primarily intended for use by pseudo
/// instructions.
///
void FPS::handleSpecialFP(MachineBasicBlock::iterator &I) {
/// instructions.
///
void FPS::handleSpecialFP(MachineBasicBlock::iterator &I) {
return;
}
case cByte: case cShort: case cInt:
return;
}
case cByte: case cShort: case cInt:
- break; // Small integerals, handled below...
+ break; // Small integrals, handled below...
default: assert(0 && "Unknown class!");
}
default: assert(0 && "Unknown class!");
}
// If we have a scale, apply it first...
if (Expr.Var) {
// If we have a scale, apply it first...
if (Expr.Var) {
- // Expr.Var is not neccesarily unsigned right now, insert a cast now.
+ // Expr.Var is not necessarily unsigned right now, insert a cast now.
if (Expr.Var->getType() != Type::UIntTy)
Expr.Var = new CastInst(Expr.Var, Type::UIntTy,
Expr.Var->getName()+"-uint", It);
if (Expr.Var->getType() != Type::UIntTy)
Expr.Var = new CastInst(Expr.Var, Type::UIntTy,
Expr.Var->getName()+"-uint", It);
// Do not Check to see if our incoming pointer can be converted
// to be a ptr to an array of the right type... because in more cases than
// not, it is simply not analyzable because of pointer/array
// Do not Check to see if our incoming pointer can be converted
// to be a ptr to an array of the right type... because in more cases than
// not, it is simply not analyzable because of pointer/array
- // discrepencies. To fix this, we will insert a cast before the GEP.
+ // discrepancies. To fix this, we will insert a cast before the GEP.
//
// Check to see if 'N' is an expression that can be converted to
//
// Check to see if 'N' is an expression that can be converted to
Name = ""; // Make sure not to name a void call!
// Get an iterator to the call instruction so that we can insert casts for
Name = ""; // Make sure not to name a void call!
// Get an iterator to the call instruction so that we can insert casts for
- // operands if needbe. Note that we do not require operands to be
+ // operands if need be. Note that we do not require operands to be
// convertible, we can insert casts if they are convertible but not
// compatible. The reason for this is that we prefer to have resolved
// functions but casted arguments if possible.
// convertible, we can insert casts if they are convertible but not
// compatible. The reason for this is that we prefer to have resolved
// functions but casted arguments if possible.
bool DAE::run(Module &M) {
// First phase: loop through the module, determining which arguments are live.
// We assume all arguments are dead unless proven otherwise (allowing us to
bool DAE::run(Module &M) {
// First phase: loop through the module, determining which arguments are live.
// We assume all arguments are dead unless proven otherwise (allowing us to
- // determing that dead arguments passed into recursive functions are dead).
+ // determine that dead arguments passed into recursive functions are dead).
//
std::set<Argument*> LiveArguments, MaybeLiveArguments, DeadArguments;
std::multimap<Function*, CallSite> CallSites;
//
std::set<Argument*> LiveArguments, MaybeLiveArguments, DeadArguments;
std::multimap<Function*, CallSite> CallSites;
if (Named == 0) return false; // No function to extract
}
if (Named == 0) return false; // No function to extract
}
- // Make sure our result is globally accessable...
+ // Make sure our result is globally accessible...
Named->setLinkage(GlobalValue::ExternalLinkage);
// Mark all global variables internal
Named->setLinkage(GlobalValue::ExternalLinkage);
// Mark all global variables internal
if (Callee->use_size() == 1 && Callee->hasInternalLinkage())
InlineCost -= 30000;
if (Callee->use_size() == 1 && Callee->hasInternalLinkage())
InlineCost -= 30000;
- // Add to the inline quality for properties that make the call valueable to
+ // Add to the inline quality for properties that make the call valuable to
// inline. This includes factors that indicate that the result of inlining
// the function will be optimizable. Currently this just looks at arguments
// passed into the function.
// inline. This includes factors that indicate that the result of inlining
// the function will be optimizable. Currently this just looks at arguments
// passed into the function.
-// AdjustIndices - Convert the indexes specifed by Idx to the new changed form
+// AdjustIndices - Convert the indices specified by Idx to the new changed form
// using the specified OldTy as the base type being indexed into.
//
void MutateStructTypes::AdjustIndices(const CompositeType *OldTy,
// using the specified OldTy as the base type being indexed into.
//
void MutateStructTypes::AdjustIndices(const CompositeType *OldTy,
// class Cilkifier
//
// Code generation pass that transforms code to identify where Cilk keywords
// class Cilkifier
//
// Code generation pass that transforms code to identify where Cilk keywords
-// should be inserted. This relies on dis -c to print out the keywords.
+// should be inserted. This relies on `llvm-dis -c' to print out the keywords.
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
else
syncI = new CallInst(DummySyncFunc, std::vector<Value*>(), "", I);
else
syncI = new CallInst(DummySyncFunc, std::vector<Value*>(), "", I);
- // Remember the sync for each spawn to eliminate rendundant ones later
+ // Remember the sync for each spawn to eliminate redundant ones later
spawnToSyncsMap[cast<CallInst>(root)].insert(syncI);
return;
spawnToSyncsMap[cast<CallInst>(root)].insert(syncI);
return;
#undef CAN_USE_BIND1ST_ON_REFERENCE_TYPE_ARGS
#ifdef CAN_USE_BIND1ST_ON_REFERENCE_TYPE_ARGS
#undef CAN_USE_BIND1ST_ON_REFERENCE_TYPE_ARGS
#ifdef CAN_USE_BIND1ST_ON_REFERENCE_TYPE_ARGS
- // Use this undecipherable STLese because erase invalidates iterators.
+ // Use this indecipherable STLese because erase invalidates iterators.
// Otherwise we have to copy sets as above.
hash_set<Function*>::iterator extrasBegin =
std::remove_if(parallelFunctions.begin(), parallelFunctions.end(),
// Otherwise we have to copy sets as above.
hash_set<Function*>::iterator extrasBegin =
std::remove_if(parallelFunctions.begin(), parallelFunctions.end(),
//add an edge
//this adds an edge ONLY when
//add an edge
//this adds an edge ONLY when
-//the edge to be added doesn not already exist
+//the edge to be added does not already exist
//we "equate" two edges here only with their
//end points
void Graph::addEdge(Edge ed, int w){
//we "equate" two edges here only with their
//end points
void Graph::addEdge(Edge ed, int w){
//reverse the sign of weights on edges
//this way, max-spanning tree could be obtained
//reverse the sign of weights on edges
//this way, max-spanning tree could be obtained
-//usin min-spanning tree, and vice versa
+//using min-spanning tree, and vice versa
void Graph::reverseWts(){
vector<Node *> allNodes=getAllNodes();
for(vector<Node *>::iterator NI=allNodes.begin(), NE=allNodes.end(); NI!=NE;
void Graph::reverseWts(){
vector<Node *> allNodes=getAllNodes();
for(vector<Node *>::iterator NI=allNodes.begin(), NE=allNodes.end(); NI!=NE;
-//===-- GrapAuxillary.cpp- Auxillary functions on graph ----------*- C++ -*--=//
+//===-- GrapAuxiliary.cpp- Auxiliary functions on graph ----------*- C++ -*--=//
-//auxillary function associated with graph: they
+//auxiliary function associated with graph: they
//all operate on graph, and help in inserting
//instrumentation for trace generation
//
//all operate on graph, and help in inserting
//instrumentation for trace generation
//
}
//This is a helper function to get the edge increments
}
//This is a helper function to get the edge increments
-//This is used in conjuntion with inc_DFS
+//This is used in conjunction with inc_DFS
//to get the edge increments
//Edge increment implies assigning a value to all the edges in the graph
//such that if we traverse along any path from root to exit, and
//to get the edge increments
//Edge increment implies assigning a value to all the edges in the graph
//such that if we traverse along any path from root to exit, and
- //check that the edges must have atleast one common endpoint
+ //check that the edges must have at least one common endpoint
assert(*(e.getFirst())==*(f.getFirst()) ||
*(e.getFirst())==*(f.getSecond()) ||
*(e.getSecond())==*(f.getFirst()) ||
assert(*(e.getFirst())==*(f.getFirst()) ||
*(e.getFirst())==*(f.getSecond()) ||
*(e.getSecond())==*(f.getFirst()) ||
//===-- ProfilePaths.cpp - interface to insert instrumentation ---*- C++ -*--=//
//
//===-- ProfilePaths.cpp - interface to insert instrumentation ---*- C++ -*--=//
//
-// This inserts intrumentation for counting
+// This inserts instrumentation for counting
// execution of paths though a given function
// Its implemented as a "Function" Pass, and called using opt
//
// execution of paths though a given function
// Its implemented as a "Function" Pass, and called using opt
//
//
// The algorithms work on a Graph constructed over the nodes
// made from Basic Blocks: The transformations then take place on
//
// The algorithms work on a Graph constructed over the nodes
// made from Basic Blocks: The transformations then take place on
-// the constucted graph (implementation in Graph.cpp and GraphAuxillary.cpp)
+// the constructed graph (implementation in Graph.cpp and GraphAuxiliary.cpp)
// and finally, appropriate instrumentation is placed over suitable edges.
// (code inserted through EdgeCode.cpp).
//
// and finally, appropriate instrumentation is placed over suitable edges.
// (code inserted through EdgeCode.cpp).
//
Node *tmp;
Node *exitNode = 0, *startNode = 0;
Node *tmp;
Node *exitNode = 0, *startNode = 0;
- // The nodes must be uniquesly identified:
+ // The nodes must be uniquely identified:
// That is, no two nodes must hav same BB*
for (Function::iterator BB = F.begin(), BE = F.end(); BB != BE; ++BB) {
// That is, no two nodes must hav same BB*
for (Function::iterator BB = F.begin(), BE = F.end(); BB != BE; ++BB) {
- // now do it againto insert edges
+ // now do it again to insert edges
for (Function::iterator BB = F.begin(), BE = F.end(); BB != BE; ++BB){
Node *nd=findBB(nodes, BB);
assert(nd && "No node for this edge!");
for (Function::iterator BB = F.begin(), BE = F.end(); BB != BE; ++BB){
Node *nd=findBB(nodes, BB);
assert(nd && "No node for this edge!");
if(fr->getParent()->getName() == "main"){
if(fr->getParent()->getName() == "main"){
// FIXME: THIS IS HORRIBLY BROKEN. FUNCTION PASSES CANNOT DO THIS, EXCEPT
// IN THEIR INITIALIZE METHOD!!
// FIXME: THIS IS HORRIBLY BROKEN. FUNCTION PASSES CANNOT DO THIS, EXCEPT
// IN THEIR INITIALIZE METHOD!!
// Loop over all of the instructions in the function, telling dead
// instructions to drop their references. This is so that the next sweep
// over the program can safely delete dead instructions without other dead
// Loop over all of the instructions in the function, telling dead
// instructions to drop their references. This is so that the next sweep
// over the program can safely delete dead instructions without other dead
- // instructions still refering to them.
+ // instructions still referring to them.
//
dropReferencesOfDeadInstructionsInLiveBlock(I);
//
dropReferencesOfDeadInstructionsInLiveBlock(I);
if (LastNode == 0) { // No postdominator!
// Call RemoveSuccessor to transmogrify the terminator instruction
// to not contain the outgoing branch, or to create a new
if (LastNode == 0) { // No postdominator!
// Call RemoveSuccessor to transmogrify the terminator instruction
// to not contain the outgoing branch, or to create a new
- // terminator if the form fundementally changes (ie unconditional
- // branch to return). Note that this will change a branch into an
- // infinite loop into a return instruction!
+ // terminator if the form fundamentally changes (i.e.,
+ // unconditional branch to return). Note that this will change a
+ // branch into an infinite loop into a return instruction!
//
RemoveSuccessor(TI, i);
//
RemoveSuccessor(TI, i);
// Now loop over all of the instructions in the basic block, telling
// dead instructions to drop their references. This is so that the next
// sweep over the program can safely delete dead instructions without
// Now loop over all of the instructions in the basic block, telling
// dead instructions to drop their references. This is so that the next
// sweep over the program can safely delete dead instructions without
- // other dead instructions still refering to them.
+ // other dead instructions still referring to them.
//
dropReferencesOfDeadInstructionsInLiveBlock(BB);
}
//
dropReferencesOfDeadInstructionsInLiveBlock(BB);
}
void setReplacement(Value *Repl) { Replacement = Repl; }
// getRelation - return the relationship entry for the specified value.
void setReplacement(Value *Repl) { Replacement = Repl; }
// getRelation - return the relationship entry for the specified value.
- // This can invalidate references to other Relation's, so use it carefully.
+ // This can invalidate references to other Relations, so use it carefully.
//
Relation &getRelation(Value *V) {
// Binary search for V's entry...
//
Relation &getRelation(Value *V) {
// Binary search for V's entry...
- // If the information propogted is new, then we want process the uses of this
+ // If the information propagated is new, then we want process the uses of this
// instruction to propagate the information down to them.
//
if (Op1R.incorporate(Opcode, VI))
// instruction to propagate the information down to them.
//
if (Op1R.incorporate(Opcode, VI))
Instruction *Ret = 0;
if (BB1 == BB2) {
Instruction *Ret = 0;
if (BB1 == BB2) {
- // Eliminate the second occuring instruction. Add all uses of the second
+ // Eliminate the second occurring instruction. Add all uses of the second
// instruction to the worklist.
//
// Scan the basic block looking for the "first" instruction
// instruction to the worklist.
//
// Scan the basic block looking for the "first" instruction
- // In thiscase, the expression would be hoisted to outside the 'if' stmt,
+ // In this case, the expression would be hoisted to outside the 'if' stmt,
// causing the expression to be evaluated, even for the if (d) path, which
// could cause problems, if, for example, it caused a divide by zero. In
// general the problem this case is trying to solve is better addressed with
// causing the expression to be evaluated, even for the if (d) path, which
// could cause problems, if, for example, it caused a divide by zero. In
// general the problem this case is trying to solve is better addressed with
BasicBlock::iterator AfterPHIIt = Header->begin();
for (; PHINode *PN = dyn_cast<PHINode>(AfterPHIIt); ++AfterPHIIt)
IndVars.push_back(InductionVariable(PN, Loops));
BasicBlock::iterator AfterPHIIt = Header->begin();
for (; PHINode *PN = dyn_cast<PHINode>(AfterPHIIt); ++AfterPHIIt)
IndVars.push_back(InductionVariable(PN, Loops));
- // AfterPHIIt now points to first nonphi instruction...
+ // AfterPHIIt now points to first non-phi instruction...
// If there are no phi nodes in this basic block, there can't be indvars...
if (IndVars.empty()) return Changed;
// If there are no phi nodes in this basic block, there can't be indvars...
if (IndVars.empty()) return Changed;
/// HoistRegion - Walk the specified region of the CFG (defined by all
/// blocks dominated by the specified block, and that are in the current
/// loop) in depth first order w.r.t the DominatorTree. This allows us to
/// HoistRegion - Walk the specified region of the CFG (defined by all
/// blocks dominated by the specified block, and that are in the current
/// loop) in depth first order w.r.t the DominatorTree. This allows us to
- /// visit defintions before uses, allowing us to hoist a loop body in one
+ /// visit definitions before uses, allowing us to hoist a loop body in one
/// pass without iteration.
///
void HoistRegion(DominatorTree::Node *N);
/// pass without iteration.
///
void HoistRegion(DominatorTree::Node *N);
/// HoistRegion - Walk the specified region of the CFG (defined by all blocks
/// dominated by the specified block, and that are in the current loop) in depth
/// HoistRegion - Walk the specified region of the CFG (defined by all blocks
/// dominated by the specified block, and that are in the current loop) in depth
-/// first order w.r.t the DominatorTree. This allows us to visit defintions
+/// first order w.r.t the DominatorTree. This allows us to visit definitions
/// before uses, allowing us to hoist a loop body in one pass without iteration.
///
void LICM::HoistRegion(DominatorTree::Node *N) {
/// before uses, allowing us to hoist a loop body in one pass without iteration.
///
void LICM::HoistRegion(DominatorTree::Node *N) {
//===- PiNodeInsertion.cpp - Insert Pi nodes into a program ---------------===//
//
// PiNodeInsertion - This pass inserts single entry Phi nodes into basic blocks
//===- PiNodeInsertion.cpp - Insert Pi nodes into a program ---------------===//
//
// PiNodeInsertion - This pass inserts single entry Phi nodes into basic blocks
-// that are preceeded by a conditional branch, where the branch gives
+// that are preceded by a conditional branch, where the branch gives
// information about the operands of the condition. For example, this C code:
// if (x == 0) { ... = x + 4;
// becomes:
// information about the operands of the condition. For example, this C code:
// if (x == 0) { ... = x + 4;
// becomes:
// saying that X has a value of 0 in this scope. The power of this analysis
// information is that "in the scope" translates to "for all uses of x2".
//
// saying that X has a value of 0 in this scope. The power of this analysis
// information is that "in the scope" translates to "for all uses of x2".
//
-// This special form of Phi node is refered to as a Pi node, following the
+// This special form of Phi node is referred to as a Pi node, following the
// terminology defined in the "Array Bounds Checks on Demand" paper.
//
// As a really trivial example of what the Pi nodes are good for, this pass
// terminology defined in the "Array Bounds Checks on Demand" paper.
//
// As a really trivial example of what the Pi nodes are good for, this pass
// this is the case, the PHI remains undefined.
//
if (OperandVal)
// this is the case, the PHI remains undefined.
//
if (OperandVal)
- markConstant(PNIV, &PN, OperandVal); // Aquire operand value
+ markConstant(PNIV, &PN, OperandVal); // Acquire operand value
}
void SCCP::visitTerminatorInst(TerminatorInst &TI) {
}
void SCCP::visitTerminatorInst(TerminatorInst &TI) {
Indices.push_back(ConstantSInt::get(Type::LongTy, Offset/ChildSize));
ThisOffset = (Offset/ChildSize)*ChildSize;
} else {
Indices.push_back(ConstantSInt::get(Type::LongTy, Offset/ChildSize));
ThisOffset = (Offset/ChildSize)*ChildSize;
} else {
- Offset = 0; // Return the offset that we were able to acheive
+ Offset = 0; // Return the offset that we were able to achieve
return Ty; // Return the leaf type
}
return Ty; // Return the leaf type
}
// degree of the current basic block, the actual terminator instruction itself
// may have to be changed. In the case where the last successor of the block is
// deleted, a return instruction is inserted in its place which can cause a
// degree of the current basic block, the actual terminator instruction itself
// may have to be changed. In the case where the last successor of the block is
// deleted, a return instruction is inserted in its place which can cause a
-// suprising change in program behavior if it is not expected.
+// surprising change in program behavior if it is not expected.
//
void RemoveSuccessor(TerminatorInst *TI, unsigned SuccNum) {
assert(SuccNum < TI->getNumSuccessors() &&
//
void RemoveSuccessor(TerminatorInst *TI, unsigned SuccNum) {
assert(SuccNum < TI->getNumSuccessors() &&
DS->addBasicBlock(NewBB, DomSet);
}
DS->addBasicBlock(NewBB, DomSet);
}
- // Should we update ImmdediateDominator information?
+ // Should we update ImmediateDominator information?
if (ImmediateDominators *ID = P->getAnalysisToUpdate<ImmediateDominators>()) {
// TIBB is the new immediate dominator for NewBB. NewBB doesn't dominate
// anything.
if (ImmediateDominators *ID = P->getAnalysisToUpdate<ImmediateDominators>()) {
// TIBB is the new immediate dominator for NewBB. NewBB doesn't dominate
// anything.
/// CloneModule - Return an exact copy of the specified module. This is not as
/// easy as it might seem because we have to worry about making copies of global
/// CloneModule - Return an exact copy of the specified module. This is not as
/// easy as it might seem because we have to worry about making copies of global
-/// variables and functions, and making their (intializers and references,
+/// variables and functions, and making their (initializers and references,
/// respectively) refer to the right globals.
///
Module *CloneModule(const Module *M) {
/// respectively) refer to the right globals.
///
Module *CloneModule(const Module *M) {
SymbolTable::const_iterator PI = SrcST->find(Type::TypeTy);
if (PI == SrcST->end()) return false; // No named types, do nothing.
SymbolTable::const_iterator PI = SrcST->find(Type::TypeTy);
if (PI == SrcST->end()) return false; // No named types, do nothing.
- // Some types cannot be resolved immediately becuse they depend on other types
- // being resolved to each other first. This contains a list of types we are
- // waiting to recheck.
+ // Some types cannot be resolved immediately because they depend on other
+ // types being resolved to each other first. This contains a list of types we
+ // are waiting to recheck.
std::vector<std::string> DelayedTypesToResolve;
const SymbolTable::VarMap &VM = PI->second;
std::vector<std::string> DelayedTypesToResolve;
const SymbolTable::VarMap &VM = PI->second;
// as store-sinking that are built into LICM.
//
// Note that the simplifycfg pass will clean up blocks which are split out but
// as store-sinking that are built into LICM.
//
// Note that the simplifycfg pass will clean up blocks which are split out but
-// end up being unnecessary, so usage of this pass does not neccesarily
+// end up being unnecessary, so usage of this pass does not necessarily
// pessimize generated code.
//
//===----------------------------------------------------------------------===//
// pessimize generated code.
//
//===----------------------------------------------------------------------===//
SplitBlockPredecessors(Header, ".preheader", OutsideBlocks);
//===--------------------------------------------------------------------===//
SplitBlockPredecessors(Header, ".preheader", OutsideBlocks);
//===--------------------------------------------------------------------===//
- // Update analysis results now that we have preformed the transformation
+ // Update analysis results now that we have performed the transformation
//
// We know that we have loop information to update... update it now.
//
// We know that we have loop information to update... update it now.
// have extra slots added to them to hold the merge edges from BB's
// predecessors, and BB itself might have had PHI nodes in it. This function
// returns true (failure) if the Succ BB already has a predecessor that is a
// have extra slots added to them to hold the merge edges from BB's
// predecessors, and BB itself might have had PHI nodes in it. This function
// returns true (failure) if the Succ BB already has a predecessor that is a
-// predecessor of BB and incoming PHI arguments would not be discernable.
+// predecessor of BB and incoming PHI arguments would not be discernible.
//
// Assumption: Succ is the single successor for BB.
//
//
// Assumption: Succ is the single successor for BB.
//
// Delete the unconditional branch from the predecessor...
OnlyPred->getInstList().pop_back();
// Delete the unconditional branch from the predecessor...
OnlyPred->getInstList().pop_back();
- // Move all definitions in the succecessor to the predecessor...
+ // Move all definitions in the successor to the predecessor...
OnlyPred->getInstList().splice(OnlyPred->end(), BB->getInstList());
OnlyPred->getInstList().splice(OnlyPred->end(), BB->getInstList());
- // Make all PHI nodes that refered to BB now refer to Pred as their
+ // Make all PHI nodes that referred to BB now refer to Pred as their
// source...
BB->replaceAllUsesWith(OnlyPred);
// source...
BB->replaceAllUsesWith(OnlyPred);
SymbolTable::const_iterator PI = SrcST->find(Type::TypeTy);
if (PI == SrcST->end()) return false; // No named types, do nothing.
SymbolTable::const_iterator PI = SrcST->find(Type::TypeTy);
if (PI == SrcST->end()) return false; // No named types, do nothing.
- // Some types cannot be resolved immediately becuse they depend on other types
- // being resolved to each other first. This contains a list of types we are
- // waiting to recheck.
+ // Some types cannot be resolved immediately because they depend on other
+ // types being resolved to each other first. This contains a list of types we
+ // are waiting to recheck.
std::vector<std::string> DelayedTypesToResolve;
const SymbolTable::VarMap &VM = PI->second;
std::vector<std::string> DelayedTypesToResolve;
const SymbolTable::VarMap &VM = PI->second;
//
llvm_cxx_exception *E =
(llvm_cxx_exception *)malloc(NumBytes+sizeof(llvm_cxx_exception));
//
llvm_cxx_exception *E =
(llvm_cxx_exception *)malloc(NumBytes+sizeof(llvm_cxx_exception));
- E->BaseException.ExceptionType = 0; // intialize to invalid
+ E->BaseException.ExceptionType = 0; // initialize to invalid
return E+1; // return the pointer after the header
}
return E+1; // return the pointer after the header
}
};
bool ReduceCrashingFunctions::TestFuncs(std::vector<Function*> &Funcs) {
};
bool ReduceCrashingFunctions::TestFuncs(std::vector<Function*> &Funcs) {
- // Clone the program to try hacking it appart...
+ // Clone the program to try hacking it apart...
Module *M = CloneModule(BD.Program);
// Convert list to set for fast lookup...
Module *M = CloneModule(BD.Program);
// Convert list to set for fast lookup...
};
bool ReduceCrashingBlocks::TestBlocks(std::vector<BasicBlock*> &BBs) {
};
bool ReduceCrashingBlocks::TestBlocks(std::vector<BasicBlock*> &BBs) {
- // Clone the program to try hacking it appart...
+ // Clone the program to try hacking it apart...
Module *M = CloneModule(BD.Program);
// Convert list to set for fast lookup...
Module *M = CloneModule(BD.Program);
// Convert list to set for fast lookup...
//===- OptimizerDriver.cpp - Allow BugPoint to run passes safely ----------===//
//
// This file defines an interface that allows bugpoint to run various passes
//===- OptimizerDriver.cpp - Allow BugPoint to run passes safely ----------===//
//
// This file defines an interface that allows bugpoint to run various passes
-// without the threat of a buggy pass corrupting bugpoint (of course bugpoint
-// may have it's own bugs, but that's another story...). It acheives this by
+// without the threat of a buggy pass corrupting bugpoint (of course, bugpoint
+// may have its own bugs, but that's another story...). It achieves this by
// forking a copy of itself and having the child process do the optimizations.
// If this client dies, we can always fork a new one. :)
//
// forking a copy of itself and having the child process do the optimizations.
// If this client dies, we can always fork a new one. :)
//
}
/// runPasses - Run the specified passes on Program, outputting a bytecode file
}
/// runPasses - Run the specified passes on Program, outputting a bytecode file
-/// and writting the filename into OutputFile if successful. If the
+/// and writing the filename into OutputFile if successful. If the
/// optimizations fail for some reason (optimizer crashes), return true,
/// otherwise return false. If DeleteOutput is set to true, the bytecode is
/// deleted on success, and the filename string is undefined. This prints to
/// optimizations fail for some reason (optimizer crashes), return true,
/// otherwise return false. If DeleteOutput is set to true, the bytecode is
/// deleted on success, and the filename string is undefined. This prints to
// We always look first in the current directory when searching for libraries.
LibPaths.insert(LibPaths.begin(), ".");
// We always look first in the current directory when searching for libraries.
LibPaths.insert(LibPaths.begin(), ".");
- // If the user specied an extra search path in their environment, respect it.
+ // If the user specified an extra search path in their environment, respect
+ // it.
if (char *SearchPath = getenv("LLVM_LIB_SEARCH_PATH"))
LibPaths.push_back(SearchPath);
if (char *SearchPath = getenv("LLVM_LIB_SEARCH_PATH"))
LibPaths.push_back(SearchPath);
// 1) Generate the header for the symbol table. This is a normal
// archive member header, but it has a zero length name.
// 2) For each archive member file, stat the file and parse the bytecode
// 1) Generate the header for the symbol table. This is a normal
// archive member header, but it has a zero length name.
// 2) For each archive member file, stat the file and parse the bytecode
-// Store cummulative offset (file size + header size).
+// Store cumulative offset (file size + header size).
// 3) Loop over all the symbols for the current member file,
// add offset entry to offset vector, and add symbol name to its vector.
// Note: The symbol name vector is a vector of chars to speed up calculating
// 3) Loop over all the symbols for the current member file,
// add offset entry to offset vector, and add symbol name to its vector.
// Note: The symbol name vector is a vector of chars to speed up calculating
//Adjustment to offset to start files on even byte boundaries
unsigned adjust = 0;
//Adjustment to offset to start files on even byte boundaries
unsigned adjust = 0;
- //Update offsets write symbol tabel to archive.
+ //Update offsets write symbol table to archive.
for(unsigned i=0; i<offsets.size(); ++i) {
char output[4];
offsets[i] = offsets[i] + symbolTableSize + SARMAG;
for(unsigned i=0; i<offsets.size(); ++i) {
char output[4];
offsets[i] = offsets[i] + symbolTableSize + SARMAG;