mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-26 12:20:42 +00:00
Merge LLVMBuilder and FoldingBuilder, calling
the result IRBuilder. Patch by Dominic Hamon. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49604 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -422,14 +422,14 @@ function:</p>
|
||||
/// the function. This is used for mutable variables etc.
|
||||
static AllocaInst *CreateEntryBlockAlloca(Function *TheFunction,
|
||||
const std::string &VarName) {
|
||||
LLVMBuilder TmpB(&TheFunction->getEntryBlock(),
|
||||
TheFunction->getEntryBlock().begin());
|
||||
IRBuilder TmpB(&TheFunction->getEntryBlock(),
|
||||
TheFunction->getEntryBlock().begin());
|
||||
return TmpB.CreateAlloca(Type::DoubleTy, 0, VarName.c_str());
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>This funny looking code creates an LLVMBuilder object that is pointing at
|
||||
<p>This funny looking code creates an IRBuilder object that is pointing at
|
||||
the first instruction (.begin()) of the entry block. It then creates an alloca
|
||||
with the expected name and returns it. Because all values in Kaleidoscope are
|
||||
doubles, there is no need to pass in a type to use.</p>
|
||||
@@ -1009,7 +1009,7 @@ variables and var/in support. To build this example, use:
|
||||
#include "llvm/Analysis/Verifier.h"
|
||||
#include "llvm/Target/TargetData.h"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/Support/LLVMBuilder.h"
|
||||
#include "llvm/Support/IRBuilder.h"
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
#include <map>
|
||||
@@ -1605,7 +1605,7 @@ static PrototypeAST *ParseExtern() {
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
static Module *TheModule;
|
||||
static LLVMFoldingBuilder Builder;
|
||||
static IRBuilder Builder;
|
||||
static std::map<std::string, AllocaInst*> NamedValues;
|
||||
static FunctionPassManager *TheFPM;
|
||||
|
||||
@@ -1615,8 +1615,8 @@ 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) {
|
||||
LLVMBuilder TmpB(&TheFunction->getEntryBlock(),
|
||||
TheFunction->getEntryBlock().begin());
|
||||
IRBuilder TmpB(&TheFunction->getEntryBlock(),
|
||||
TheFunction->getEntryBlock().begin());
|
||||
return TmpB.CreateAlloca(Type::DoubleTy, 0, VarName.c_str());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user