[cfe-commits] r63845 - in /cfe/trunk/lib/CodeGen: CGCall.cpp CGExpr.cpp CodeGenFunction.h
Daniel Dunbar
daniel at zuster.org
Wed Feb 4 23:09:07 PST 2009
Author: ddunbar
Date: Thu Feb 5 01:09:07 2009
New Revision: 63845
URL: http://llvm.org/viewvc/llvm-project?rev=63845&view=rev
Log:
Pull CodeGenFunction::GetUndefRValue() out of EmitUnsupportedRValue.
Modified:
cfe/trunk/lib/CodeGen/CGCall.cpp
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=63845&r1=63844&r2=63845&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Thu Feb 5 01:09:07 2009
@@ -1430,17 +1430,11 @@
return RValue::get(CI);
case ABIArgInfo::Ignore:
- if (RetTy->isVoidType())
- return RValue::get(0);
-
// If we are ignoring an argument that had a result, make sure to
// construct the appropriate return value for our caller.
- if (CodeGenFunction::hasAggregateLLVMType(RetTy)) {
- llvm::Value *Res =
- llvm::UndefValue::get(llvm::PointerType::getUnqual(ConvertType(RetTy)));
- return RValue::getAggregate(Res);
- }
- return RValue::get(llvm::UndefValue::get(ConvertType(RetTy)));
+ return GetUndefRValue(RetTy);
+ if (RetTy->isVoidType())
+ return RValue::get(0);
case ABIArgInfo::Coerce: {
// FIXME: Avoid the conversion through memory if possible.
Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=63845&r1=63844&r2=63845&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Thu Feb 5 01:09:07 2009
@@ -83,23 +83,27 @@
// LValue Expression Emission
//===----------------------------------------------------------------------===//
-RValue CodeGenFunction::EmitUnsupportedRValue(const Expr *E,
- const char *Name) {
- ErrorUnsupported(E, Name);
- if (const ComplexType *CTy = E->getType()->getAsComplexType()) {
+RValue CodeGenFunction::GetUndefRValue(QualType Ty) {
+ if (Ty->isVoidType()) {
+ return RValue::get(0);
+ } else if (const ComplexType *CTy = Ty->getAsComplexType()) {
const llvm::Type *EltTy = ConvertType(CTy->getElementType());
llvm::Value *U = llvm::UndefValue::get(EltTy);
return RValue::getComplex(std::make_pair(U, U));
- } else if (hasAggregateLLVMType(E->getType())) {
- const llvm::Type *Ty =
- llvm::PointerType::getUnqual(ConvertType(E->getType()));
- return RValue::getAggregate(llvm::UndefValue::get(Ty));
+ } else if (hasAggregateLLVMType(Ty)) {
+ const llvm::Type *LTy = llvm::PointerType::getUnqual(ConvertType(Ty));
+ return RValue::getAggregate(llvm::UndefValue::get(LTy));
} else {
- const llvm::Type *Ty = ConvertType(E->getType());
- return RValue::get(llvm::UndefValue::get(Ty));
+ return RValue::get(llvm::UndefValue::get(ConvertType(Ty)));
}
}
+RValue CodeGenFunction::EmitUnsupportedRValue(const Expr *E,
+ const char *Name) {
+ ErrorUnsupported(E, Name);
+ return GetUndefRValue(E->getType());
+}
+
LValue CodeGenFunction::EmitUnsupportedLValue(const Expr *E,
const char *Name) {
ErrorUnsupported(E, Name);
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=63845&r1=63844&r2=63845&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Thu Feb 5 01:09:07 2009
@@ -450,6 +450,9 @@
// LValue Expression Emission
//===--------------------------------------------------------------------===//
+ /// GetUndefRValue - Get an appropriate 'undef' rvalue for the given type.
+ RValue GetUndefRValue(QualType Ty);
+
/// EmitUnsupportedRValue - Emit a dummy r-value using the type of E
/// and issue an ErrorUnsupported style diagnostic (using the
/// provided Name).
More information about the cfe-commits
mailing list