[cfe-commits] r68557 - /cfe/trunk/lib/CodeGen/CGBlocks.cpp
Anders Carlsson
andersca at mac.com
Tue Apr 7 15:10:22 PDT 2009
Author: andersca
Date: Tue Apr 7 17:10:22 2009
New Revision: 68557
URL: http://llvm.org/viewvc/llvm-project?rev=68557&view=rev
Log:
Shuffle some call code around. No functionality change.
Modified:
cfe/trunk/lib/CodeGen/CGBlocks.cpp
Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=68557&r1=68556&r2=68557&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Tue Apr 7 17:10:22 2009
@@ -412,10 +412,6 @@
const BlockPointerType *BPT =
E->getCallee()->getType()->getAsBlockPointerType();
- const CGFunctionInfo &FnInfo = CGM.getTypes().getFunctionInfo(BPT);
- bool IsVariadic =
- BPT->getPointeeType()->getAsFunctionProtoType()->isVariadic();
-
llvm::Value *Callee = EmitScalarExpr(E->getCallee());
// Get a pointer to the generic block literal.
@@ -428,14 +424,6 @@
// Get the function pointer from the literal.
llvm::Value *FuncPtr = Builder.CreateStructGEP(BlockLiteral, 3, "tmp");
- llvm::Value *Func = Builder.CreateLoad(FuncPtr, false, "tmp");
-
- // Cast the function pointer to the right type.
- const llvm::Type *BlockFTy =
- CGM.getTypes().GetFunctionType(FnInfo, IsVariadic);
-
- const llvm::Type *BlockFTyPtr = llvm::PointerType::getUnqual(BlockFTy);
- Func = Builder.CreateBitCast(Func, BlockFTyPtr);
BlockLiteral =
Builder.CreateBitCast(BlockLiteral,
@@ -453,6 +441,20 @@
Args.push_back(std::make_pair(EmitAnyExprToTemp(*i),
i->getType()));
+ // Load the function.
+ llvm::Value *Func = Builder.CreateLoad(FuncPtr, false, "tmp");
+
+ const CGFunctionInfo &FnInfo = CGM.getTypes().getFunctionInfo(BPT);
+ bool IsVariadic =
+ BPT->getPointeeType()->getAsFunctionProtoType()->isVariadic();
+
+ // Cast the function pointer to the right type.
+ const llvm::Type *BlockFTy =
+ CGM.getTypes().GetFunctionType(FnInfo, IsVariadic);
+
+ const llvm::Type *BlockFTyPtr = llvm::PointerType::getUnqual(BlockFTy);
+ Func = Builder.CreateBitCast(Func, BlockFTyPtr);
+
// And call the block.
return EmitCall(FnInfo, Func, Args);
}
More information about the cfe-commits
mailing list