[cfe-commits] r72348 - in /cfe/trunk/lib/CodeGen: CGExprAgg.cpp CodeGenFunction.h
Mike Stump
mrs at apple.com
Sat May 23 15:29:43 PDT 2009
Author: mrs
Date: Sat May 23 17:29:41 2009
New Revision: 72348
URL: http://llvm.org/viewvc/llvm-project?rev=72348&view=rev
Log:
Track volatile aggregate copies better. I'm hoping someone else will decide
how to get the backend to know that the operation is volatile.
Modified:
cfe/trunk/lib/CodeGen/CGExprAgg.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=72348&r1=72347&r2=72348&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Sat May 23 17:29:41 2009
@@ -144,7 +144,8 @@
// FIXME: Pass VolatileDest as well. I think we also need to merge volatile
// from the source as well, as we can't eliminate it if either operand
// is volatile, unless copy has volatile for both source and destination..
- CGF.EmitAggregateCopy(DestPtr, Src.getAggregateAddr(), E->getType());
+ CGF.EmitAggregateCopy(DestPtr, Src.getAggregateAddr(), E->getType(),
+ VolatileDest|Src.isVolatileQualified());
}
/// EmitFinalDestCopy - Perform the final copy to DestPtr, if desired.
@@ -484,7 +485,8 @@
}
void CodeGenFunction::EmitAggregateCopy(llvm::Value *DestPtr,
- llvm::Value *SrcPtr, QualType Ty) {
+ llvm::Value *SrcPtr, QualType Ty,
+ bool isVolatile) {
assert(!Ty->isAnyComplexType() && "Shouldn't happen for complex");
// Aggregate assignment turns into llvm.memcpy. This is almost valid per
@@ -520,7 +522,8 @@
// }
//
// either, we need to use a differnt call here, or the backend needs to be
- // taught to not do this.
+ // taught to not do this. We use isVolatile to indicate when either the
+ // source or the destination is volatile.
Builder.CreateCall4(CGM.getMemCpyFn(),
DestPtr, SrcPtr,
// TypeInfo.first describes size in bits.
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=72348&r1=72347&r2=72348&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Sat May 23 17:29:41 2009
@@ -419,8 +419,12 @@
RValue EmitAnyExprToTemp(const Expr *E, llvm::Value *AggLoc = 0,
bool isAggLocVolatile = false);
+ /// EmitAggregateCopy - Emit an aggrate copy.
+ ///
+ /// \param isVolatile - True iff either the source or the destination is
+ /// volatile.
void EmitAggregateCopy(llvm::Value *DestPtr, llvm::Value *SrcPtr,
- QualType EltTy);
+ QualType EltTy, bool isVolatile=false);
void EmitAggregateClear(llvm::Value *DestPtr, QualType Ty);
More information about the cfe-commits
mailing list