Value *CodeGenFunction::EmitShuffleVector(Value* V1, Value *V2, ...) {
assert(V1->getType() == V2->getType() &&
"Vector operands must be of the same type");
-
unsigned NumElements =
cast<llvm::VectorType>(V1->getType())->getNumElements();
va_start(va, V2);
llvm::SmallVector<llvm::Constant*, 16> Args;
-
for (unsigned i = 0; i < NumElements; i++) {
int n = va_arg(va, int);
-
assert(n >= 0 && n < (int)NumElements * 2 &&
"Vector shuffle index out of bounds!");
-
Args.push_back(llvm::ConstantInt::get(llvm::Type::Int32Ty, n));
}
}
llvm::Value *CodeGenFunction::EmitVector(llvm::Value * const *Vals,
- unsigned NumVals, bool isSplat)
-{
+ unsigned NumVals, bool isSplat) {
llvm::Value *Vec
- = llvm::UndefValue::get(llvm::VectorType::get(Vals[0]->getType(), NumVals));
+ = llvm::UndefValue::get(llvm::VectorType::get(Vals[0]->getType(), NumVals));
- for (unsigned i = 0, e = NumVals ; i != e; ++i) {
+ for (unsigned i = 0, e = NumVals; i != e; ++i) {
llvm::Value *Val = isSplat ? Vals[0] : Vals[i];
llvm::Value *Idx = llvm::ConstantInt::get(llvm::Type::Int32Ty, i);
Vec = Builder.CreateInsertElement(Vec, Val, Idx, "tmp");
llvm::Value *AggLoc, bool isAggVol) {
// FIXME: handle vla's etc.
if (S.body_empty() || !isa<Expr>(S.body_back())) GetLast = false;
-
+
CGDebugInfo *DI = CGM.getDebugInfo();
if (DI) {
- if (S.getLBracLoc().isValid()) {
+ if (S.getLBracLoc().isValid())
DI->setLocation(S.getLBracLoc());
- }
DI->EmitRegionStart(CurFn, Builder);
}
EmitStmt(*I);
if (DI) {
- if (S.getRBracLoc().isValid()) {
+ if (S.getRBracLoc().isValid())
DI->setLocation(S.getRBracLoc());
- }
DI->EmitRegionEnd(CurFn, Builder);
}
if (isDummyBlock(BB)) {
BB->eraseFromParent();
Builder.SetInsertPoint(ThenBlock);
- }
- else
+ } else {
Builder.CreateBr(ContBlock);
+ }
// Emit the 'else' code if present.
if (const Stmt *Else = S.getElse()) {
if (isDummyBlock(BB)) {
BB->eraseFromParent();
Builder.SetInsertPoint(ElseBlock);
- }
- else
+ } else {
Builder.CreateBr(ContBlock);
+ }
}
// Emit the continuation block for code after the if.
} else if (!hasAggregateLLVMType(RV->getType())) {
RetValue = EmitScalarExpr(RV);
} else if (RV->getType()->isAnyComplexType()) {
- llvm::Value *SRetPtr = CurFn->arg_begin();
- EmitComplexExprIntoAddr(RV, SRetPtr, false);
+ EmitComplexExprIntoAddr(RV, CurFn->arg_begin(), false);
} else {
- llvm::Value *SRetPtr = CurFn->arg_begin();
- EmitAggExpr(RV, SRetPtr, false);
+ EmitAggExpr(RV, CurFn->arg_begin(), false);
}
if (RetValue) {
CaseRangeBlock = SavedCRBlock;
}
-static inline std::string ConvertAsmString(const char *Start,
- unsigned NumOperands,
- bool IsSimple)
-{
+static std::string ConvertAsmString(const char *Start, unsigned NumOperands,
+ bool IsSimple) {
static unsigned AsmCounter = 0;
-
AsmCounter++;
-
std::string Result;
if (IsSimple) {
while (*Start) {
Result += "$$";
break;
}
-
Start++;
}
if (EscapedChar == '%') {
// Escaped percentage sign.
Result += '%';
- }
- else if (EscapedChar == '=') {
+ } else if (EscapedChar == '=') {
// Generate an unique ID.
Result += llvm::utostr(AsmCounter);
} else if (isdigit(EscapedChar)) {
// %n - Assembler operand n
char *End;
-
unsigned long n = strtoul(Start, &End, 10);
if (Start == End) {
// FIXME: This should be caught during Sema.