diff options
author | Daniel Dunbar <daniel@zuster.org> | 2008-09-24 04:00:38 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2008-09-24 04:00:38 +0000 |
commit | 29e0bccf2bcce22b877f8b2ed173f564c116b97e (patch) | |
tree | 89d9e059e918c47247fbc918732f0e9e668b543e /lib/CodeGen/CGStmt.cpp | |
parent | 49f6602707887eea1a558a1dffe0213102f887f2 (diff) |
Refactor some CodeGen functionality:
- Add CodeGenFunction::{EmitReturnOfRValue, EmitIvarOffset}
- Factor EmitLValueForIvar out of EmitObjCIvarRefLValue.
No non-error functionality change (some unsupported errors are
degraded to asserts for the time being).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56543 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGStmt.cpp')
-rw-r--r-- | lib/CodeGen/CGStmt.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp index bf3469e538..c7ee22a2c3 100644 --- a/lib/CodeGen/CGStmt.cpp +++ b/lib/CodeGen/CGStmt.cpp @@ -399,6 +399,21 @@ void CodeGenFunction::EmitForStmt(const ForStmt &S) { EmitBlock(AfterFor); } +void CodeGenFunction::EmitReturnOfRValue(RValue RV, QualType Ty) { + if (RV.isScalar()) { + Builder.CreateStore(RV.getScalarVal(), ReturnValue); + } else if (RV.isAggregate()) { + EmitAggregateCopy(ReturnValue, RV.getAggregateAddr(), Ty); + } else { + StoreComplexToAddr(RV.getComplexVal(), ReturnValue, false); + } + Builder.CreateBr(ReturnBlock); + + // Emit a block after the branch so that dead code after a return has some + // place to go. + EmitBlock(llvm::BasicBlock::Create()); +} + /// EmitReturnStmt - Note that due to GCC extensions, this can have an operand /// if the function returns void, or may be missing one if the function returns /// non-void. Fun stuff :). |