From 82e2eea16861455b8a1f98756248b0f0baa0121b Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Wed, 11 Oct 2006 18:00:22 +0000 Subject: Clean-up of formatting and spelling. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30885 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/ProgrammersManual.html | 74 ++++++++++++++++++++++----------------------- 1 file changed, 36 insertions(+), 38 deletions(-) (limited to 'docs/ProgrammersManual.html') diff --git a/docs/ProgrammersManual.html b/docs/ProgrammersManual.html index b4159bf39e..bd79747626 100644 --- a/docs/ProgrammersManual.html +++ b/docs/ProgrammersManual.html @@ -303,7 +303,7 @@ static bool isLoopInvariant(const Value *V, const Loop *L) if (isa<Constant>(V) || isa<Argument>(V) || isa<GlobalValue>(V)) return true; - // Otherwise, it must be an instruction... + // Otherwise, it must be an instruction... return !L->contains(cast<Instruction>(V)->getParent()); } @@ -329,7 +329,7 @@ static bool isLoopInvariant(const Value *V, const Loop *L)
 if (AllocationInst *AI = dyn_cast<AllocationInst>(Val)) {
-  // ...
+  // ...
 }
 
@@ -404,7 +404,7 @@ DEBUG(std::cerr << "I am here!\n");
 $ opt < a.bc > /dev/null -mypass
-<no output>
+<no output>
 $ opt < a.bc > /dev/null -mypass -debug
 I am here!
 
@@ -458,7 +458,7 @@ DEBUG(std::cerr << "No debug type (2)\n");
 $ opt < a.bc > /dev/null -mypass
-<no output>
+<no output>
 $ opt < a.bc > /dev/null -mypass -debug
 No debug type
 'foo' debug type
@@ -525,7 +525,7 @@ static Statistic<> NumXForms("mypassname", "The # of times I did stuff");
 
 
-++NumXForms;   // I did stuff!
+++NumXForms;   // I did stuff!
 
@@ -538,7 +538,7 @@ static Statistic<> NumXForms("mypassname", "The # of times I did stuff");
 $ opt -stats -mypassname < program.bc > /dev/null
-... statistic output ...
+... statistics output ...
 
@@ -691,13 +691,12 @@ an example that prints the name of a BasicBlock and the number of
-// func is a pointer to a Function instance
-for (Function::iterator i = func->begin(), e = func->end(); i != e; ++i) {
-  // print out the name of the basic block if it has one, and then the
-  // number of instructions that it contains
+// func is a pointer to a Function instance
+for (Function::iterator i = func->begin(), e = func->end(); i != e; ++i)
+  // Print out the name of the basic block if it has one, and then the
+  // number of instructions that it contains
   std::cerr << "Basic block (name=" << i->getName() << ") has "
             << i->size() << " instructions.\n";
-}
 
@@ -725,10 +724,10 @@ a BasicBlock:

-// blk is a pointer to a BasicBlock instance
+// blk is a pointer to a BasicBlock instance
 for (BasicBlock::iterator i = blk->begin(), e = blk->end(); i != e; ++i)
-   // the next statement works since operator<<(ostream&,...)
-   // is overloaded for Instruction&
+   // The next statement works since operator<<(ostream&,...)
+   // is overloaded for Instruction&
    std::cerr << *i << "\n";
 
@@ -760,7 +759,7 @@ small example that shows how to dump all instructions in a function to the stand
 #include "llvm/Support/InstIterator.h"
 
-// Suppose F is a ptr to a function
+// F is a ptr to a Function instance
 for (inst_iterator i = inst_begin(F), e = inst_end(F); i != e; ++i)
   std::cerr << *i << "\n";
 
@@ -799,8 +798,8 @@ is a BasicBlock::const_iterator:

-Instruction& inst = *i;   // grab reference to instruction reference
-Instruction* pinst = &*i; // grab pointer to instruction reference
+Instruction& inst = *i;   // Grab reference to instruction reference
+Instruction* pinst = &*i; // Grab pointer to instruction reference
 const Instruction& inst = *j;
 
@@ -837,7 +836,7 @@ without actually obtaining it via iteration over some structure:

 void printNextInstruction(Instruction* inst) {
   BasicBlock::iterator it(inst);
-  ++it; // after this line, it refers to the instruction after *inst.
+  ++it; // After this line, it refers to the instruction after *inst
   if (it != inst->getParent()->end()) std::cerr << *it << "\n";
 }
 
@@ -889,16 +888,16 @@ class OurFunctionPass : public FunctionPass { for (BasicBlock::iterator i = b->begin(); ie = b->end(); i != ie; ++i) { if (CallInst* callInst = dyn_cast<CallInst>(&*i)) { - // we know we've encountered a call instruction, so we - // need to determine if it's a call to the - // function pointed to by m_func or not. + // We know we've encountered a call instruction, so we + // need to determine if it's a call to the + // function pointed to by m_func or not if (callInst->getCalledFunction() == targetFunc) ++callCounter; } } } - + } private: unsigned callCounter; @@ -955,12 +954,11 @@ of F:

 Function* F = ...;
 
-for (Value::use_iterator i = F->use_begin(), e = F->use_end(); i != e; ++i) {
+for (Value::use_iterator i = F->use_begin(), e = F->use_end(); i != e; ++i)
   if (Instruction *Inst = dyn_cast<Instruction>(*i)) {
     std::cerr << "F is used in instruction:\n";
     std::cerr << *Inst << "\n";
   }
-}
 
@@ -978,7 +976,7 @@ Instruction* pi = ...; for (User::op_iterator i = pi->op_begin(), e = pi->op_end(); i != e; ++i) { Value* v = *i; - ... + // ... }
@@ -1075,7 +1073,7 @@ BasicBlock *pb = ...; Instruction *pi = ...; Instruction *newInst = new Instruction(...); -pb->getInstList().insert(pi, newInst); // inserts newInst before pi in pb +pb->getInstList().insert(pi, newInst); // Inserts newInst before pi in pb @@ -1090,7 +1088,7 @@ pb->getInstList().insert(pi, newInst); // inserts newInst before pi in pb BasicBlock *pb = ...; Instruction *newInst = new Instruction(...); -pb->getInstList().push_back(newInst); // appends newInst to pb +pb->getInstList().push_back(newInst); // Appends newInst to pb @@ -1310,22 +1308,22 @@ To build this, use the following LLVM APIs:
-// Create the initial outer struct.
+// Create the initial outer struct
 PATypeHolder StructTy = OpaqueType::get();
 std::vector<const Type*> Elts;
 Elts.push_back(PointerType::get(StructTy));
 Elts.push_back(Type::IntTy);
 StructType *NewSTy = StructType::get(Elts);
 
-// At this point, NewSTy = "{ opaque*, int }". Tell VMCore that
-// the struct and the opaque type are actually the same.
+// At this point, NewSTy = "{ opaque*, int }". Tell VMCore that
+// the struct and the opaque type are actually the same.
 cast<OpaqueType>(StructTy.get())->refineAbstractTypeTo(NewSTy);
 
 // NewSTy is potentially invalidated, but StructTy (a PATypeHolder) is
-// kept up-to-date.
+// kept up-to-date
 NewSTy = cast<StructType>(StructTy.get());
 
-// Add a name for the type to the module symbol table (optional).
+// Add a name for the type to the module symbol table (optional)
 MyModule->addTypeName("mylist", NewSTy);
 
@@ -1545,8 +1543,8 @@ three idioms worth pointing out:


 for (SymbolTable::plane_const_iterator PI = ST.plane_begin(),
      PE = ST.plane_end(); PI != PE; ++PI ) {
-  PI->first // This is the Type* of the plane
-  PI->second // This is the SymbolTable::ValueMap of name/Value pairs
+  PI->first  // This is the Type* of the plane
+  PI->second // This is the SymbolTable::ValueMap of name/Value pairs
 }
     
@@ -1555,8 +1553,8 @@ for (SymbolTable::plane_const_iterator PI = ST.plane_begin(),

 for (SymbolTable::type_const_iterator TI = ST.type_begin(),
      TE = ST.type_end(); TI != TE; ++TI ) {
-  TI->first  // This is the name of the type
-  TI->second // This is the Type* value associated with the name
+  TI->first  // This is the name of the type
+  TI->second // This is the Type* value associated with the name
 }
     
@@ -1565,8 +1563,8 @@ for (SymbolTable::type_const_iterator TI = ST.type_begin(),

 for (SymbolTable::value_const_iterator VI = ST.value_begin(SomeType),
      VE = ST.value_end(SomeType); VI != VE; ++VI ) {
-  VI->first  // This is the name of the Value
-  VI->second // This is the Value* value associated with the name
+  VI->first  // This is the name of the Value
+  VI->second // This is the Value* value associated with the name
 }
     
-- cgit v1.2.3