mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-25 12:50:00 +00:00
Fix exaples using IRBuilder. Thanks, Quadrescence and Glip7 from IRC!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66687 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ad9d21a952
commit
d6c1ed08f6
@ -153,7 +153,7 @@ function will interoperate properly with C code, which is a good thing.</p>
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
BasicBlock* block = BasicBlock::Create("entry", mul_add);
|
||||
IRBuilder builder(block);
|
||||
IRBuilder<> builder(block);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
@ -111,7 +111,7 @@ Module* makeLLVMModule() {
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
IRBuilder builder(entry);
|
||||
IRBuilder<> builder(entry);
|
||||
Value* xEqualsY = builder.CreateICmpEQ(x, y, "tmp");
|
||||
builder.CreateCondBr(xEqualsY, ret, cond_false);
|
||||
</pre>
|
||||
|
@ -115,7 +115,7 @@ undeclared parameter):</p>
|
||||
Value *ErrorV(const char *Str) { Error(Str); return 0; }
|
||||
|
||||
static Module *TheModule;
|
||||
static IRBuilder Builder;
|
||||
static IRBuilder<> Builder;
|
||||
static std::map<std::string, Value*> NamedValues;
|
||||
</pre>
|
||||
</div>
|
||||
@ -128,8 +128,8 @@ uses to contain code.</p>
|
||||
<p>The <tt>Builder</tt> object is a helper object that makes it easy to generate
|
||||
LLVM instructions. Instances of the <a
|
||||
href="http://llvm.org/doxygen/IRBuilder_8h-source.html"><tt>IRBuilder</tt></a>
|
||||
class keep track of the current place to insert instructions and has methods to
|
||||
create new instructions.</p>
|
||||
class template keep track of the current place to insert instructions and has
|
||||
methods to create new instructions.</p>
|
||||
|
||||
<p>The <tt>NamedValues</tt> map keeps track of which values are defined in the
|
||||
current scope and what their LLVM representation is. (In other words, it is a
|
||||
@ -1027,7 +1027,7 @@ static PrototypeAST *ParseExtern() {
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
static Module *TheModule;
|
||||
static IRBuilder Builder;
|
||||
static IRBuilder<> Builder;
|
||||
static std::map<std::string, Value*> NamedValues;
|
||||
|
||||
Value *ErrorV(const char *Str) { Error(Str); return 0; }
|
||||
|
@ -861,7 +861,7 @@ static PrototypeAST *ParseExtern() {
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
static Module *TheModule;
|
||||
static IRBuilder Builder;
|
||||
static IRBuilder<> Builder;
|
||||
static std::map<std::string, Value*> NamedValues;
|
||||
static FunctionPassManager *TheFPM;
|
||||
|
||||
|
@ -1352,7 +1352,7 @@ static PrototypeAST *ParseExtern() {
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
static Module *TheModule;
|
||||
static IRBuilder Builder;
|
||||
static IRBuilder<> Builder;
|
||||
static std::map<std::string, Value*> NamedValues;
|
||||
static FunctionPassManager *TheFPM;
|
||||
|
||||
|
@ -1357,7 +1357,7 @@ static PrototypeAST *ParseExtern() {
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
static Module *TheModule;
|
||||
static IRBuilder Builder;
|
||||
static IRBuilder<> Builder;
|
||||
static std::map<std::string, Value*> NamedValues;
|
||||
static FunctionPassManager *TheFPM;
|
||||
|
||||
|
@ -422,7 +422,7 @@ function:</p>
|
||||
/// the function. This is used for mutable variables etc.
|
||||
static AllocaInst *CreateEntryBlockAlloca(Function *TheFunction,
|
||||
const std::string &VarName) {
|
||||
IRBuilder TmpB(&TheFunction->getEntryBlock(),
|
||||
IRBuilder<> TmpB(&TheFunction->getEntryBlock(),
|
||||
TheFunction->getEntryBlock().begin());
|
||||
return TmpB.CreateAlloca(Type::DoubleTy, 0, VarName.c_str());
|
||||
}
|
||||
@ -1605,7 +1605,7 @@ static PrototypeAST *ParseExtern() {
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
static Module *TheModule;
|
||||
static IRBuilder Builder;
|
||||
static IRBuilder<> Builder;
|
||||
static std::map<std::string, AllocaInst*> NamedValues;
|
||||
static FunctionPassManager *TheFPM;
|
||||
|
||||
@ -1615,7 +1615,7 @@ Value *ErrorV(const char *Str) { Error(Str); return 0; }
|
||||
/// the function. This is used for mutable variables etc.
|
||||
static AllocaInst *CreateEntryBlockAlloca(Function *TheFunction,
|
||||
const std::string &VarName) {
|
||||
IRBuilder TmpB(&TheFunction->getEntryBlock(),
|
||||
IRBuilder<> TmpB(&TheFunction->getEntryBlock(),
|
||||
TheFunction->getEntryBlock().begin());
|
||||
return TmpB.CreateAlloca(Type::DoubleTy, 0, VarName.c_str());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user