[cfe-commits] r46904 - in /cfe/trunk/CodeGen: CGExpr.cpp CodeGenFunction.h
Eli Friedman
eli.friedman at gmail.com
Sat Feb 9 00:50:58 PST 2008
Author: efriedma
Date: Sat Feb 9 02:50:58 2008
New Revision: 46904
URL: http://llvm.org/viewvc/llvm-project?rev=46904&view=rev
Log:
Expose the logic for field address codegen; it is needed for aggregate
initializers, and I don't want to duplicate the bitfield-handling code.
(I'll send a patch for aggregate initializers to the mailing
list sometime soon.)
Modified:
cfe/trunk/CodeGen/CGExpr.cpp
cfe/trunk/CodeGen/CodeGenFunction.h
Modified: cfe/trunk/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGExpr.cpp?rev=46904&r1=46903&r2=46904&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/CodeGen/CGExpr.cpp Sat Feb 9 02:50:58 2008
@@ -454,7 +454,6 @@
}
LValue CodeGenFunction::EmitMemberExpr(const MemberExpr *E) {
- llvm::Value *V;
bool isUnion = false;
Expr *BaseExpr = E->getBase();
llvm::Value *BaseValue = NULL;
@@ -476,8 +475,15 @@
}
FieldDecl *Field = E->getMemberDecl();
- unsigned idx = CGM.getTypes().getLLVMFieldNo(Field);
+ return EmitLValueForField(BaseValue, Field, isUnion);
+}
+LValue CodeGenFunction::EmitLValueForField(llvm::Value* BaseValue,
+ FieldDecl* Field,
+ bool isUnion)
+{
+ llvm::Value *V;
+ unsigned idx = CGM.getTypes().getLLVMFieldNo(Field);
if (Field->isBitField()) {
const llvm::Type * FieldTy = ConvertType(Field->getType());
@@ -568,7 +574,7 @@
for (unsigned i = 0, e = NumArgs; i != e; ++i) {
QualType ArgTy = ArgExprs[i]->getType();
-
+
if (!hasAggregateLLVMType(ArgTy)) {
// Scalar argument is passed by-value.
Args.push_back(EmitScalarExpr(ArgExprs[i]));
Modified: cfe/trunk/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CodeGenFunction.h?rev=46904&r1=46903&r2=46904&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/CodeGen/CodeGenFunction.h Sat Feb 9 02:50:58 2008
@@ -71,6 +71,7 @@
class BlockVarDecl;
class EnumConstantDecl;
class ParmVarDecl;
+ class FieldDecl;
namespace CodeGen {
class CodeGenModule;
class CodeGenTypes;
@@ -415,6 +416,9 @@
LValue EmitArraySubscriptExpr(const ArraySubscriptExpr *E);
LValue EmitOCUVectorElementExpr(const OCUVectorElementExpr *E);
LValue EmitMemberExpr(const MemberExpr *E);
+
+ LValue EmitLValueForField(llvm::Value* Base, FieldDecl* Field,
+ bool isUnion);
//===--------------------------------------------------------------------===//
// Scalar Expression Emission
More information about the cfe-commits
mailing list