mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-24 20:29:53 +00:00
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
This commit is contained in:
parent
d881ad2c57
commit
df7d2b4ce8
@ -219,8 +219,8 @@ should be constructed. In general, here's what I learned:
|
|||||||
</ol>
|
</ol>
|
||||||
<p>The foregoing is such an important principal, its worth making an idiom:</p>
|
<p>The foregoing is such an important principal, its worth making an idiom:</p>
|
||||||
<pre>
|
<pre>
|
||||||
BasicBlock* bb = new BasicBlock();
|
BasicBlock* bb = BasicBlock::Create();
|
||||||
bb->getInstList().push_back( new Branch( ... ) );
|
bb->getInstList().push_back( BranchInst::Create( ... ) );
|
||||||
new Instruction(..., bb->getTerminator() );
|
new Instruction(..., bb->getTerminator() );
|
||||||
</pre>
|
</pre>
|
||||||
<p>To make this clear, consider the typical if-then-else statement
|
<p>To make this clear, consider the typical if-then-else statement
|
||||||
@ -232,16 +232,16 @@ BasicBlock*
|
|||||||
MyCompiler::handle_if( BasicBlock* bb, ICmpInst* condition )
|
MyCompiler::handle_if( BasicBlock* bb, ICmpInst* condition )
|
||||||
{
|
{
|
||||||
// Create the blocks to contain code in the structure of if/then/else
|
// Create the blocks to contain code in the structure of if/then/else
|
||||||
BasicBlock* then_bb = new BasicBlock();
|
BasicBlock* then_bb = BasicBlock::Create();
|
||||||
BasicBlock* else_bb = new BasicBlock();
|
BasicBlock* else_bb = BasicBlock::Create();
|
||||||
BasicBlock* exit_bb = new BasicBlock();
|
BasicBlock* exit_bb = BasicBlock::Create();
|
||||||
|
|
||||||
// Insert the branch instruction for the "if"
|
// 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
|
// Set up the terminating instructions
|
||||||
then->getInstList().push_back( new BranchInst( exit_bb ) );
|
then->getInstList().push_back( BranchInst::Create( exit_bb ) );
|
||||||
else->getInstList().push_back( new BranchInst( exit_bb ) );
|
else->getInstList().push_back( BranchInst::Create( exit_bb ) );
|
||||||
|
|
||||||
// Fill in the then part .. details excised for brevity
|
// Fill in the then part .. details excised for brevity
|
||||||
this->fill_in( then_bb );
|
this->fill_in( then_bb );
|
||||||
@ -310,7 +310,7 @@ things, this leads to the idiom:
|
|||||||
std::vector<Value*> index_vector;
|
std::vector<Value*> index_vector;
|
||||||
index_vector.push_back( ConstantInt::get( Type::LongTy, 0 );
|
index_vector.push_back( ConstantInt::get( Type::LongTy, 0 );
|
||||||
// ... push other indices ...
|
// ... push other indices ...
|
||||||
GetElementPtrInst* gep = new GetElementPtrInst( ptr, index_vector );
|
GetElementPtrInst* gep = GetElementPtrInst::Create( ptr, index_vector );
|
||||||
</pre>
|
</pre>
|
||||||
<p>For example, suppose we have a global variable whose type is [24 x int]. The
|
<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
|
variable itself represents a <em>pointer</em> to that array. To subscript the
|
||||||
|
@ -142,7 +142,7 @@ Module* makeLLVMModule() {
|
|||||||
|
|
||||||
<div class="doc_code">
|
<div class="doc_code">
|
||||||
<pre>
|
<pre>
|
||||||
BasicBlock* block = new BasicBlock("entry", mul_add);
|
BasicBlock* block = BasicBlock::Create("entry", mul_add);
|
||||||
IRBuilder builder(block);
|
IRBuilder builder(block);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
@ -98,11 +98,11 @@ Module* makeLLVMModule() {
|
|||||||
|
|
||||||
<div class="doc_code">
|
<div class="doc_code">
|
||||||
<pre>
|
<pre>
|
||||||
BasicBlock* entry = new BasicBlock("entry", gcd);
|
BasicBlock* entry = BasicBlock::Create("entry", gcd);
|
||||||
BasicBlock* ret = new BasicBlock("return", gcd);
|
BasicBlock* ret = BasicBlock::Create("return", gcd);
|
||||||
BasicBlock* cond_false = new BasicBlock("cond_false", gcd);
|
BasicBlock* cond_false = BasicBlock::Create("cond_false", gcd);
|
||||||
BasicBlock* cond_true = new BasicBlock("cond_true", gcd);
|
BasicBlock* cond_true = BasicBlock::Create("cond_true", gcd);
|
||||||
BasicBlock* cond_false_2 = new BasicBlock("cond_false", gcd);
|
BasicBlock* cond_false_2 = BasicBlock::Create("cond_false", gcd);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ Function *PrototypeAST::Codegen() {
|
|||||||
std::vector<const Type*> Doubles(Args.size(), Type::DoubleTy);
|
std::vector<const Type*> Doubles(Args.size(), Type::DoubleTy);
|
||||||
FunctionType *FT = FunctionType::get(Type::DoubleTy, Doubles, false);
|
FunctionType *FT = FunctionType::get(Type::DoubleTy, Doubles, false);
|
||||||
|
|
||||||
Function *F = new Function(FT, Function::ExternalLinkage, Name, TheModule);
|
Function *F = Function::Create(FT, Function::ExternalLinkage, Name, TheModule);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -435,7 +435,7 @@ is an LLVM Function object that is ready to go for us.</p>
|
|||||||
<div class="doc_code">
|
<div class="doc_code">
|
||||||
<pre>
|
<pre>
|
||||||
// Create a new basic block to start insertion into.
|
// Create a new basic block to start insertion into.
|
||||||
BasicBlock *BB = new BasicBlock("entry", TheFunction);
|
BasicBlock *BB = BasicBlock::Create("entry", TheFunction);
|
||||||
Builder.SetInsertPoint(BB);
|
Builder.SetInsertPoint(BB);
|
||||||
|
|
||||||
if (Value *RetVal = Body->Codegen()) {
|
if (Value *RetVal = Body->Codegen()) {
|
||||||
@ -1079,7 +1079,7 @@ Function *PrototypeAST::Codegen() {
|
|||||||
std::vector<const Type*> Doubles(Args.size(), Type::DoubleTy);
|
std::vector<const Type*> Doubles(Args.size(), Type::DoubleTy);
|
||||||
FunctionType *FT = FunctionType::get(Type::DoubleTy, Doubles, false);
|
FunctionType *FT = FunctionType::get(Type::DoubleTy, Doubles, false);
|
||||||
|
|
||||||
Function *F = new Function(FT, Function::ExternalLinkage, Name, TheModule);
|
Function *F = Function::Create(FT, Function::ExternalLinkage, Name, TheModule);
|
||||||
|
|
||||||
// If F conflicted, there was already something named 'Name'. If it has a
|
// If F conflicted, there was already something named 'Name'. If it has a
|
||||||
// body, don't allow redefinition or reextern.
|
// body, don't allow redefinition or reextern.
|
||||||
@ -1122,7 +1122,7 @@ Function *FunctionAST::Codegen() {
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Create a new basic block to start insertion into.
|
// Create a new basic block to start insertion into.
|
||||||
BasicBlock *BB = new BasicBlock("entry", TheFunction);
|
BasicBlock *BB = BasicBlock::Create("entry", TheFunction);
|
||||||
Builder.SetInsertPoint(BB);
|
Builder.SetInsertPoint(BB);
|
||||||
|
|
||||||
if (Value *RetVal = Body->Codegen()) {
|
if (Value *RetVal = Body->Codegen()) {
|
||||||
|
@ -913,7 +913,7 @@ Function *PrototypeAST::Codegen() {
|
|||||||
std::vector<const Type*> Doubles(Args.size(), Type::DoubleTy);
|
std::vector<const Type*> Doubles(Args.size(), Type::DoubleTy);
|
||||||
FunctionType *FT = FunctionType::get(Type::DoubleTy, Doubles, false);
|
FunctionType *FT = FunctionType::get(Type::DoubleTy, Doubles, false);
|
||||||
|
|
||||||
Function *F = new Function(FT, Function::ExternalLinkage, Name, TheModule);
|
Function *F = Function::Create(FT, Function::ExternalLinkage, Name, TheModule);
|
||||||
|
|
||||||
// If F conflicted, there was already something named 'Name'. If it has a
|
// If F conflicted, there was already something named 'Name'. If it has a
|
||||||
// body, don't allow redefinition or reextern.
|
// body, don't allow redefinition or reextern.
|
||||||
@ -956,7 +956,7 @@ Function *FunctionAST::Codegen() {
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Create a new basic block to start insertion into.
|
// Create a new basic block to start insertion into.
|
||||||
BasicBlock *BB = new BasicBlock("entry", TheFunction);
|
BasicBlock *BB = BasicBlock::Create("entry", TheFunction);
|
||||||
Builder.SetInsertPoint(BB);
|
Builder.SetInsertPoint(BB);
|
||||||
|
|
||||||
if (Value *RetVal = Body->Codegen()) {
|
if (Value *RetVal = Body->Codegen()) {
|
||||||
|
@ -379,9 +379,9 @@ value as a 1-bit (bool) value.</p>
|
|||||||
|
|
||||||
// Create blocks for the then and else cases. Insert the 'then' block at the
|
// Create blocks for the then and else cases. Insert the 'then' block at the
|
||||||
// end of the function.
|
// end of the function.
|
||||||
BasicBlock *ThenBB = new BasicBlock("then", TheFunction);
|
BasicBlock *ThenBB = BasicBlock::Create("then", TheFunction);
|
||||||
BasicBlock *ElseBB = new BasicBlock("else");
|
BasicBlock *ElseBB = BasicBlock::Create("else");
|
||||||
BasicBlock *MergeBB = new BasicBlock("ifcont");
|
BasicBlock *MergeBB = BasicBlock::Create("ifcont");
|
||||||
|
|
||||||
Builder.CreateCondBr(CondV, ThenBB, ElseBB);
|
Builder.CreateCondBr(CondV, ThenBB, ElseBB);
|
||||||
</pre>
|
</pre>
|
||||||
@ -727,7 +727,7 @@ block, but remember that the body code itself could consist of multiple blocks
|
|||||||
// block.
|
// block.
|
||||||
Function *TheFunction = Builder.GetInsertBlock()->getParent();
|
Function *TheFunction = Builder.GetInsertBlock()->getParent();
|
||||||
BasicBlock *PreheaderBB = Builder.GetInsertBlock();
|
BasicBlock *PreheaderBB = Builder.GetInsertBlock();
|
||||||
BasicBlock *LoopBB = new BasicBlock("loop", TheFunction);
|
BasicBlock *LoopBB = BasicBlock::Create("loop", TheFunction);
|
||||||
|
|
||||||
// Insert an explicit fall through from the current block to the LoopBB.
|
// Insert an explicit fall through from the current block to the LoopBB.
|
||||||
Builder.CreateBr(LoopBB);
|
Builder.CreateBr(LoopBB);
|
||||||
@ -828,7 +828,7 @@ statement.</p>
|
|||||||
<pre>
|
<pre>
|
||||||
// Create the "after loop" block and insert it.
|
// Create the "after loop" block and insert it.
|
||||||
BasicBlock *LoopEndBB = Builder.GetInsertBlock();
|
BasicBlock *LoopEndBB = Builder.GetInsertBlock();
|
||||||
BasicBlock *AfterBB = new BasicBlock("afterloop", TheFunction);
|
BasicBlock *AfterBB = BasicBlock::Create("afterloop", TheFunction);
|
||||||
|
|
||||||
// Insert the conditional branch into the end of LoopEndBB.
|
// Insert the conditional branch into the end of LoopEndBB.
|
||||||
Builder.CreateCondBr(EndCond, LoopBB, AfterBB);
|
Builder.CreateCondBr(EndCond, LoopBB, AfterBB);
|
||||||
@ -1417,9 +1417,9 @@ Value *IfExprAST::Codegen() {
|
|||||||
|
|
||||||
// Create blocks for the then and else cases. Insert the 'then' block at the
|
// Create blocks for the then and else cases. Insert the 'then' block at the
|
||||||
// end of the function.
|
// end of the function.
|
||||||
BasicBlock *ThenBB = new BasicBlock("then", TheFunction);
|
BasicBlock *ThenBB = BasicBlock::Create("then", TheFunction);
|
||||||
BasicBlock *ElseBB = new BasicBlock("else");
|
BasicBlock *ElseBB = BasicBlock::Create("else");
|
||||||
BasicBlock *MergeBB = new BasicBlock("ifcont");
|
BasicBlock *MergeBB = BasicBlock::Create("ifcont");
|
||||||
|
|
||||||
Builder.CreateCondBr(CondV, ThenBB, ElseBB);
|
Builder.CreateCondBr(CondV, ThenBB, ElseBB);
|
||||||
|
|
||||||
@ -1479,7 +1479,7 @@ Value *ForExprAST::Codegen() {
|
|||||||
// block.
|
// block.
|
||||||
Function *TheFunction = Builder.GetInsertBlock()->getParent();
|
Function *TheFunction = Builder.GetInsertBlock()->getParent();
|
||||||
BasicBlock *PreheaderBB = Builder.GetInsertBlock();
|
BasicBlock *PreheaderBB = Builder.GetInsertBlock();
|
||||||
BasicBlock *LoopBB = new BasicBlock("loop", TheFunction);
|
BasicBlock *LoopBB = BasicBlock::Create("loop", TheFunction);
|
||||||
|
|
||||||
// Insert an explicit fall through from the current block to the LoopBB.
|
// Insert an explicit fall through from the current block to the LoopBB.
|
||||||
Builder.CreateBr(LoopBB);
|
Builder.CreateBr(LoopBB);
|
||||||
@ -1525,7 +1525,7 @@ Value *ForExprAST::Codegen() {
|
|||||||
|
|
||||||
// Create the "after loop" block and insert it.
|
// Create the "after loop" block and insert it.
|
||||||
BasicBlock *LoopEndBB = Builder.GetInsertBlock();
|
BasicBlock *LoopEndBB = Builder.GetInsertBlock();
|
||||||
BasicBlock *AfterBB = new BasicBlock("afterloop", TheFunction);
|
BasicBlock *AfterBB = BasicBlock::Create("afterloop", TheFunction);
|
||||||
|
|
||||||
// Insert the conditional branch into the end of LoopEndBB.
|
// Insert the conditional branch into the end of LoopEndBB.
|
||||||
Builder.CreateCondBr(EndCond, LoopBB, AfterBB);
|
Builder.CreateCondBr(EndCond, LoopBB, AfterBB);
|
||||||
@ -1552,7 +1552,7 @@ Function *PrototypeAST::Codegen() {
|
|||||||
std::vector<const Type*> Doubles(Args.size(), Type::DoubleTy);
|
std::vector<const Type*> Doubles(Args.size(), Type::DoubleTy);
|
||||||
FunctionType *FT = FunctionType::get(Type::DoubleTy, Doubles, false);
|
FunctionType *FT = FunctionType::get(Type::DoubleTy, Doubles, false);
|
||||||
|
|
||||||
Function *F = new Function(FT, Function::ExternalLinkage, Name, TheModule);
|
Function *F = Function::Create(FT, Function::ExternalLinkage, Name, TheModule);
|
||||||
|
|
||||||
// If F conflicted, there was already something named 'Name'. If it has a
|
// If F conflicted, there was already something named 'Name'. If it has a
|
||||||
// body, don't allow redefinition or reextern.
|
// body, don't allow redefinition or reextern.
|
||||||
@ -1595,7 +1595,7 @@ Function *FunctionAST::Codegen() {
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Create a new basic block to start insertion into.
|
// Create a new basic block to start insertion into.
|
||||||
BasicBlock *BB = new BasicBlock("entry", TheFunction);
|
BasicBlock *BB = BasicBlock::Create("entry", TheFunction);
|
||||||
Builder.SetInsertPoint(BB);
|
Builder.SetInsertPoint(BB);
|
||||||
|
|
||||||
if (Value *RetVal = Body->Codegen()) {
|
if (Value *RetVal = Body->Codegen()) {
|
||||||
|
@ -321,7 +321,7 @@ Function *FunctionAST::Codegen() {
|
|||||||
BinopPrecedence[Proto->getOperatorName()] = Proto->getBinaryPrecedence();</b>
|
BinopPrecedence[Proto->getOperatorName()] = Proto->getBinaryPrecedence();</b>
|
||||||
|
|
||||||
// Create a new basic block to start insertion into.
|
// Create a new basic block to start insertion into.
|
||||||
BasicBlock *BB = new BasicBlock("entry", TheFunction);
|
BasicBlock *BB = BasicBlock::Create("entry", TheFunction);
|
||||||
Builder.SetInsertPoint(BB);
|
Builder.SetInsertPoint(BB);
|
||||||
|
|
||||||
if (Value *RetVal = Body->Codegen()) {
|
if (Value *RetVal = Body->Codegen()) {
|
||||||
@ -1442,9 +1442,9 @@ Value *IfExprAST::Codegen() {
|
|||||||
|
|
||||||
// Create blocks for the then and else cases. Insert the 'then' block at the
|
// Create blocks for the then and else cases. Insert the 'then' block at the
|
||||||
// end of the function.
|
// end of the function.
|
||||||
BasicBlock *ThenBB = new BasicBlock("then", TheFunction);
|
BasicBlock *ThenBB = BasicBlock::Create("then", TheFunction);
|
||||||
BasicBlock *ElseBB = new BasicBlock("else");
|
BasicBlock *ElseBB = BasicBlock::Create("else");
|
||||||
BasicBlock *MergeBB = new BasicBlock("ifcont");
|
BasicBlock *MergeBB = BasicBlock::Create("ifcont");
|
||||||
|
|
||||||
Builder.CreateCondBr(CondV, ThenBB, ElseBB);
|
Builder.CreateCondBr(CondV, ThenBB, ElseBB);
|
||||||
|
|
||||||
@ -1504,7 +1504,7 @@ Value *ForExprAST::Codegen() {
|
|||||||
// block.
|
// block.
|
||||||
Function *TheFunction = Builder.GetInsertBlock()->getParent();
|
Function *TheFunction = Builder.GetInsertBlock()->getParent();
|
||||||
BasicBlock *PreheaderBB = Builder.GetInsertBlock();
|
BasicBlock *PreheaderBB = Builder.GetInsertBlock();
|
||||||
BasicBlock *LoopBB = new BasicBlock("loop", TheFunction);
|
BasicBlock *LoopBB = BasicBlock::Create("loop", TheFunction);
|
||||||
|
|
||||||
// Insert an explicit fall through from the current block to the LoopBB.
|
// Insert an explicit fall through from the current block to the LoopBB.
|
||||||
Builder.CreateBr(LoopBB);
|
Builder.CreateBr(LoopBB);
|
||||||
@ -1550,7 +1550,7 @@ Value *ForExprAST::Codegen() {
|
|||||||
|
|
||||||
// Create the "after loop" block and insert it.
|
// Create the "after loop" block and insert it.
|
||||||
BasicBlock *LoopEndBB = Builder.GetInsertBlock();
|
BasicBlock *LoopEndBB = Builder.GetInsertBlock();
|
||||||
BasicBlock *AfterBB = new BasicBlock("afterloop", TheFunction);
|
BasicBlock *AfterBB = BasicBlock::Create("afterloop", TheFunction);
|
||||||
|
|
||||||
// Insert the conditional branch into the end of LoopEndBB.
|
// Insert the conditional branch into the end of LoopEndBB.
|
||||||
Builder.CreateCondBr(EndCond, LoopBB, AfterBB);
|
Builder.CreateCondBr(EndCond, LoopBB, AfterBB);
|
||||||
@ -1577,7 +1577,7 @@ Function *PrototypeAST::Codegen() {
|
|||||||
std::vector<const Type*> Doubles(Args.size(), Type::DoubleTy);
|
std::vector<const Type*> Doubles(Args.size(), Type::DoubleTy);
|
||||||
FunctionType *FT = FunctionType::get(Type::DoubleTy, Doubles, false);
|
FunctionType *FT = FunctionType::get(Type::DoubleTy, Doubles, false);
|
||||||
|
|
||||||
Function *F = new Function(FT, Function::ExternalLinkage, Name, TheModule);
|
Function *F = Function::Create(FT, Function::ExternalLinkage, Name, TheModule);
|
||||||
|
|
||||||
// If F conflicted, there was already something named 'Name'. If it has a
|
// If F conflicted, there was already something named 'Name'. If it has a
|
||||||
// body, don't allow redefinition or reextern.
|
// body, don't allow redefinition or reextern.
|
||||||
@ -1624,7 +1624,7 @@ Function *FunctionAST::Codegen() {
|
|||||||
BinopPrecedence[Proto->getOperatorName()] = Proto->getBinaryPrecedence();
|
BinopPrecedence[Proto->getOperatorName()] = Proto->getBinaryPrecedence();
|
||||||
|
|
||||||
// Create a new basic block to start insertion into.
|
// Create a new basic block to start insertion into.
|
||||||
BasicBlock *BB = new BasicBlock("entry", TheFunction);
|
BasicBlock *BB = BasicBlock::Create("entry", TheFunction);
|
||||||
Builder.SetInsertPoint(BB);
|
Builder.SetInsertPoint(BB);
|
||||||
|
|
||||||
if (Value *RetVal = Body->Codegen()) {
|
if (Value *RetVal = Body->Codegen()) {
|
||||||
|
@ -1722,9 +1722,9 @@ Value *IfExprAST::Codegen() {
|
|||||||
|
|
||||||
// Create blocks for the then and else cases. Insert the 'then' block at the
|
// Create blocks for the then and else cases. Insert the 'then' block at the
|
||||||
// end of the function.
|
// end of the function.
|
||||||
BasicBlock *ThenBB = new BasicBlock("then", TheFunction);
|
BasicBlock *ThenBB = BasicBlock::Create("then", TheFunction);
|
||||||
BasicBlock *ElseBB = new BasicBlock("else");
|
BasicBlock *ElseBB = BasicBlock::Create("else");
|
||||||
BasicBlock *MergeBB = new BasicBlock("ifcont");
|
BasicBlock *MergeBB = BasicBlock::Create("ifcont");
|
||||||
|
|
||||||
Builder.CreateCondBr(CondV, ThenBB, ElseBB);
|
Builder.CreateCondBr(CondV, ThenBB, ElseBB);
|
||||||
|
|
||||||
@ -1795,7 +1795,7 @@ Value *ForExprAST::Codegen() {
|
|||||||
// Make the new basic block for the loop header, inserting after current
|
// Make the new basic block for the loop header, inserting after current
|
||||||
// block.
|
// block.
|
||||||
BasicBlock *PreheaderBB = Builder.GetInsertBlock();
|
BasicBlock *PreheaderBB = Builder.GetInsertBlock();
|
||||||
BasicBlock *LoopBB = new BasicBlock("loop", TheFunction);
|
BasicBlock *LoopBB = BasicBlock::Create("loop", TheFunction);
|
||||||
|
|
||||||
// Insert an explicit fall through from the current block to the LoopBB.
|
// Insert an explicit fall through from the current block to the LoopBB.
|
||||||
Builder.CreateBr(LoopBB);
|
Builder.CreateBr(LoopBB);
|
||||||
@ -1841,7 +1841,7 @@ Value *ForExprAST::Codegen() {
|
|||||||
|
|
||||||
// Create the "after loop" block and insert it.
|
// Create the "after loop" block and insert it.
|
||||||
BasicBlock *LoopEndBB = Builder.GetInsertBlock();
|
BasicBlock *LoopEndBB = Builder.GetInsertBlock();
|
||||||
BasicBlock *AfterBB = new BasicBlock("afterloop", TheFunction);
|
BasicBlock *AfterBB = BasicBlock::Create("afterloop", TheFunction);
|
||||||
|
|
||||||
// Insert the conditional branch into the end of LoopEndBB.
|
// Insert the conditional branch into the end of LoopEndBB.
|
||||||
Builder.CreateCondBr(EndCond, LoopBB, AfterBB);
|
Builder.CreateCondBr(EndCond, LoopBB, AfterBB);
|
||||||
@ -1912,7 +1912,7 @@ Function *PrototypeAST::Codegen() {
|
|||||||
std::vector<const Type*> Doubles(Args.size(), Type::DoubleTy);
|
std::vector<const Type*> Doubles(Args.size(), Type::DoubleTy);
|
||||||
FunctionType *FT = FunctionType::get(Type::DoubleTy, Doubles, false);
|
FunctionType *FT = FunctionType::get(Type::DoubleTy, Doubles, false);
|
||||||
|
|
||||||
Function *F = new Function(FT, Function::ExternalLinkage, Name, TheModule);
|
Function *F = Function::Create(FT, Function::ExternalLinkage, Name, TheModule);
|
||||||
|
|
||||||
// If F conflicted, there was already something named 'Name'. If it has a
|
// If F conflicted, there was already something named 'Name'. If it has a
|
||||||
// body, don't allow redefinition or reextern.
|
// body, don't allow redefinition or reextern.
|
||||||
@ -1972,7 +1972,7 @@ Function *FunctionAST::Codegen() {
|
|||||||
BinopPrecedence[Proto->getOperatorName()] = Proto->getBinaryPrecedence();
|
BinopPrecedence[Proto->getOperatorName()] = Proto->getBinaryPrecedence();
|
||||||
|
|
||||||
// Create a new basic block to start insertion into.
|
// Create a new basic block to start insertion into.
|
||||||
BasicBlock *BB = new BasicBlock("entry", TheFunction);
|
BasicBlock *BB = BasicBlock::Create("entry", TheFunction);
|
||||||
Builder.SetInsertPoint(BB);
|
Builder.SetInsertPoint(BB);
|
||||||
|
|
||||||
// Add all arguments to the symbol table and create their allocas.
|
// Add all arguments to the symbol table and create their allocas.
|
||||||
|
Loading…
Reference in New Issue
Block a user