diff options
| author | Gabor Greif <ggreif@gmail.com> | 2008-04-19 22:25:09 +0000 |
|---|---|---|
| committer | Gabor Greif <ggreif@gmail.com> | 2008-04-19 22:25:09 +0000 |
| commit | df7d2b4ce89599ca75d4dc4fd581ce4507f73f2d (patch) | |
| tree | fd73c200d859c64a6f81a6cc38ca5988602ad112 /docs/Stacker.html | |
| parent | d881ad2c570dcb5965eb00b66462e1075ec82440 (diff) | |
merge of 49966 from branches/ggreif/use-diet to trunk. these are already active API changes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49968 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/Stacker.html')
| -rw-r--r-- | docs/Stacker.html | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/docs/Stacker.html b/docs/Stacker.html index c969671229..81b623efa9 100644 --- a/docs/Stacker.html +++ b/docs/Stacker.html @@ -219,8 +219,8 @@ should be constructed. In general, here's what I learned: </ol> <p>The foregoing is such an important principal, its worth making an idiom:</p> <pre> -BasicBlock* bb = new BasicBlock(); -bb->getInstList().push_back( new Branch( ... ) ); +BasicBlock* bb = BasicBlock::Create(); +bb->getInstList().push_back( BranchInst::Create( ... ) ); new Instruction(..., bb->getTerminator() ); </pre> <p>To make this clear, consider the typical if-then-else statement @@ -232,16 +232,16 @@ BasicBlock* MyCompiler::handle_if( BasicBlock* bb, ICmpInst* condition ) { // Create the blocks to contain code in the structure of if/then/else - BasicBlock* then_bb = new BasicBlock(); - BasicBlock* else_bb = new BasicBlock(); - BasicBlock* exit_bb = new BasicBlock(); + BasicBlock* then_bb = BasicBlock::Create(); + BasicBlock* else_bb = BasicBlock::Create(); + BasicBlock* exit_bb = BasicBlock::Create(); // Insert the branch instruction for the "if" - bb->getInstList().push_back( new BranchInst( then_bb, else_bb, condition ) ); + bb->getInstList().push_back( BranchInst::Create( then_bb, else_bb, condition ) ); // Set up the terminating instructions - then->getInstList().push_back( new BranchInst( exit_bb ) ); - else->getInstList().push_back( new BranchInst( exit_bb ) ); + then->getInstList().push_back( BranchInst::Create( exit_bb ) ); + else->getInstList().push_back( BranchInst::Create( exit_bb ) ); // Fill in the then part .. details excised for brevity this->fill_in( then_bb ); @@ -310,7 +310,7 @@ things, this leads to the idiom: std::vector<Value*> index_vector; index_vector.push_back( ConstantInt::get( Type::LongTy, 0 ); // ... push other indices ... -GetElementPtrInst* gep = new GetElementPtrInst( ptr, index_vector ); +GetElementPtrInst* gep = GetElementPtrInst::Create( ptr, index_vector ); </pre> <p>For example, suppose we have a global variable whose type is [24 x int]. The variable itself represents a <em>pointer</em> to that array. To subscript the |
