Builder.CreateStore(Src.getScalarVal(), DstAddr);
}
-void CodeGenFunction::EmitStoreThroughOCUComponentLValue(RValue Src, LValue Dst,
+void CodeGenFunction::EmitStoreThroughOCUComponentLValue(RValue Src, LValue Dst,
QualType Ty) {
// This access turns into a read/modify/write of the vector. Load the input
// value now.
if (E->isArrow()) {
QualType PTy = cast<PointerType>(BaseExpr->getType())->getPointeeType();
- BaseValue = Builder.CreateBitCast(BaseValue,
- llvm::PointerType::get(ConvertType(PTy)),
- "tmp");
+ BaseValue =
+ Builder.CreateBitCast(BaseValue,
+ llvm::PointerType::get(ConvertType(PTy)), "tmp");
}
} else
BaseValue = EmitScalarExpr(BaseExpr);
// Match union field type.
if (BaseExpr->getType()->isUnionType()) {
const llvm::Type * FieldTy = ConvertType(Field->getType());
- const llvm::PointerType * BaseTy = cast<llvm::PointerType>(BaseValue->getType());
+ const llvm::PointerType * BaseTy =
+ cast<llvm::PointerType>(BaseValue->getType());
if (FieldTy != BaseTy->getElementType()) {
V = Builder.CreateBitCast(V, llvm::PointerType::get(FieldTy), "tmp");
}
std::vector<llvm::Constant*> ArrayElts;
const llvm::PointerType *APType = cast<llvm::PointerType>(DestPtr->getType());
- const llvm::ArrayType *AType = cast<llvm::ArrayType>(APType->getElementType());
+ const llvm::ArrayType *AType =
+ cast<llvm::ArrayType>(APType->getElementType());
// Copy initializer elements.
bool AllConstElements = true;
unsigned i = 0;
for (i = 0; i < NumInitElements; ++i) {
- if (llvm::Constant *C = dyn_cast<llvm::Constant>(CGF.EmitScalarExpr(E->getInit(i))))
+ if (llvm::Constant *C =
+ dyn_cast<llvm::Constant>(CGF.EmitScalarExpr(E->getInit(i))))
ArrayElts.push_back(C);
else {
AllConstElements = false;
NextVal = llvm::ConstantInt::get(InVal.first->getType(), AmountVal);
else if (InVal.first->getType() == llvm::Type::FloatTy)
// FIXME: Handle long double.
- NextVal = llvm::ConstantFP::get(InVal.first->getType(),
- llvm::APFloat(static_cast<float>(AmountVal)));
+ NextVal =
+ llvm::ConstantFP::get(InVal.first->getType(),
+ llvm::APFloat(static_cast<float>(AmountVal)));
else {
// FIXME: Handle long double.
assert(InVal.first->getType() == llvm::Type::DoubleTy);
- NextVal = llvm::ConstantFP::get(InVal.first->getType(),
- llvm::APFloat(static_cast<double>(AmountVal)));
+ NextVal =
+ llvm::ConstantFP::get(InVal.first->getType(),
+ llvm::APFloat(static_cast<double>(AmountVal)));
}
// Add the inc/dec to the real part.
NextVal = llvm::ConstantInt::get(InVal->getType(), AmountVal);
else if (InVal->getType() == llvm::Type::FloatTy)
// FIXME: Handle long double.
- NextVal = llvm::ConstantFP::get(InVal->getType(),
- llvm::APFloat(static_cast<float>(AmountVal)));
+ NextVal =
+ llvm::ConstantFP::get(InVal->getType(),
+ llvm::APFloat(static_cast<float>(AmountVal)));
else {
// FIXME: Handle long double.
assert(InVal->getType() == llvm::Type::DoubleTy);
- NextVal = llvm::ConstantFP::get(InVal->getType(),
- llvm::APFloat(static_cast<double>(AmountVal)));
+ NextVal =
+ llvm::ConstantFP::get(InVal->getType(),
+ llvm::APFloat(static_cast<double>(AmountVal)));
}
NextVal = Builder.CreateAdd(InVal, NextVal, isInc ? "inc" : "dec");
}
Value *ScalarExprEmitter::VisitChooseExpr(ChooseExpr *E) {
// Emit the LHS or RHS as appropriate.
- return Visit(E->isConditionTrue(CGF.getContext()) ? E->getLHS() : E->getRHS());
+ return
+ Visit(E->isConditionTrue(CGF.getContext()) ? E->getLHS() : E->getRHS());
}
Value *ScalarExprEmitter::VisitVAArgExpr(VAArgExpr *VE)
llvm::BasicBlock *NextBlock = new llvm::BasicBlock("after.sw", CurFn);
SwitchInsn = Builder.CreateSwitch(CondV, NextBlock);
- // All break statements jump to NextBlock. If BreakContinueStack is non empty then
- // reuse last ContinueBlock.
+ // All break statements jump to NextBlock. If BreakContinueStack is non empty
+ // then reuse last ContinueBlock.
llvm::BasicBlock *ContinueBlock = NULL;
if (!BreakContinueStack.empty())
ContinueBlock = BreakContinueStack.back().ContinueBlock;
std::vector<llvm::Constant*> ArrayElts;
const llvm::PointerType *APType = cast<llvm::PointerType>(GV->getType());
- const llvm::ArrayType *AType = cast<llvm::ArrayType>(APType->getElementType());
+ const llvm::ArrayType *AType =
+ cast<llvm::ArrayType>(APType->getElementType());
// Copy initializer elements.
unsigned i = 0;
for (i = 0; i < NumInitElements; ++i) {
assert (ILE->getInit(i)->getType()->isIntegerType()
&& "Only IntegerType global array initializers are supported");
- llvm::APSInt Value(static_cast<uint32_t>(
- getContext().getTypeSize(ILE->getInit(i)->getType(), SourceLocation())));
+ llvm::APSInt
+ Value(static_cast<uint32_t>
+ (getContext().getTypeSize(ILE->getInit(i)->getType(),
+ SourceLocation())));
if (ILE->getInit(i)->isIntegerConstantExpr(Value, Context)) {
llvm::Constant *C = llvm::ConstantInt::get(Value);
ArrayElts.push_back(C);
// Initialize remaining array elements.
unsigned NumArrayElements = AType->getNumElements();
+ const llvm::Type *AElemTy = AType->getElementType();
for (; i < NumArrayElements; ++i)
- ArrayElts.push_back(llvm::Constant::getNullValue(AType->getElementType()));
+ ArrayElts.push_back(llvm::Constant::getNullValue(AElemTy));
Init = llvm::ConstantArray::get(AType, ArrayElts);
} else
return OpaqueI->second;
// Create new OpaqueType now for later use.
- // FIXME: This creates a lot of opaque types, most of which are not needed.
- // Reevaluate this when performance analyis finds tons of opaque types.
+ // FIXME: This creates a lot of opaque types, most of them are not
+ // needed. Reevaluate this when performance analyis finds tons of
+ // opaque types.
llvm::OpaqueType *OpaqueTy = llvm::OpaqueType::get();
RecordTypesToResolve[RD] = OpaqueTy;
TypeHolderMap.insert(std::make_pair(T.getTypePtr(),