summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExprCXX.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CodeGen/CGExprCXX.cpp')
-rw-r--r--clang/lib/CodeGen/CGExprCXX.cpp65
1 files changed, 0 insertions, 65 deletions
diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp
index 1fab8d40641..513d80be0b1 100644
--- a/clang/lib/CodeGen/CGExprCXX.cpp
+++ b/clang/lib/CodeGen/CGExprCXX.cpp
@@ -721,71 +721,6 @@ static void EmitNewInitializer(CodeGenFunction &CGF, const CXXNewExpr *E,
StoreAnyExprIntoOneUnit(CGF, E, NewPtr);
}
-bool DominatingValue<RValue>::saved_type::needsSaving(RValue rv) {
- if (rv.isScalar())
- return DominatingLLVMValue::needsSaving(rv.getScalarVal());
- if (rv.isAggregate())
- return DominatingLLVMValue::needsSaving(rv.getAggregateAddr());
- return true;
-}
-
-DominatingValue<RValue>::saved_type
-DominatingValue<RValue>::saved_type::save(CodeGenFunction &CGF, RValue rv) {
- if (rv.isScalar()) {
- llvm::Value *V = rv.getScalarVal();
-
- // These automatically dominate and don't need to be saved.
- if (!DominatingLLVMValue::needsSaving(V))
- return saved_type(V, ScalarLiteral);
-
- // Everything else needs an alloca.
- llvm::Value *addr = CGF.CreateTempAlloca(V->getType(), "saved-rvalue");
- CGF.Builder.CreateStore(V, addr);
- return saved_type(addr, ScalarAddress);
- }
-
- if (rv.isComplex()) {
- CodeGenFunction::ComplexPairTy V = rv.getComplexVal();
- const llvm::Type *ComplexTy =
- llvm::StructType::get(CGF.getLLVMContext(),
- V.first->getType(), V.second->getType(),
- (void*) 0);
- llvm::Value *addr = CGF.CreateTempAlloca(ComplexTy, "saved-complex");
- CGF.StoreComplexToAddr(V, addr, /*volatile*/ false);
- return saved_type(addr, ComplexAddress);
- }
-
- assert(rv.isAggregate());
- llvm::Value *V = rv.getAggregateAddr(); // TODO: volatile?
- if (!DominatingLLVMValue::needsSaving(V))
- return saved_type(V, AggregateLiteral);
-
- llvm::Value *addr = CGF.CreateTempAlloca(V->getType(), "saved-rvalue");
- CGF.Builder.CreateStore(V, addr);
- return saved_type(addr, AggregateAddress);
-}
-
-/// Given a saved r-value produced by SaveRValue, perform the code
-/// necessary to restore it to usability at the current insertion
-/// point.
-RValue DominatingValue<RValue>::saved_type::restore(CodeGenFunction &CGF) {
- switch (K) {
- case ScalarLiteral:
- return RValue::get(Value);
- case ScalarAddress:
- return RValue::get(CGF.Builder.CreateLoad(Value));
- case AggregateLiteral:
- return RValue::getAggregate(Value);
- case AggregateAddress:
- return RValue::getAggregate(CGF.Builder.CreateLoad(Value));
- case ComplexAddress:
- return RValue::getComplex(CGF.LoadComplexFromAddr(Value, false));
- }
-
- llvm_unreachable("bad saved r-value kind");
- return RValue();
-}
-
namespace {
/// A cleanup to call the given 'operator delete' function upon
/// abnormal exit from a new expression.
OpenPOWER on IntegriCloud