[cfe-commits] r111717 - in /cfe/trunk/lib/CodeGen: CGCall.cpp CGExpr.cpp CGExprAgg.cpp
Daniel Dunbar
daniel at zuster.org
Fri Aug 20 20:15:20 PDT 2010
Author: ddunbar
Date: Fri Aug 20 22:15:20 2010
New Revision: 111717
URL: http://llvm.org/viewvc/llvm-project?rev=111717&view=rev
Log:
IRgen: Switch more MakeAddr() users to MakeAddrLValue; this time for calls which were previously not computing the qualifier list. In most cases, I don't think it matters, but I believe this is conservatively more correct / consistent.
Modified:
cfe/trunk/lib/CodeGen/CGCall.cpp
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/lib/CodeGen/CGExprAgg.cpp
Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=111717&r1=111716&r2=111717&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Fri Aug 20 22:15:20 2010
@@ -947,9 +947,8 @@
// we need to create a temporary and reconstruct it from the
// arguments.
llvm::Value *Temp = CreateMemTemp(Ty, Arg->getName() + ".addr");
- // FIXME: What are the right qualifiers here?
llvm::Function::arg_iterator End =
- ExpandTypeFromArgs(Ty, LValue::MakeAddr(Temp, Qualifiers()), AI);
+ ExpandTypeFromArgs(Ty, MakeAddrLValue(Temp, Ty), AI);
EmitParmDecl(*Arg, Temp);
// Name the arguments used in expansion and increment AI.
Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=111717&r1=111716&r2=111717&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Fri Aug 20 22:15:20 2010
@@ -1260,13 +1260,13 @@
}
LValue CodeGenFunction::EmitStringLiteralLValue(const StringLiteral *E) {
- return LValue::MakeAddr(CGM.GetAddrOfConstantStringFromLiteral(E),
- Qualifiers());
+ return MakeAddrLValue(CGM.GetAddrOfConstantStringFromLiteral(E),
+ E->getType());
}
LValue CodeGenFunction::EmitObjCEncodeExprLValue(const ObjCEncodeExpr *E) {
- return LValue::MakeAddr(CGM.GetAddrOfConstantStringFromObjCEncode(E),
- Qualifiers());
+ return MakeAddrLValue(CGM.GetAddrOfConstantStringFromObjCEncode(E),
+ E->getType());
}
@@ -1308,7 +1308,7 @@
llvm::Constant *C =
CGM.GetAddrOfConstantCString(FunctionName, GlobalVarName.c_str());
- return LValue::MakeAddr(C, Qualifiers());
+ return MakeAddrLValue(C, E->getType());
}
}
}
Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=111717&r1=111716&r2=111717&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Fri Aug 20 22:15:20 2010
@@ -259,13 +259,12 @@
case CastExpr::CK_ToUnion: {
// GCC union extension
- QualType PtrTy =
- CGF.getContext().getPointerType(E->getSubExpr()->getType());
+ QualType Ty = E->getSubExpr()->getType();
+ QualType PtrTy = CGF.getContext().getPointerType(Ty);
llvm::Value *CastPtr = Builder.CreateBitCast(DestPtr,
CGF.ConvertType(PtrTy));
- EmitInitializationToLValue(E->getSubExpr(),
- LValue::MakeAddr(CastPtr, Qualifiers()),
- E->getSubExpr()->getType());
+ EmitInitializationToLValue(E->getSubExpr(), CGF.MakeAddrLValue(CastPtr, Ty),
+ Ty);
break;
}
@@ -521,7 +520,7 @@
return;
}
- EmitFinalDestCopy(VE, LValue::MakeAddr(ArgPtr, Qualifiers()));
+ EmitFinalDestCopy(VE, CGF.MakeAddrLValue(ArgPtr, VE->getType()));
}
void AggExprEmitter::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
@@ -549,9 +548,7 @@
Val = CGF.CreateMemTemp(E->getType(), "tmp");
if (E->requiresZeroInitialization())
- EmitNullInitializationToLValue(LValue::MakeAddr(Val,
- // FIXME: Qualifiers()?
- E->getType().getQualifiers()),
+ EmitNullInitializationToLValue(CGF.MakeAddrLValue(Val, E->getType()),
E->getType());
CGF.EmitCXXConstructExpr(Val, E);
@@ -570,8 +567,8 @@
// Create a temporary variable.
Val = CGF.CreateMemTemp(E->getType(), "tmp");
}
- LValue LV = LValue::MakeAddr(Val, Qualifiers());
- EmitNullInitializationToLValue(LV, E->getType());
+ EmitNullInitializationToLValue(CGF.MakeAddrLValue(Val, E->getType()),
+ E->getType());
}
void AggExprEmitter::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) {
@@ -581,8 +578,8 @@
// Create a temporary variable.
Val = CGF.CreateMemTemp(E->getType(), "tmp");
}
- LValue LV = LValue::MakeAddr(Val, Qualifiers());
- EmitNullInitializationToLValue(LV, E->getType());
+ EmitNullInitializationToLValue(CGF.MakeAddrLValue(Val, E->getType()),
+ E->getType());
}
void
@@ -627,7 +624,7 @@
llvm::GlobalVariable* GV =
new llvm::GlobalVariable(CGF.CGM.getModule(), C->getType(), true,
llvm::GlobalValue::InternalLinkage, C, "");
- EmitFinalDestCopy(E, LValue::MakeAddr(GV, Qualifiers()));
+ EmitFinalDestCopy(E, CGF.MakeAddrLValue(GV, E->getType()));
return;
}
#endif
@@ -717,7 +714,7 @@
// FIXME: This is a hack around an AST bug (PR6537).
if (NumInitElements == 1 && E->getType() == E->getInit(0)->getType()) {
EmitInitializationToLValue(E->getInit(0),
- LValue::MakeAddr(DestPtr, Qualifiers()),
+ CGF.MakeAddrLValue(DestPtr, E->getType()),
E->getType());
return;
}
@@ -776,10 +773,10 @@
LValue CodeGenFunction::EmitAggExprToLValue(const Expr *E) {
assert(hasAggregateLLVMType(E->getType()) && "Invalid argument!");
- Qualifiers Q = MakeQualifiers(E->getType());
llvm::Value *Temp = CreateMemTemp(E->getType());
- EmitAggExpr(E, Temp, Q.hasVolatile());
- return LValue::MakeAddr(Temp, Q);
+ LValue LV = MakeAddrLValue(Temp, E->getType());
+ EmitAggExpr(E, Temp, LV.isVolatileQualified());
+ return LV;
}
void CodeGenFunction::EmitAggregateCopy(llvm::Value *DestPtr,
More information about the cfe-commits
mailing list