[llvm-commits] [llvm-gcc-4.2] r79705 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Eric Christopher
echristo at apple.com
Fri Aug 21 17:23:12 PDT 2009
Author: echristo
Date: Fri Aug 21 19:23:12 2009
New Revision: 79705
URL: http://llvm.org/viewvc/llvm-project?rev=79705&view=rev
Log:
Nuke trailing whitespace.
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=79705&r1=79704&r2=79705&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Fri Aug 21 19:23:12 2009
@@ -1,5 +1,5 @@
/* LLVM LOCAL begin (ENTIRE FILE!) */
-/* High-level LLVM backend interface
+/* High-level LLVM backend interface
Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
Contributed by Chris Lattner (sabre at nondot.org)
@@ -160,10 +160,10 @@
Fn = 0;
ReturnBB = UnwindBB = 0;
ReturnOffset = 0;
-
+
if (TheDebugInfo) {
expanded_location Location = expand_location(DECL_SOURCE_LOCATION (fndecl));
-
+
if (Location.file) {
TheDebugInfo->setLocationFile(Location.file);
TheDebugInfo->setLocationLine(Location.line);
@@ -258,7 +258,7 @@
const LLVMBuilder &B, CallingConv::ID &CC)
: FunctionDecl(FnDecl), AI(ai), Builder(B), Offset(0), CallingConv(CC),
isShadowRet(false) {}
-
+
/// getCallingConv - This provides the desired CallingConv for the function.
CallingConv::ID& getCallingConv(void) { return CallingConv; }
@@ -273,11 +273,11 @@
}
void clear() {
assert(NameStack.size() == 1 && LocStack.size() == 1 && "Imbalance!");
- NameStack.clear();
+ NameStack.clear();
LocStack.clear();
}
-
- void HandleAggregateShadowResult(const PointerType *PtrArgTy,
+
+ void HandleAggregateShadowResult(const PointerType *PtrArgTy,
bool RetPtr) {
// If the function returns a structure by value, we transform the function
// to take a pointer to the result as the first argument of the function
@@ -294,14 +294,14 @@
++AI;
return;
}
-
+
// Otherwise, this must be something returned with NRVO.
assert(TREE_CODE(TREE_TYPE(ResultDecl)) == REFERENCE_TYPE &&
"Not type match and not passing by reference?");
// Create an alloca for the ResultDecl.
Value *Tmp = TheTreeToLLVM->CreateTemporary(AI->getType());
Builder.CreateStore(AI, Tmp);
-
+
SET_DECL_LLVM(ResultDecl, Tmp);
if (TheDebugInfo) {
TheDebugInfo->EmitDeclare(ResultDecl,
@@ -338,7 +338,7 @@
// If this is just a mismatch between integer types, this is due
// to K&R prototypes, where the forward proto defines the arg as int
// and the actual impls is a short or char.
- assert(ArgVal->getType() == Type::getInt32Ty(Context) &&
+ assert(ArgVal->getType() == Type::getInt32Ty(Context) &&
LLVMTy->isInteger() &&
"Lowerings don't match?");
ArgVal = Builder.CreateTrunc(ArgVal, LLVMTy,NameStack.back().c_str());
@@ -371,13 +371,13 @@
void EnterField(unsigned FieldNo, const llvm::Type *StructTy) {
NameStack.push_back(NameStack.back()+"."+utostr(FieldNo));
-
+
Value *Loc = LocStack.back();
// This cast only involves pointers, therefore BitCast.
Loc = Builder.CreateBitCast(Loc, PointerType::getUnqual(StructTy));
Loc = Builder.CreateStructGEP(Loc, FieldNo);
- LocStack.push_back(Loc);
+ LocStack.push_back(Loc);
}
void ExitField() {
NameStack.pop_back();
@@ -409,7 +409,7 @@
// Get the name of the function.
if (tree ID = DECL_ASSEMBLER_NAME(FnDecl))
Name = IDENTIFIER_POINTER(ID);
-
+
// Determine the FunctionType and calling convention for this function.
tree static_chain = cfun->static_chain_decl;
const FunctionType *FTy;
@@ -418,7 +418,7 @@
// If the function has no arguments and is varargs (...), turn it into a
// non-varargs function by scanning the param list for the function. This
- // allows C functions declared as "T foo() {}" to be treated like
+ // allows C functions declared as "T foo() {}" to be treated like
// "T foo(void) {}" and allows us to handle functions with K&R-style
// definitions correctly.
if (TYPE_ARG_TYPES(TREE_TYPE(FnDecl)) == 0) {
@@ -433,7 +433,7 @@
static_chain,
CallingConv, PAL);
}
-
+
// If we've already seen this function and created a prototype, and if the
// proto has the right LLVM type, just use it.
if (DECL_LLVM_SET_P(FnDecl) &&
@@ -454,7 +454,7 @@
assert(FnEntry->getCallingConv() == static_cast<unsigned>(CallingConv) &&
"Calling convention disagreement between prototype and impl!");
}
-
+
// Otherwise, either it exists with the wrong type or it doesn't exist. In
// either case create a new function.
Fn = Function::Create(FTy, Function::ExternalLinkage, Name, TheModule);
@@ -541,10 +541,10 @@
// Create a new basic block for the function.
Builder.SetInsertPoint(BasicBlock::Create(Context, "entry", Fn));
-
+
if (TheDebugInfo)
TheDebugInfo->EmitFunctionStart(FnDecl, Fn, Builder.GetInsertBlock());
-
+
// Loop over all of the arguments to the function, setting Argument names and
// creating argument alloca's for the PARM_DECLs in case their address is
// exposed.
@@ -595,7 +595,7 @@
SET_DECL_LLVM(Args, Tmp);
if (TheDebugInfo) {
TheDebugInfo->EmitDeclare(Args, dwarf::DW_TAG_arg_variable,
- Name, TREE_TYPE(Args), Tmp,
+ Name, TREE_TYPE(Args), Tmp,
Builder.GetInsertBlock());
}
@@ -607,7 +607,7 @@
if (POINTER_TYPE_P(TREE_TYPE(Args))
&& lookup_attribute ("gcroot", TYPE_ATTRIBUTES(TREE_TYPE(Args))))
EmitTypeGcroot(Tmp, Args);
-
+
Client.setName(Name);
Client.setLocation(Tmp);
ABIConverter.HandleArgument(TREE_TYPE(Args), ScalarArgs);
@@ -627,7 +627,7 @@
if (cfun->nonlocal_goto_save_area) {
// Not supported yet.
}
-
+
// As it turns out, not all temporaries are associated with blocks. For those
// that aren't, emit them now.
for (tree t = cfun->unexpanded_var_list; t; t = TREE_CHAIN(t)) {
@@ -674,10 +674,10 @@
// Otherwise, this aggregate result must be something that is returned
// in a scalar register for this target. We must bit convert the
// aggregate to the specified scalar type, which we do by casting the
- // pointer and loading. The load does not necessarily start at the
+ // pointer and loading. The load does not necessarily start at the
// beginning of the aggregate (x86-64).
if (ReturnOffset) {
- RetVal = BitCastToType(RetVal,
+ RetVal = BitCastToType(RetVal,
PointerType::getUnqual(Type::getInt8Ty(Context)));
RetVal = Builder.CreateGEP(RetVal,
ConstantInt::get(TD.getIntPtrType(Context), ReturnOffset));
@@ -753,7 +753,7 @@
// If this stmt returns an aggregate value (e.g. a call whose result is
// ignored), create a temporary to receive the value. Note that we don't
// do this for MODIFY_EXPRs as an efficiency hack.
- if (isAggregateTreeType(TREE_TYPE(stmt)) &&
+ if (isAggregateTreeType(TREE_TYPE(stmt)) &&
TREE_CODE(stmt)!= MODIFY_EXPR && TREE_CODE(stmt)!=INIT_EXPR)
DestLoc = CreateTempLoc(ConvertType(TREE_TYPE(stmt)));
@@ -768,7 +768,7 @@
EmitBlock(BasicBlock::Create(Context, ""));
}
}
-
+
// Wrap things up.
return FinishFunctionBody();
}
@@ -777,9 +777,9 @@
assert((isAggregateTreeType(TREE_TYPE(exp)) == (DestLoc != 0) ||
TREE_CODE(exp) == MODIFY_EXPR || TREE_CODE(exp) == INIT_EXPR) &&
"Didn't pass DestLoc to an aggregate expr, or passed it to scalar!");
-
+
Value *Result = 0;
-
+
if (TheDebugInfo) {
if (EXPR_HAS_LOCATION(exp)) {
// Set new location on the way up the tree.
@@ -789,7 +789,7 @@
TheDebugInfo->EmitStopPoint(Fn, Builder.GetInsertBlock());
}
-
+
switch (TREE_CODE(exp)) {
default:
std::cerr << "Unhandled expression!\n"
@@ -844,8 +844,8 @@
case TRUTH_NOT_EXPR: Result = EmitTRUTH_NOT_EXPR(exp); break;
// Binary Operators
- case LT_EXPR:
- Result = EmitCompare(exp, ICmpInst::ICMP_ULT, ICmpInst::ICMP_SLT,
+ case LT_EXPR:
+ Result = EmitCompare(exp, ICmpInst::ICMP_ULT, ICmpInst::ICMP_SLT,
FCmpInst::FCMP_OLT);
break;
case LE_EXPR:
@@ -857,21 +857,21 @@
FCmpInst::FCMP_OGT);
break;
case GE_EXPR:
- Result = EmitCompare(exp, ICmpInst::ICMP_UGE, ICmpInst::ICMP_SGE,
+ Result = EmitCompare(exp, ICmpInst::ICMP_UGE, ICmpInst::ICMP_SGE,
FCmpInst::FCMP_OGE);
break;
case EQ_EXPR:
- Result = EmitCompare(exp, ICmpInst::ICMP_EQ, ICmpInst::ICMP_EQ,
+ Result = EmitCompare(exp, ICmpInst::ICMP_EQ, ICmpInst::ICMP_EQ,
FCmpInst::FCMP_OEQ);
break;
case NE_EXPR:
- Result = EmitCompare(exp, ICmpInst::ICMP_NE, ICmpInst::ICMP_NE,
+ Result = EmitCompare(exp, ICmpInst::ICMP_NE, ICmpInst::ICMP_NE,
FCmpInst::FCMP_UNE);
break;
- case UNORDERED_EXPR:
+ case UNORDERED_EXPR:
Result = EmitCompare(exp, 0, 0, FCmpInst::FCMP_UNO);
break;
- case ORDERED_EXPR:
+ case ORDERED_EXPR:
Result = EmitCompare(exp, 0, 0, FCmpInst::FCMP_ORD);
break;
case UNLT_EXPR: Result = EmitCompare(exp, 0, 0, FCmpInst::FCMP_ULT); break;
@@ -899,17 +899,17 @@
Instruction::Mul);
break;
case EXACT_DIV_EXPR: Result = EmitEXACT_DIV_EXPR(exp, DestLoc); break;
- case TRUNC_DIV_EXPR:
+ case TRUNC_DIV_EXPR:
if (TYPE_UNSIGNED(TREE_TYPE(exp)))
Result = EmitBinOp(exp, DestLoc, Instruction::UDiv);
- else
+ else
Result = EmitBinOp(exp, DestLoc, Instruction::SDiv);
break;
case RDIV_EXPR: Result = EmitBinOp(exp, DestLoc, Instruction::FDiv); break;
case CEIL_DIV_EXPR: Result = EmitCEIL_DIV_EXPR(exp); break;
case FLOOR_DIV_EXPR: Result = EmitFLOOR_DIV_EXPR(exp); break;
case ROUND_DIV_EXPR: Result = EmitROUND_DIV_EXPR(exp); break;
- case TRUNC_MOD_EXPR:
+ case TRUNC_MOD_EXPR:
if (TYPE_UNSIGNED(TREE_TYPE(exp)))
Result = EmitBinOp(exp, DestLoc, Instruction::URem);
else
@@ -927,14 +927,14 @@
TYPE_UNSIGNED(TREE_TYPE(exp)) ? Instruction::LShr : Instruction::AShr);
break;
case LSHIFT_EXPR: Result = EmitShiftOp(exp,DestLoc,Instruction::Shl);break;
- case RROTATE_EXPR:
+ case RROTATE_EXPR:
Result = EmitRotateOp(exp, Instruction::LShr, Instruction::Shl);
break;
case LROTATE_EXPR:
Result = EmitRotateOp(exp, Instruction::Shl, Instruction::LShr);
break;
- case MIN_EXPR:
- Result = EmitMinMaxExpr(exp, ICmpInst::ICMP_ULE, ICmpInst::ICMP_SLE,
+ case MIN_EXPR:
+ Result = EmitMinMaxExpr(exp, ICmpInst::ICMP_ULE, ICmpInst::ICMP_SLE,
FCmpInst::FCMP_OLE);
break;
case MAX_EXPR:
@@ -942,11 +942,11 @@
FCmpInst::FCMP_OGE);
break;
case CONSTRUCTOR: Result = EmitCONSTRUCTOR(exp, DestLoc); break;
-
+
// Complex Math Expressions.
case COMPLEX_CST: EmitCOMPLEX_CST (exp, DestLoc); break;
case COMPLEX_EXPR: EmitCOMPLEX_EXPR(exp, DestLoc); break;
-
+
// Constant Expressions
case INTEGER_CST:
Result = TreeConstantToLLVM::ConvertINTEGER_CST(exp);
@@ -966,7 +966,7 @@
}
assert(((DestLoc && Result == 0) || DestLoc == 0) &&
- "Expected a scalar or aggregate but got the wrong thing!");
+ "Expected a scalar or aggregate but got the wrong thing!");
// Check that the type of the result matches that of the tree node. If the
// result is not used then GCC sometimes sets the tree type to VOID_TYPE, so
// don't take VOID_TYPE too seriously here.
@@ -991,7 +991,7 @@
std::cerr << "Unhandled lvalue expression!\n";
debug_tree(exp);
abort();
-
+
case PARM_DECL:
case VAR_DECL:
case FUNCTION_DECL:
@@ -1073,7 +1073,7 @@
void TreeToLLVM::TODO(tree exp) {
std::cerr << "Unhandled tree node\n";
if (exp) debug_tree(exp);
- abort();
+ abort();
}
/// CastToType - Cast the specified value to the specified type if it is
@@ -1091,7 +1091,7 @@
/// CastToAnyType - Cast the specified value to the specified type making no
/// assumptions about the types of the arguments. This creates an inferred cast.
-Value *TreeToLLVM::CastToAnyType(Value *V, bool VisSigned,
+Value *TreeToLLVM::CastToAnyType(Value *V, bool VisSigned,
const Type* Ty, bool TyIsSigned) {
// Eliminate useless casts of a type to itself.
if (V->getType() == Ty)
@@ -1099,7 +1099,7 @@
// The types are different so we must cast. Use getCastOpcode to create an
// inferred cast opcode.
- Instruction::CastOps opc =
+ Instruction::CastOps opc =
CastInst::getCastOpcode(V, VisSigned, Ty, TyIsSigned);
// Generate the cast and return it.
@@ -1117,7 +1117,7 @@
unsigned DstBits = Ty->getPrimitiveSizeInBits();
assert(SrcBits != DstBits && "Types are different but have same #bits?");
- Instruction::CastOps opcode =
+ Instruction::CastOps opcode =
(SrcBits > DstBits ? Instruction::Trunc : Instruction::ZExt);
return CastToType(opcode, V, Ty);
}
@@ -1133,7 +1133,7 @@
unsigned DstBits = Ty->getPrimitiveSizeInBits();
assert(SrcBits != DstBits && "Types are different but have same #bits?");
- Instruction::CastOps opcode =
+ Instruction::CastOps opcode =
(SrcBits > DstBits ? Instruction::Trunc : Instruction::SExt);
return CastToType(opcode, V, Ty);
}
@@ -1145,12 +1145,12 @@
unsigned DstBits = Ty->getPrimitiveSizeInBits();
if (SrcBits == DstBits)
return V;
- Instruction::CastOps opcode = (SrcBits > DstBits ?
+ Instruction::CastOps opcode = (SrcBits > DstBits ?
Instruction::FPTrunc : Instruction::FPExt);
return CastToType(opcode, V, Ty);
}
-/// BitCastToType - Insert a BitCast from V to Ty if needed. This is just a
+/// BitCastToType - Insert a BitCast from V to Ty if needed. This is just a
/// shorthand convenience function for CastToType(Instruction::BitCast,V,Ty).
Value *TreeToLLVM::BitCastToType(Value *V, const Type *Ty) {
return CastToType(Instruction::BitCast, V, Ty);
@@ -1198,7 +1198,7 @@
// Otherwise, fall through to this block.
Builder.CreateBr(BB);
}
-
+
// Add this block.
Fn->getBasicBlockList().push_back(BB);
Builder.SetInsertPoint(BB); // It is now the current block.
@@ -1262,7 +1262,7 @@
}
}
-/// containsFPField - indicates whether the given LLVM type
+/// containsFPField - indicates whether the given LLVM type
/// contains any floating point elements.
static bool containsFPField(const Type *LLVMTy) {
@@ -1270,7 +1270,7 @@
return true;
const StructType* STy = dyn_cast<StructType>(LLVMTy);
if (STy) {
- for (StructType::element_iterator I = STy->element_begin(),
+ for (StructType::element_iterator I = STy->element_begin(),
E = STy->element_end(); I != E; I++) {
const Type *Ty = *I;
if (Ty->isFloatingPoint())
@@ -1312,12 +1312,12 @@
// If the GCC type is not fully covered by the LLVM type, use memcpy. This
// can occur with unions etc.
if ((TREE_CODE(type) != UNION_TYPE || !containsFPField(LLVMTy)) &&
- !TheTypeConverter->GCCTypeOverlapsWithLLVMTypePadding(type, LLVMTy) &&
+ !TheTypeConverter->GCCTypeOverlapsWithLLVMTypePadding(type, LLVMTy) &&
// Don't copy tons of tiny elements.
CountAggregateElements(LLVMTy) <= 8) {
- DestLoc.Ptr = BitCastToType(DestLoc.Ptr,
+ DestLoc.Ptr = BitCastToType(DestLoc.Ptr,
PointerType::getUnqual(LLVMTy));
- SrcLoc.Ptr = BitCastToType(SrcLoc.Ptr,
+ SrcLoc.Ptr = BitCastToType(SrcLoc.Ptr,
PointerType::getUnqual(LLVMTy));
CopyAggregate(DestLoc, SrcLoc, Builder, type);
return;
@@ -1370,7 +1370,7 @@
if (!TheTypeConverter->GCCTypeOverlapsWithLLVMTypePadding(type, LLVMTy) &&
// Don't zero tons of tiny elements.
CountAggregateElements(LLVMTy) <= 8) {
- DestLoc.Ptr = BitCastToType(DestLoc.Ptr,
+ DestLoc.Ptr = BitCastToType(DestLoc.Ptr,
PointerType::getUnqual(LLVMTy));
ZeroAggregate(DestLoc, Builder);
return;
@@ -1423,7 +1423,7 @@
CastToSIntType(Size, IntPtr),
ConstantInt::get(Type::getInt32Ty(Context), Align)
};
-
+
Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::memset,
&IntPtr, 1), Ops, Ops+4);
return Ops[0];
@@ -1437,30 +1437,30 @@
Function *gcrootFun = Intrinsic::getDeclaration(TheModule,
Intrinsic::gcroot);
-
+
// The idea is that it's a pointer to type "Value"
// which is opaque* but the routine expects i8** and i8*.
const PointerType *Ty = PointerType::getUnqual(Type::getInt8Ty(Context));
V = Builder.CreateBitCast(V, PointerType::getUnqual(Ty));
-
+
Value *Ops[2] = {
V,
ConstantPointerNull::get(Ty)
};
-
+
Builder.CreateCall(gcrootFun, Ops, Ops+2);
-}
+}
// Emits annotate intrinsic if the decl has the annotate attribute set.
void TreeToLLVM::EmitAnnotateIntrinsic(Value *V, tree decl) {
-
+
// Handle annotate attribute on global.
tree annotateAttr = lookup_attribute("annotate", DECL_ATTRIBUTES (decl));
-
+
if (!annotateAttr)
return;
- Function *annotateFun = Intrinsic::getDeclaration(TheModule,
+ Function *annotateFun = Intrinsic::getDeclaration(TheModule,
Intrinsic::var_annotation);
// Get file and line number
@@ -1469,21 +1469,21 @@
Constant *file = ConvertMetadataStringToGV(DECL_SOURCE_FILE(decl));
const Type *SBP= PointerType::getUnqual(Type::getInt8Ty(Context));
file = Builder.getFolder().CreateBitCast(file, SBP);
-
- // There may be multiple annotate attributes. Pass return of lookup_attr
+
+ // There may be multiple annotate attributes. Pass return of lookup_attr
// to successive lookups.
while (annotateAttr) {
-
+
// Each annotate attribute is a tree list.
// Get value of list which is our linked list of args.
tree args = TREE_VALUE(annotateAttr);
-
+
// Each annotate attribute may have multiple args.
// Treat each arg as if it were a separate annotate attribute.
for (tree a = args; a; a = TREE_CHAIN(a)) {
// Each element of the arg list is a tree list, so get value
tree val = TREE_VALUE(a);
-
+
// Assert its a string, and then get that string.
assert(TREE_CODE(val) == STRING_CST &&
"Annotate attribute arg should always be a string");
@@ -1492,13 +1492,13 @@
Value *Ops[4] = {
BitCastToType(V, SBP),
BitCastToType(strGV, SBP),
- file,
+ file,
lineNo
};
-
+
Builder.CreateCall(annotateFun, Ops, Ops+4);
}
-
+
// Get next annotate attribute.
annotateAttr = TREE_CHAIN(annotateAttr);
if (annotateAttr)
@@ -1514,12 +1514,12 @@
/// function and set DECL_LLVM for the decl to the right pointer.
void TreeToLLVM::EmitAutomaticVariableDecl(tree decl) {
tree type = TREE_TYPE(decl);
-
+
// An LLVM value pointer for this decl may already be set, for example, if the
// named return value optimization is being applied to this function, and
// this variable is the one being returned.
assert(!DECL_LLVM_SET_P(decl) && "Shouldn't call this on an emitted var!");
-
+
// For a CONST_DECL, set mode, alignment, and sizes from those of the
// type in case this node is used in a reference.
if (TREE_CODE(decl) == CONST_DECL) {
@@ -1529,7 +1529,7 @@
DECL_SIZE_UNIT(decl) = TYPE_SIZE_UNIT(type);
return;
}
-
+
// Otherwise, only automatic (and result) variables need any expansion done.
// Static and external variables, and external functions, will be handled by
// `assemble_variable' (called from finish_decl). TYPE_DECL requires nothing.
@@ -1542,7 +1542,7 @@
// definition is encountered.
if (isGimpleTemporary(decl))
return;
-
+
// If this is just the rotten husk of a variable that the gimplifier
// eliminated all uses of, but is preserving for debug info, ignore it.
if (TREE_CODE(decl) == VAR_DECL && DECL_VALUE_EXPR(decl))
@@ -1609,11 +1609,11 @@
} else {
AI = Builder.CreateAlloca(Ty, Size, Name);
}
-
+
AI->setAlignment(Alignment);
-
+
SET_DECL_LLVM(decl, AI);
-
+
// Handle annotate attributes
if (DECL_ATTRIBUTES(decl))
EmitAnnotateIntrinsic(AI, decl);
@@ -1628,7 +1628,7 @@
EmitTypeGcroot(AI, decl);
Builder.CreateStore(Constant::getNullValue(T), AI);
}
-
+
if (TheDebugInfo) {
if (DECL_NAME(decl)) {
TheDebugInfo->EmitDeclare(decl, dwarf::DW_TAG_auto_variable,
@@ -1651,7 +1651,7 @@
Constant *TreeToLLVM::getIndirectGotoBlockNumber(BasicBlock *BB) {
ConstantInt *&Val = AddressTakenBBNumbers[BB];
if (Val) return Val;
-
+
// Assign the new ID, update AddressTakenBBNumbers to remember it.
uint64_t BlockNo = ++NumAddressTakenBlocks;
BlockNo &= ~0ULL >> (64-TD.getPointerSizeInBits());
@@ -1669,12 +1669,12 @@
// Create a temporary for the value to be switched on.
IndirectGotoValue = CreateTemporary(TD.getIntPtrType(Context));
-
+
// Create the block, emit a load, and emit the switch in the block.
IndirectGotoBlock = BasicBlock::Create(Context, "indirectgoto");
Value *Ld = new LoadInst(IndirectGotoValue, "gotodest", IndirectGotoBlock);
SwitchInst::Create(Ld, IndirectGotoBlock, 0, IndirectGotoBlock);
-
+
// Finally, return it.
return IndirectGotoBlock;
}
@@ -1704,7 +1704,7 @@
Value *V = Emit(TREE_OPERAND(exp, 0), 0);
V = CastToType(Instruction::PtrToInt, V, TD.getIntPtrType(Context));
Builder.CreateStore(V, IndirectGotoValue);
-
+
// NOTE: This is HORRIBLY INCORRECT in the presence of exception handlers.
// There should be one collector block per cleanup level! Note that
// standard GCC gets this wrong as well.
@@ -1721,7 +1721,7 @@
tree retval = TREE_OPERAND(exp, 0);
assert((!retval || TREE_CODE(retval) == RESULT_DECL ||
- ((TREE_CODE(retval) == MODIFY_EXPR
+ ((TREE_CODE(retval) == MODIFY_EXPR
|| TREE_CODE(retval) == INIT_EXPR) &&
TREE_CODE(TREE_OPERAND(retval, 0)) == RESULT_DECL)) &&
"RETURN_EXPR not gimple!");
@@ -1738,7 +1738,7 @@
Value *TreeToLLVM::EmitCOND_EXPR(tree exp) {
tree exp_cond = COND_EXPR_COND(exp);
-
+
// Emit the conditional expression. Special case comparisons since they are
// very common and we want to avoid an extension to 'int' of the intermediate
// result.
@@ -1746,7 +1746,7 @@
Value *Cond;
switch (TREE_CODE(exp_cond)) {
default: break;
- case LT_EXPR:
+ case LT_EXPR:
UIPred = ICmpInst::ICMP_ULT;
SIPred = ICmpInst::ICMP_SLT;
FPPred = FCmpInst::FCMP_OLT;
@@ -1795,7 +1795,7 @@
Cond = EmitCompare(exp_cond, UIPred, SIPred, FPPred, Type::getInt1Ty(Context));
assert(Cond->getType() == Type::getInt1Ty(Context));
}
-
+
tree Then = COND_EXPR_THEN(exp);
tree Else = COND_EXPR_ELSE(exp);
assert(TREE_CODE(Then) == GOTO_EXPR && TREE_CODE(Else) == GOTO_EXPR
@@ -1810,11 +1810,11 @@
Value *TreeToLLVM::EmitSWITCH_EXPR(tree exp) {
tree Cases = SWITCH_LABELS(exp);
-
+
// Emit the condition.
Value *SwitchExp = Emit(SWITCH_COND(exp), 0);
bool ExpIsSigned = !TYPE_UNSIGNED(TREE_TYPE(SWITCH_COND(exp)));
-
+
// Emit the switch instruction.
SwitchInst *SI = Builder.CreateSwitch(SwitchExp, Builder.GetInsertBlock(),
TREE_VEC_LENGTH(Cases));
@@ -2079,7 +2079,7 @@
Value *Cond = NULL;
for (; TypeList; TypeList = TREE_CHAIN (TypeList)) {
Value *TType = Emit(lookup_type_for_runtime(TREE_VALUE(TypeList)), 0);
- TType = BitCastToType(TType,
+ TType = BitCastToType(TType,
PointerType::getUnqual(Type::getInt8Ty(Context)));
// Call get eh type id.
@@ -2213,14 +2213,14 @@
bool isVolatile = TREE_THIS_VOLATILE(exp);
const Type *Ty = ConvertType(TREE_TYPE(exp));
unsigned Alignment = LV.getAlignment();
- if (TREE_CODE(exp) == COMPONENT_REF)
- if (const StructType *STy =
+ if (TREE_CODE(exp) == COMPONENT_REF)
+ if (const StructType *STy =
dyn_cast<StructType>(ConvertType(TREE_TYPE(TREE_OPERAND(exp, 0)))))
if (STy->isPacked())
// Packed struct members use 1 byte alignment
Alignment = 1;
-
-
+
+
if (!LV.isBitfield()) {
if (!DestLoc) {
// Scalar value: emit a load.
@@ -2505,12 +2505,12 @@
/// HandleAggregateResultAsScalar - This callback is invoked if the function
/// returns an aggregate value by bit converting it to the specified scalar
/// type and returning that.
- void HandleAggregateResultAsScalar(const Type *ScalarTy,
+ void HandleAggregateResultAsScalar(const Type *ScalarTy,
unsigned Offset = 0) {
this->Offset = Offset;
}
- /// HandleAggregateResultAsAggregate - This callback is invoked if the
+ /// HandleAggregateResultAsAggregate - This callback is invoked if the
/// function returns an aggregate value using multiple return values.
void HandleAggregateResultAsAggregate(const Type *AggrTy) {
// There is nothing to do here.
@@ -2688,7 +2688,7 @@
TheLLVMABI<FunctionCallArgumentConversion> ABIConverter(Client);
// Handle the result, including struct returns.
- ABIConverter.HandleReturnType(TREE_TYPE(exp),
+ ABIConverter.HandleReturnType(TREE_TYPE(exp),
fndecl ? fndecl : exp,
fndecl ? DECL_BUILT_IN(fndecl) : false);
@@ -2718,7 +2718,7 @@
}
Attributes Attrs = Attribute::None;
-
+
unsigned OldSize = CallOperands.size();
ABIConverter.HandleArgument(type, ScalarArgs, &Attrs);
@@ -2756,7 +2756,7 @@
}
}
}
-
+
Value *Call;
if (!LandingPad) {
Call = Builder.CreateCall(Callee, CallOperands.begin(), CallOperands.end());
@@ -2912,8 +2912,8 @@
LValue LV = EmitLV(lhs);
bool isVolatile = TREE_THIS_VOLATILE(lhs);
unsigned Alignment = LV.getAlignment();
- if (TREE_CODE(lhs) == COMPONENT_REF)
- if (const StructType *STy =
+ if (TREE_CODE(lhs) == COMPONENT_REF)
+ if (const StructType *STy =
dyn_cast<StructType>(ConvertType(TREE_TYPE(TREE_OPERAND(lhs, 0)))))
if (STy->isPacked())
// Packed struct members use 1 byte alignment
@@ -2929,7 +2929,7 @@
if (PT->getElementType()->canLosslesslyBitCastTo(RHS->getType()))
RHS = CastToAnyType(RHS, RHSSigned, PT->getElementType(), LHSSigned);
else
- LV.Ptr = BitCastToType(LV.Ptr,
+ LV.Ptr = BitCastToType(LV.Ptr,
PointerType::getUnqual(RHS->getType()));
StoreInst *SI = Builder.CreateStore(RHS, LV.Ptr, isVolatile);
SI->setAlignment(Alignment);
@@ -3046,11 +3046,11 @@
Value *OpVal = Emit(Op, &NewLoc);
assert(OpVal == 0 && "Shouldn't cast scalar to aggregate!");
return 0;
- }
+ }
// Scalar to aggregate copy.
Value *OpVal = Emit(Op, 0);
- Value *Ptr = BitCastToType(DestLoc->Ptr,
+ Value *Ptr = BitCastToType(DestLoc->Ptr,
PointerType::getUnqual(OpVal->getType()));
StoreInst *St = Builder.CreateStore(OpVal, Ptr, DestLoc->Volatile);
St->setAlignment(DestLoc->getAlignment());
@@ -3121,7 +3121,7 @@
return Builder.CreateLoad(BitCastToType(Target.Ptr,
PointerType::getUnqual(ExpTy)));
}
-
+
if (DestLoc) {
// The input is a scalar the output is an aggregate, just eval the input,
// then store into DestLoc.
@@ -3138,7 +3138,7 @@
Value *OpVal = Emit(Op, 0);
assert(OpVal && "Expected a scalar result!");
const Type *DestTy = ConvertType(TREE_TYPE(exp));
-
+
// If the source is a pointer, use ptrtoint to get it to something
// bitcast'able. This supports things like v_c_e(foo*, float).
if (isa<PointerType>(OpVal->getType())) {
@@ -3147,7 +3147,7 @@
// Otherwise, ptrtoint to intptr_t first.
OpVal = Builder.CreatePtrToInt(OpVal, TD.getIntPtrType(Context));
}
-
+
// If the destination type is a pointer, use inttoptr.
if (isa<PointerType>(DestTy))
return Builder.CreateIntToPtr(OpVal, DestTy);
@@ -3163,14 +3163,14 @@
return Builder.CreateFNeg(V);
if (!isa<PointerType>(V->getType()))
return Builder.CreateNeg(V);
-
+
// GCC allows NEGATE_EXPR on pointers as well. Cast to int, negate, cast
// back.
V = CastToAnyType(V, false, TD.getIntPtrType(Context), false);
V = Builder.CreateNeg(V);
return CastToType(Instruction::IntToPtr, V, ConvertType(TREE_TYPE(exp)));
}
-
+
// Emit the operand to a temporary.
const Type *ComplexTy =
cast<PointerType>(DestLoc->Ptr->getType())->getElementType();
@@ -3216,7 +3216,7 @@
Value *OpN = Builder.CreateNeg(Op, (Op->getNameStr()+"neg").c_str());
ICmpInst::Predicate pred = TYPE_UNSIGNED(TREE_TYPE(TREE_OPERAND(exp, 0))) ?
ICmpInst::ICMP_UGE : ICmpInst::ICMP_SGE;
- Value *Cmp = Builder.CreateICmp(pred, Op,
+ Value *Cmp = Builder.CreateICmp(pred, Op,
Constant::getNullValue(Op->getType()), "abscond");
return Builder.CreateSelect(Cmp, Op, OpN, "abs");
}
@@ -3267,13 +3267,13 @@
cast<VectorType>(Ty)->getElementType()->isFloatingPoint())) {
Op = BitCastToType(Op, getSuitableBitCastIntType(Ty));
}
- return BitCastToType(Builder.CreateNot(Op,
+ return BitCastToType(Builder.CreateNot(Op,
(Op->getNameStr()+"not").c_str()),Ty);
}
Value *TreeToLLVM::EmitTRUTH_NOT_EXPR(tree exp) {
Value *V = Emit(TREE_OPERAND(exp, 0), 0);
- if (V->getType() != Type::getInt1Ty(Context))
+ if (V->getType() != Type::getInt1Ty(Context))
V = Builder.CreateICmpNE(V,
Constant::getNullValue(V->getType()), "toBool");
V = Builder.CreateNot(V, (V->getNameStr()+"not").c_str());
@@ -3288,7 +3288,7 @@
/// If DestTy is specified, make sure to return the result with the specified
/// integer type. Otherwise, return the expression as whatever TREE_TYPE(exp)
/// corresponds to.
-Value *TreeToLLVM::EmitCompare(tree exp, unsigned UIOpc, unsigned SIOpc,
+Value *TreeToLLVM::EmitCompare(tree exp, unsigned UIOpc, unsigned SIOpc,
unsigned FPPred, const Type *DestTy) {
// Get the type of the operands
tree Op0Ty = TREE_TYPE(TREE_OPERAND(exp,0));
@@ -3314,7 +3314,7 @@
} else {
// Handle the integer/pointer cases. Determine which predicate to use based
// on signedness.
- ICmpInst::Predicate pred =
+ ICmpInst::Predicate pred =
ICmpInst::Predicate(TYPE_UNSIGNED(Op0Ty) ? UIOpc : SIOpc);
// Get the compare instructions
@@ -3322,10 +3322,10 @@
}
}
assert(Result->getType() == Type::getInt1Ty(Context) && "Expected i1 result for compare");
-
+
if (DestTy == 0)
DestTy = ConvertType(TREE_TYPE(exp));
-
+
// The GCC type is probably an int, not a bool. ZExt to the right size.
if (Result->getType() == DestTy)
return Result;
@@ -3342,10 +3342,10 @@
return EmitComplexBinOp(exp, DestLoc);
assert(Ty->isSingleValueType() && DestLoc == 0 &&
"Bad binary operation!");
-
+
Value *LHS = Emit(TREE_OPERAND(exp, 0), 0);
Value *RHS = Emit(TREE_OPERAND(exp, 1), 0);
-
+
// GCC has no problem with things like "xor uint X, int 17", and X-Y, where
// X and Y are pointer types, but the result is an integer. As such, convert
// everything to the result type.
@@ -3365,7 +3365,7 @@
const Type *ResTy = Ty;
if (isLogicalOp &&
(Ty->isFloatingPoint() ||
- (isa<VectorType>(Ty) &&
+ (isa<VectorType>(Ty) &&
cast<VectorType>(Ty)->getElementType()->isFloatingPoint()))) {
Ty = getSuitableBitCastIntType(Ty);
LHS = BitCastToType(LHS, Ty);
@@ -3388,24 +3388,24 @@
///
Value *TreeToLLVM::EmitPtrBinOp(tree exp, unsigned Opc) {
Value *LHS = Emit(TREE_OPERAND(exp, 0), 0);
-
+
// If this is an expression like (P+4), try to turn this into
// "getelementptr P, 1".
if ((Opc == Instruction::Add || Opc == Instruction::Sub) &&
TREE_CODE(TREE_OPERAND(exp, 1)) == INTEGER_CST) {
int64_t Offset = getINTEGER_CSTVal(TREE_OPERAND(exp, 1));
-
+
// If POINTER_SIZE is 32-bits and the offset is signed, sign extend it.
if (POINTER_SIZE == 32 && !TYPE_UNSIGNED(TREE_TYPE(TREE_OPERAND(exp, 1))))
Offset = (Offset << 32) >> 32;
-
+
// Figure out how large the element pointed to is.
const Type *ElTy = cast<PointerType>(LHS->getType())->getElementType();
// We can't get the type size (and thus convert to using a GEP instr) from
// pointers to opaque structs if the type isn't abstract.
if (ElTy->isSized()) {
int64_t EltSize = TD.getTypeAllocSize(ElTy);
-
+
// If EltSize exactly divides Offset, then we know that we can turn this
// into a getelementptr instruction.
int64_t EltOffset = EltSize ? Offset/EltSize : 0;
@@ -3421,8 +3421,8 @@
}
}
}
-
-
+
+
Value *RHS = Emit(TREE_OPERAND(exp, 1), 0);
const Type *IntPtrTy = TD.getIntPtrType(Context);
@@ -3440,16 +3440,16 @@
Value *RHS = Emit(TREE_OPERAND(exp, 1), 0);
bool LHSIsSigned = !TYPE_UNSIGNED(TREE_TYPE(TREE_OPERAND(exp, 0)));
bool RHSIsSigned = !TYPE_UNSIGNED(TREE_TYPE(TREE_OPERAND(exp, 1)));
-
+
// This is a truth operation like the strict &&,||,^^. Convert to bool as
// a test against zero
- LHS = Builder.CreateICmpNE(LHS,
+ LHS = Builder.CreateICmpNE(LHS,
Constant::getNullValue(LHS->getType()),
"toBool");
- RHS = Builder.CreateICmpNE(RHS,
+ RHS = Builder.CreateICmpNE(RHS,
Constant::getNullValue(RHS->getType()),
"toBool");
-
+
Value *Res = Builder.CreateBinOp((Instruction::BinaryOps)Opc, LHS, RHS);
return CastToType(Instruction::ZExt, Res, ConvertType(TREE_TYPE(exp)));
}
@@ -3459,13 +3459,13 @@
assert(DestLoc == 0 && "aggregate shift?");
const Type *Ty = ConvertType(TREE_TYPE(exp));
assert(!isa<PointerType>(Ty) && "Pointer arithmetic!?");
-
+
Value *LHS = Emit(TREE_OPERAND(exp, 0), 0);
Value *RHS = Emit(TREE_OPERAND(exp, 1), 0);
if (RHS->getType() != LHS->getType())
RHS = Builder.CreateIntCast(RHS, LHS->getType(), false,
(RHS->getNameStr()+".cast").c_str());
-
+
return Builder.CreateBinOp((Instruction::BinaryOps)Opc, LHS, RHS);
}
@@ -3488,18 +3488,18 @@
Value *TypeSize =
ConstantInt::get(In->getType(),
In->getType()->getPrimitiveSizeInBits());
-
+
// Do the two shifts.
Value *V1 = Builder.CreateBinOp((Instruction::BinaryOps)Opc1, In, Amt);
Value *OtherShift = Builder.CreateSub(TypeSize, Amt);
Value *V2 = Builder.CreateBinOp((Instruction::BinaryOps)Opc2, In, OtherShift);
-
+
// Or the two together to return them.
Value *Merge = Builder.CreateOr(V1, V2);
return CastToUIntType(Merge, ConvertType(TREE_TYPE(exp)));
}
-Value *TreeToLLVM::EmitMinMaxExpr(tree exp, unsigned UIPred, unsigned SIPred,
+Value *TreeToLLVM::EmitMinMaxExpr(tree exp, unsigned UIPred, unsigned SIPred,
unsigned FPPred) {
Value *LHS = Emit(TREE_OPERAND(exp, 0), 0);
Value *RHS = Emit(TREE_OPERAND(exp, 1), 0);
@@ -3507,17 +3507,17 @@
const Type *Ty = ConvertType(TREE_TYPE(exp));
// The LHS, RHS and Ty could be integer, floating or pointer typed. We need
- // to convert the LHS and RHS into the destination type before doing the
+ // to convert the LHS and RHS into the destination type before doing the
// comparison. Use CastInst::getCastOpcode to get this right.
bool TyIsSigned = !TYPE_UNSIGNED(TREE_TYPE(exp));
bool LHSIsSigned = !TYPE_UNSIGNED(TREE_TYPE(TREE_OPERAND(exp, 0)));
bool RHSIsSigned = !TYPE_UNSIGNED(TREE_TYPE(TREE_OPERAND(exp, 1)));
- Instruction::CastOps opcode =
+ Instruction::CastOps opcode =
CastInst::getCastOpcode(LHS, LHSIsSigned, Ty, TyIsSigned);
LHS = CastToType(opcode, LHS, Ty);
opcode = CastInst::getCastOpcode(RHS, RHSIsSigned, Ty, TyIsSigned);
RHS = CastToType(opcode, RHS, Ty);
-
+
Value *Compare;
if (LHS->getType()->isFloatingPoint())
Compare = Builder.CreateFCmp(FCmpInst::Predicate(FPPred), LHS, RHS);
@@ -3541,7 +3541,7 @@
Value *TreeToLLVM::EmitFLOOR_MOD_EXPR(tree exp, const MemRef *DestLoc) {
// Notation: FLOOR_MOD_EXPR <-> Mod, TRUNC_MOD_EXPR <-> Rem.
-
+
// We express Mod in terms of Rem as follows: if RHS exactly divides LHS,
// or the values of LHS and RHS have the same sign, then Mod equals Rem.
// Otherwise Mod equals Rem + RHS. This means that LHS Mod RHS traps iff
@@ -3549,25 +3549,25 @@
if (TYPE_UNSIGNED(TREE_TYPE(exp)))
// LHS and RHS values must have the same sign if their type is unsigned.
return EmitBinOp(exp, DestLoc, Instruction::URem);
-
+
const Type *Ty = ConvertType(TREE_TYPE(exp));
Constant *Zero = ConstantInt::get(Ty, 0);
-
+
Value *LHS = Emit(TREE_OPERAND(exp, 0), 0);
Value *RHS = Emit(TREE_OPERAND(exp, 1), 0);
-
+
// The two possible values for Mod.
Value *Rem = Builder.CreateSRem(LHS, RHS, "rem");
Value *RemPlusRHS = Builder.CreateAdd(Rem, RHS);
-
+
// HaveSameSign: (LHS >= 0) == (RHS >= 0).
Value *LHSIsPositive = Builder.CreateICmpSGE(LHS, Zero);
Value *RHSIsPositive = Builder.CreateICmpSGE(RHS, Zero);
Value *HaveSameSign = Builder.CreateICmpEQ(LHSIsPositive,RHSIsPositive);
-
+
// RHS exactly divides LHS iff Rem is zero.
Value *RemIsZero = Builder.CreateICmpEQ(Rem, Zero);
-
+
Value *SameAsRem = Builder.CreateOr(HaveSameSign, RemIsZero);
return Builder.CreateSelect(SameAsRem, Rem, RemPlusRHS, "mod");
}
@@ -3688,7 +3688,7 @@
Value *TreeToLLVM::EmitROUND_DIV_EXPR(tree exp) {
// Notation: ROUND_DIV_EXPR <-> RDiv, TRUNC_DIV_EXPR <-> Div.
-
+
// RDiv calculates LHS/RHS by rounding to the nearest integer. Ties
// are broken by rounding away from zero. In terms of Div this means:
// LHS RDiv RHS = (LHS + (RHS Div 2)) Div RHS
@@ -3698,30 +3698,30 @@
// expressions in these formulae can overflow, so some tweaking is
// required to ensure correct results. The details depend on whether
// we are doing signed or unsigned arithmetic.
-
+
const Type *Ty = ConvertType(TREE_TYPE(exp));
Constant *Zero = ConstantInt::get(Ty, 0);
Constant *Two = ConstantInt::get(Ty, 2);
-
+
Value *LHS = Emit(TREE_OPERAND(exp, 0), 0);
Value *RHS = Emit(TREE_OPERAND(exp, 1), 0);
-
+
if (!TYPE_UNSIGNED(TREE_TYPE(exp))) {
// In the case of signed arithmetic, we calculate RDiv as follows:
// LHS RDiv RHS = (sign) ( (|LHS| + (|RHS| UDiv 2)) UDiv |RHS| ),
// where sign is +1 if LHS and RHS have the same sign, -1 if their
// signs differ. Doing the computation unsigned ensures that there
// is no overflow.
-
+
// On some machines INT_MIN Div -1 traps. You might expect a trap for
// INT_MIN RDiv -1 too, but this implementation will not generate one.
// Quick quiz question: what value is returned for INT_MIN RDiv -1?
-
+
// Determine the signs of LHS and RHS, and whether they have the same sign.
Value *LHSIsPositive = Builder.CreateICmpSGE(LHS, Zero);
Value *RHSIsPositive = Builder.CreateICmpSGE(RHS, Zero);
Value *HaveSameSign = Builder.CreateICmpEQ(LHSIsPositive, RHSIsPositive);
-
+
// Calculate |LHS| ...
Value *MinusLHS = Builder.CreateNeg(LHS);
Value *AbsLHS = Builder.CreateSelect(LHSIsPositive, LHS, MinusLHS,
@@ -3730,18 +3730,18 @@
Value *MinusRHS = Builder.CreateNeg(RHS);
Value *AbsRHS = Builder.CreateSelect(RHSIsPositive, RHS, MinusRHS,
(RHS->getNameStr()+".abs").c_str());
-
+
// Calculate AbsRDiv = (|LHS| + (|RHS| UDiv 2)) UDiv |RHS|.
Value *HalfAbsRHS = Builder.CreateUDiv(AbsRHS, Two);
Value *Numerator = Builder.CreateAdd(AbsLHS, HalfAbsRHS);
Value *AbsRDiv = Builder.CreateUDiv(Numerator, AbsRHS);
-
+
// Return AbsRDiv or -AbsRDiv according to whether LHS and RHS have the
// same sign or not.
Value *MinusAbsRDiv = Builder.CreateNeg(AbsRDiv);
return Builder.CreateSelect(HaveSameSign, AbsRDiv, MinusAbsRDiv, "rdiv");
}
-
+
// In the case of unsigned arithmetic, LHS and RHS necessarily have the
// same sign, however overflow is a problem. We want to use the formula
// LHS RDiv RHS = (LHS + (RHS Div 2)) Div RHS,
@@ -3750,21 +3750,21 @@
// simple solution of explicitly checking for overflow, and using
// LHS RDiv RHS = ((LHS + (RHS Div 2)) - RHS) Div RHS + 1
// if it occurred.
-
+
// Usually the numerator is LHS + (RHS Div 2); calculate this.
Value *HalfRHS = Builder.CreateUDiv(RHS, Two);
Value *Numerator = Builder.CreateAdd(LHS, HalfRHS);
-
+
// Did the calculation overflow?
Value *Overflowed = Builder.CreateICmpULT(Numerator, HalfRHS);
-
+
// If so, use (LHS + (RHS Div 2)) - RHS for the numerator instead.
Value *AltNumerator = Builder.CreateSub(Numerator, RHS);
Numerator = Builder.CreateSelect(Overflowed, AltNumerator, Numerator);
-
+
// Quotient = Numerator / RHS.
Value *Quotient = Builder.CreateUDiv(Numerator, RHS);
-
+
// Return Quotient unless we overflowed, in which case return Quotient + 1.
return Builder.CreateAdd(Quotient, CastToUIntType(Overflowed, Ty), "rdiv");
}
@@ -3899,12 +3899,12 @@
}
}
}
-
+
// Expand [name] symbolic operand names.
str = resolve_asm_operand_names(str, ASM_OUTPUTS(exp), ASM_INPUTS(exp));
const char *InStr = TREE_STRING_POINTER(str);
-
+
std::string Result;
while (1) {
switch (*InStr++) {
@@ -3933,7 +3933,7 @@
// syntax.
char *EndPtr;
unsigned long OpNum = strtoul(InStr, &EndPtr, 10);
-
+
if (InStr == EndPtr) {
error("%Hoperand number missing after %%-letter",&EXPR_LOCATION(exp));
return Result;
@@ -3968,7 +3968,7 @@
/// alternatives, etc.
static std::string CanonicalizeConstraint(const char *Constraint) {
std::string Result;
-
+
// Skip over modifier characters.
bool DoneModifiers = false;
while (!DoneModifiers) {
@@ -3989,7 +3989,7 @@
return Result;
}
}
-
+
while (*Constraint) {
char ConstraintChar = *Constraint++;
@@ -4005,13 +4005,13 @@
// a valid address.
if (ConstraintChar == 'p')
ConstraintChar = 'r';
-
+
// See if this is a regclass constraint.
unsigned RegClass;
if (ConstraintChar == 'r')
// REG_CLASS_FROM_CONSTRAINT doesn't support 'r' for some reason.
RegClass = GENERAL_REGS;
- else
+ else
RegClass = REG_CLASS_FROM_CONSTRAINT(Constraint[-1], Constraint-1);
if (RegClass == NO_REGS) { // not a reg class.
@@ -4022,10 +4022,10 @@
// Look to see if the specified regclass has exactly one member, and if so,
// what it is. Cache this information in AnalyzedRegClasses once computed.
static std::map<unsigned, int> AnalyzedRegClasses;
-
+
std::map<unsigned, int>::iterator I =
AnalyzedRegClasses.lower_bound(RegClass);
-
+
int RegMember;
if (I != AnalyzedRegClasses.end() && I->first == RegClass) {
// We've already computed this, reuse value.
@@ -4055,7 +4055,7 @@
Result += ConstraintChar;
}
}
-
+
return Result;
}
@@ -4132,9 +4132,9 @@
// RunningConstraints is pointers into the Constraints strings which
// are incremented as we go to point to the beginning of each
// comma-separated alternative.
- const char** RunningConstraints =
+ const char** RunningConstraints =
(const char**)alloca((NumInputs+NumOutputs)*sizeof(const char*));
- memcpy(RunningConstraints, Constraints,
+ memcpy(RunningConstraints, Constraints,
(NumInputs+NumOutputs) * sizeof(const char*));
// The entire point of this loop is to compute CommasToSkip.
for (unsigned int i=0; i<NumChoices; i++) {
@@ -4154,7 +4154,7 @@
// next tuple.
if (w < 0)
Weights[i] = -1;
- else
+ else
Weights[i] += w;
}
while (*p!=0 && *p!=',')
@@ -4167,7 +4167,7 @@
RunningConstraints[j] = p;
}
assert(j==NumOutputs);
- for (tree Input = ASM_INPUTS(exp); j<NumInputs+NumOutputs;
+ for (tree Input = ASM_INPUTS(exp); j<NumInputs+NumOutputs;
j++, Input = TREE_CHAIN(Input)) {
const char* p = RunningConstraints[j];
if (Weights[i] != -1) {
@@ -4276,21 +4276,21 @@
else if (NumChoices != NumOutputChoices)
abort(); // invalid constraints
}
-
+
/// Constraints - The output/input constraints, concatenated together in array
/// form instead of list form.
const char **Constraints =
(const char **)alloca((NumOutputs + NumInputs) * sizeof(const char *));
-
+
// Process outputs.
int ValNum = 0;
- for (tree Output = ASM_OUTPUTS(exp); Output;
+ for (tree Output = ASM_OUTPUTS(exp); Output;
Output = TREE_CHAIN(Output), ++ValNum) {
tree Operand = TREE_VALUE(Output);
tree type = TREE_TYPE(Operand);
// If there's an erroneous arg, emit no insn.
if (type == error_mark_node) return 0;
-
+
// Parse the output constraint.
const char *Constraint =
TREE_STRING_POINTER(TREE_VALUE(TREE_PURPOSE(Output)));
@@ -4302,7 +4302,7 @@
tree type = TREE_TYPE(Val);
// If there's an erroneous arg, emit no insn.
if (type == error_mark_node) return 0;
-
+
const char *Constraint =
TREE_STRING_POINTER(TREE_VALUE(TREE_PURPOSE(Input)));
Constraints[ValNum] = Constraint;
@@ -4323,19 +4323,19 @@
std::vector<const Type*> CallArgTypes;
std::string NewAsmStr = ConvertInlineAsmStr(exp, NumOutputs+NumInputs);
std::string ConstraintStr;
-
+
// StoreCallResultAddr - The pointer to store the result of the call through.
SmallVector<Value *, 4> StoreCallResultAddrs;
SmallVector<const Type *, 4> CallResultTypes;
SmallVector<bool, 4> CallResultIsSigned;
-
+
// Process outputs.
ValNum = 0;
- for (tree Output = ASM_OUTPUTS(exp); Output;
+ for (tree Output = ASM_OUTPUTS(exp); Output;
Output = TREE_CHAIN(Output), ++ValNum) {
tree Operand = TREE_VALUE(Output);
tree type = TREE_TYPE(Operand);
-
+
// Parse the output constraint.
const char *Constraint = Constraints[ValNum];
bool IsInOut, AllowsReg, AllowsMem;
@@ -4344,7 +4344,7 @@
if (NumChoices>1)
FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs);
return 0;
- }
+ }
assert(Constraint[0] == '=' && "Not an output constraint?");
// Output constraints must be addressable if they aren't simple register
@@ -4383,11 +4383,11 @@
} else {
SimplifiedConstraint = CanonicalizeConstraint(Constraint+1);
}
-
+
LValue Dest = EmitLV(Operand);
const Type *DestValTy =
cast<PointerType>(Dest.Ptr->getType())->getElementType();
-
+
assert(!Dest.isBitfield() && "Cannot assign into a bitfield!");
if (!AllowsMem && DestValTy->isSingleValueType()) {// Reg dest -> asm return
StoreCallResultAddrs.push_back(Dest.Ptr);
@@ -4402,12 +4402,12 @@
CallArgTypes.push_back(Dest.Ptr->getType());
}
}
-
+
// Process inputs.
for (tree Input = ASM_INPUTS(exp); Input; Input = TREE_CHAIN(Input),++ValNum){
tree Val = TREE_VALUE(Input);
tree type = TREE_TYPE(Val);
-
+
const char *Constraint = Constraints[ValNum];
bool AllowsReg, AllowsMem;
@@ -4417,7 +4417,7 @@
if (NumChoices>1)
FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs);
return 0;
- }
+ }
bool isIndirect = false;
if (AllowsReg || !AllowsMem) { // Register operand.
const Type *LLVMTy = ConvertType(type);
@@ -4435,7 +4435,7 @@
} else {
LValue LV = EmitLV(Val);
assert(!LV.isBitfield() && "Inline asm can't have bitfield operand");
-
+
// Structs and unions are permitted here, as long as they're the
// same size as a register.
uint64_t TySize = TD.getTypeSizeInBits(LLVMTy);
@@ -4485,7 +4485,7 @@
Op = CastToAnyType(Op, !TYPE_UNSIGNED(type),
OTy, CallResultIsSigned[Match]);
if (BYTES_BIG_ENDIAN) {
- Constant *ShAmt = ConstantInt::get(Op->getType(),
+ Constant *ShAmt = ConstantInt::get(Op->getType(),
OTyBits-OpTyBits);
Op = Builder.CreateLShr(Op, ShAmt);
}
@@ -4493,7 +4493,7 @@
}
}
}
-
+
CallOps.push_back(Op);
CallArgTypes.push_back(OpTy);
} else { // Memory operand.
@@ -4504,11 +4504,11 @@
CallOps.push_back(Src.Ptr);
CallArgTypes.push_back(Src.Ptr->getType());
}
-
+
ConstraintStr += ',';
if (isIndirect)
ConstraintStr += '*';
-
+
// If this output register is pinned to a machine register, use that machine
// register instead of the specified constraint.
if (TREE_CODE(Val) == VAR_DECL && DECL_HARD_REGISTER(Val)) {
@@ -4527,13 +4527,13 @@
std::string Simplified = CanonicalizeConstraint(Constraint);
ConstraintStr += Simplified;
}
-
+
// ASM_USES contains info about certain hard regs which are used as inputs.
// gcc represents the xH registers on x86 this way because of deficiencies
// in the way gcc can represent registers internally. llvm-gcc can represent
// these as normal inputs, so we aren't using ASM_USES.
assert(ASM_USES(exp)==0);
-
+
// Process clobbers.
// Some targets automatically clobber registers across an asm.
@@ -4542,11 +4542,11 @@
for (; Clobbers; Clobbers = TREE_CHAIN(Clobbers)) {
const char *RegName = TREE_STRING_POINTER(TREE_VALUE(Clobbers));
int RegCode = decode_reg_name(RegName);
-
+
switch (RegCode) {
case -1: // Nothing specified?
case -2: // Invalid.
- error("%Hunknown register name %qs in %<asm%>", &EXPR_LOCATION(exp),
+ error("%Hunknown register name %qs in %<asm%>", &EXPR_LOCATION(exp),
RegName);
if (NumChoices>1)
FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs);
@@ -4565,25 +4565,25 @@
break;
}
}
-
+
const Type *CallResultType;
switch (CallResultTypes.size()) {
case 0: CallResultType = Type::getVoidTy(Context); break;
case 1: CallResultType = CallResultTypes[0]; break;
- default:
+ default:
std::vector<const Type*> TmpVec(CallResultTypes.begin(),
CallResultTypes.end());
CallResultType = StructType::get(Context, TmpVec);
break;
}
-
- const FunctionType *FTy =
+
+ const FunctionType *FTy =
FunctionType::get(CallResultType, CallArgTypes, false);
-
+
// Remove the leading comma if we have operands.
if (!ConstraintStr.empty())
ConstraintStr.erase(ConstraintStr.begin());
-
+
// Make sure we're created a valid inline asm expression.
if (!InlineAsm::Verify(FTy, ConstraintStr)) {
error("%HInvalid or unsupported inline assembly!", &EXPR_LOCATION(exp));
@@ -4591,9 +4591,9 @@
FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs);
return 0;
}
-
+
Value *Asm = InlineAsm::get(FTy, NewAsmStr, ConstraintStr,
- ASM_VOLATILE_P(exp) || !ASM_OUTPUTS(exp));
+ ASM_VOLATILE_P(exp) || !ASM_OUTPUTS(exp));
CallInst *CV = Builder.CreateCall(Asm, CallOps.begin(), CallOps.end(),
CallResultTypes.empty() ? "" : "asmtmp");
CV->setDoesNotThrow();
@@ -4607,13 +4607,13 @@
Builder.CreateStore(ValI, StoreCallResultAddrs[i]);
}
}
-
+
// Give the backend a chance to upgrade the inline asm to LLVM code. This
// handles some common cases that LLVM has intrinsics for, e.g. x86 bswap ->
// llvm.bswap.
if (const TargetLowering *TLI = TheTarget->getTargetLowering())
TLI->ExpandInlineAsm(CV);
-
+
if (NumChoices>1)
FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs);
return 0;
@@ -4629,7 +4629,7 @@
bool AllConstants = true;
for (unsigned i = 0, e = Ops.size(); i != e && AllConstants; ++i)
AllConstants &= isa<Constant>(Ops[i]);
-
+
// If this is a constant vector, create a ConstantVector.
if (AllConstants) {
std::vector<Constant*> CstOps;
@@ -4637,15 +4637,15 @@
CstOps.push_back(cast<Constant>(Ops[i]));
return ConstantVector::get(CstOps);
}
-
+
// Otherwise, insertelement the values to build the vector.
- Value *Result =
+ Value *Result =
UndefValue::get(VectorType::get(Ops[0]->getType(), Ops.size()));
-
+
for (unsigned i = 0, e = Ops.size(); i != e; ++i)
- Result = Builder.CreateInsertElement(Result, Ops[i],
+ Result = Builder.CreateInsertElement(Result, Ops[i],
ConstantInt::get(Type::getInt32Ty(Context), i));
-
+
return Result;
}
@@ -4656,12 +4656,12 @@
std::vector<Value*> Ops;
va_list VA;
va_start(VA, Elt);
-
+
Ops.push_back(Elt);
while (Value *Arg = va_arg(VA, Value *))
Ops.push_back(Arg);
va_end(VA);
-
+
return BuildVector(Ops);
}
@@ -4673,7 +4673,7 @@
/// Undef values may be specified by passing in -1 as the result value.
///
Value *TreeToLLVM::BuildVectorShuffle(Value *InVec1, Value *InVec2, ...) {
- assert(isa<VectorType>(InVec1->getType()) &&
+ assert(isa<VectorType>(InVec1->getType()) &&
InVec1->getType() == InVec2->getType() && "Invalid shuffle!");
unsigned NumElements = cast<VectorType>(InVec1->getType())->getNumElements();
@@ -4693,7 +4693,7 @@
va_end(VA);
// Turn this into the appropriate shuffle operation.
- return Builder.CreateShuffleVector(InVec1, InVec2,
+ return Builder.CreateShuffleVector(InVec1, InVec2,
ConstantVector::get(Idxs));
}
@@ -4725,7 +4725,7 @@
Operands.push_back(Emit(OpVal, NULL));
}
}
-
+
unsigned FnCode = DECL_FUNCTION_CODE(fndecl);
return LLVM_TARGET_INTRINSIC_LOWER(exp, FnCode, DestLoc, Result, ResultType,
Operands);
@@ -4771,7 +4771,7 @@
// The gcc builtins are also full memory barriers.
// FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
EmitMemoryBarrier(true, true, true, true);
- Value *Result =
+ Value *Result =
Builder.CreateCall(Intrinsic::getDeclaration(TheModule, id,
Ty, 2),
C, C + 2);
@@ -4799,16 +4799,16 @@
// FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
EmitMemoryBarrier(true, true, true, true);
- Value *Result =
- Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
- Intrinsic::atomic_cmp_swap,
+ Value *Result =
+ Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
+ Intrinsic::atomic_cmp_swap,
Ty, 2),
C, C + 3);
-
+
// The gcc builtins are also full memory barriers.
// FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
EmitMemoryBarrier(true, true, true, true);
-
+
if (isBool)
Result = CastToUIntType(Builder.CreateICmpEQ(Result, C[1]),
ConvertType(boolean_type_node));
@@ -4826,7 +4826,7 @@
unsigned FnCode = DECL_FUNCTION_CODE(fndecl);
if (TargetBuiltinCache.size() <= FnCode)
TargetBuiltinCache.resize(FnCode+1);
-
+
// If we haven't converted this intrinsic over yet, do so now.
if (TargetBuiltinCache[FnCode] == 0) {
const char *TargetPrefix = "";
@@ -4836,12 +4836,12 @@
// If this builtin directly corresponds to an LLVM intrinsic, get the
// IntrinsicID now.
const char *BuiltinName = IDENTIFIER_POINTER(DECL_NAME(fndecl));
- Intrinsic::ID IntrinsicID =
+ Intrinsic::ID IntrinsicID =
Intrinsic::getIntrinsicForGCCBuiltin(TargetPrefix, BuiltinName);
if (IntrinsicID == Intrinsic::not_intrinsic) {
if (EmitFrontendExpandedBuiltinCall(exp, fndecl, DestLoc, Result))
return true;
-
+
error("%Hunsupported target builtin %<%s%> used", &EXPR_LOCATION(exp),
BuiltinName);
const Type *ResTy = ConvertType(TREE_TYPE(exp));
@@ -4849,9 +4849,9 @@
Result = UndefValue::get(ResTy);
return true;
}
-
+
// Finally, map the intrinsic ID back to a name.
- TargetBuiltinCache[FnCode] =
+ TargetBuiltinCache[FnCode] =
Intrinsic::getDeclaration(TheModule, IntrinsicID);
}
@@ -4937,13 +4937,13 @@
return true;
}
// Unary bit counting intrinsics.
- // NOTE: do not merge these case statements. That will cause the memoized
+ // NOTE: do not merge these case statements. That will cause the memoized
// Function* to be incorrectly shared across the different typed functions.
case BUILT_IN_CLZ: // These GCC builtins always return int.
case BUILT_IN_CLZL:
case BUILT_IN_CLZLL: {
Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
- EmitBuiltinUnaryOp(Amt, Result, Intrinsic::ctlz);
+ EmitBuiltinUnaryOp(Amt, Result, Intrinsic::ctlz);
const Type *DestTy = ConvertType(TREE_TYPE(exp));
Result = Builder.CreateIntCast(Result, DestTy, "cast");
return true;
@@ -4961,8 +4961,8 @@
case BUILT_IN_PARITYL:
case BUILT_IN_PARITY: {
Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
- EmitBuiltinUnaryOp(Amt, Result, Intrinsic::ctpop);
- Result = Builder.CreateBinOp(Instruction::And, Result,
+ EmitBuiltinUnaryOp(Amt, Result, Intrinsic::ctpop);
+ Result = Builder.CreateBinOp(Instruction::And, Result,
ConstantInt::get(Result->getType(), 1));
return true;
}
@@ -4970,7 +4970,7 @@
case BUILT_IN_POPCOUNTL:
case BUILT_IN_POPCOUNTLL: {
Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
- EmitBuiltinUnaryOp(Amt, Result, Intrinsic::ctpop);
+ EmitBuiltinUnaryOp(Amt, Result, Intrinsic::ctpop);
const Type *DestTy = ConvertType(TREE_TYPE(exp));
Result = Builder.CreateIntCast(Result, DestTy, "cast");
return true;
@@ -4978,20 +4978,20 @@
case BUILT_IN_BSWAP32:
case BUILT_IN_BSWAP64: {
Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
- EmitBuiltinUnaryOp(Amt, Result, Intrinsic::bswap);
+ EmitBuiltinUnaryOp(Amt, Result, Intrinsic::bswap);
const Type *DestTy = ConvertType(TREE_TYPE(exp));
Result = Builder.CreateIntCast(Result, DestTy, "cast");
return true;
}
-
- case BUILT_IN_SQRT:
+
+ case BUILT_IN_SQRT:
case BUILT_IN_SQRTF:
case BUILT_IN_SQRTL:
// If errno math has been disabled, expand these to llvm.sqrt calls.
if (!flag_errno_math) {
Result = EmitBuiltinSQRT(exp);
Result = CastToFPType(Result, ConvertType(TREE_TYPE(exp)));
- return true;
+ return true;
}
break;
case BUILT_IN_POWI:
@@ -5032,7 +5032,7 @@
break;
case BUILT_IN_LOG10:
case BUILT_IN_LOG10F:
- case BUILT_IN_LOG10L:
+ case BUILT_IN_LOG10L:
// If errno math has been disabled, expand these to llvm.log10 calls.
if (!flag_errno_math) {
Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
@@ -5069,12 +5069,12 @@
// The argument and return type of cttz should match the argument type of
// the ffs, but should ignore the return type of ffs.
Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
- EmitBuiltinUnaryOp(Amt, Result, Intrinsic::cttz);
+ EmitBuiltinUnaryOp(Amt, Result, Intrinsic::cttz);
Result = Builder.CreateAdd(Result,
ConstantInt::get(Result->getType(), 1));
Result = CastToUIntType(Result, ConvertType(TREE_TYPE(exp)));
Value *Cond =
- Builder.CreateICmpEQ(Amt,
+ Builder.CreateICmpEQ(Amt,
Constant::getNullValue(Amt->getType()));
Result = Builder.CreateSelect(Cond,
Constant::getNullValue(Result->getType()),
@@ -5094,45 +5094,45 @@
Builder.CreateUnreachable();
EmitBlock(BasicBlock::Create(Context, ""));
return true;
-
+
// Convert annotation built-in to llvm.annotation intrinsic.
case BUILT_IN_ANNOTATION: {
-
+
// Get file and line number
location_t locus = EXPR_LOCATION (exp);
Constant *lineNo = ConstantInt::get(Type::getInt32Ty(Context), locus.line);
Constant *file = ConvertMetadataStringToGV(locus.file);
const Type *SBP= PointerType::getUnqual(Type::getInt8Ty(Context));
file = Builder.getFolder().CreateBitCast(file, SBP);
-
+
// Get arguments.
tree arglist = TREE_OPERAND(exp, 1);
Value *ExprVal = Emit(TREE_VALUE(arglist), 0);
const Type *Ty = ExprVal->getType();
Value *StrVal = Emit(TREE_VALUE(TREE_CHAIN(arglist)), 0);
-
+
SmallVector<Value *, 4> Args;
Args.push_back(ExprVal);
Args.push_back(StrVal);
Args.push_back(file);
Args.push_back(lineNo);
-
+
assert(Ty && "llvm.annotation arg type may not be null");
- Result = Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
+ Result = Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
Intrinsic::annotation,
- &Ty,
+ &Ty,
1),
Args.begin(), Args.end());
return true;
}
-
+
case BUILT_IN_SYNCHRONIZE: {
// We assume like gcc appears to, that this only applies to cached memory.
Value* C[5];
C[0] = C[1] = C[2] = C[3] = ConstantInt::get(Type::getInt1Ty(Context), 1);
C[4] = ConstantInt::get(Type::getInt1Ty(Context), 0);
-
- Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
+
+ Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
Intrinsic::memory_barrier),
C, C + 5);
return true;
@@ -5153,20 +5153,20 @@
}
case BUILT_IN_BOOL_COMPARE_AND_SWAP_2: {
Result = BuildCmpAndSwapAtomicBuiltin(exp, short_unsigned_type_node, true);
- return true;
+ return true;
}
case BUILT_IN_BOOL_COMPARE_AND_SWAP_4: {
Result = BuildCmpAndSwapAtomicBuiltin(exp, unsigned_type_node, true);
- return true;
+ return true;
}
case BUILT_IN_BOOL_COMPARE_AND_SWAP_8: {
#if defined(TARGET_POWERPC)
if (!TARGET_64BIT)
return false;
#endif
- Result = BuildCmpAndSwapAtomicBuiltin(exp, long_long_unsigned_type_node,
+ Result = BuildCmpAndSwapAtomicBuiltin(exp, long_long_unsigned_type_node,
true);
- return true;
+ return true;
}
case BUILT_IN_VAL_COMPARE_AND_SWAP_8:
@@ -5179,7 +5179,7 @@
case BUILT_IN_VAL_COMPARE_AND_SWAP_4: {
tree type = TREE_TYPE(exp);
Result = BuildCmpAndSwapAtomicBuiltin(exp, type, false);
- return true;
+ return true;
}
case BUILT_IN_FETCH_AND_ADD_8:
#if defined(TARGET_POWERPC)
@@ -5258,7 +5258,7 @@
Result = BuildBinaryAtomicBuiltin(exp, Intrinsic::atomic_swap);
return true;
}
-
+
case BUILT_IN_ADD_AND_FETCH_8:
#if defined(TARGET_POWERPC)
if (!TARGET_64BIT)
@@ -5278,14 +5278,14 @@
Ty[1] = PointerType::getUnqual(ResultTy);
C[0] = Builder.CreateBitCast(C[0], Ty[1]);
C[1] = Builder.CreateIntCast(C[1], Ty[0], "cast");
-
+
// The gcc builtins are also full memory barriers.
// FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
EmitMemoryBarrier(true, true, true, true);
-
- Result =
- Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
- Intrinsic::atomic_load_add,
+
+ Result =
+ Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
+ Intrinsic::atomic_load_add,
Ty, 2),
C, C + 2);
@@ -5316,14 +5316,14 @@
Ty[1] = PointerType::getUnqual(ResultTy);
C[0] = Builder.CreateBitCast(C[0], Ty[1]);
C[1] = Builder.CreateIntCast(C[1], Ty[0], "cast");
-
+
// The gcc builtins are also full memory barriers.
// FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
EmitMemoryBarrier(true, true, true, true);
-
- Result =
- Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
- Intrinsic::atomic_load_sub,
+
+ Result =
+ Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
+ Intrinsic::atomic_load_sub,
Ty, 2),
C, C + 2);
@@ -5354,17 +5354,17 @@
Ty[1] = PointerType::getUnqual(ResultTy);
C[0] = Builder.CreateBitCast(C[0], Ty[1]);
C[1] = Builder.CreateIntCast(C[1], Ty[0], "cast");
-
+
// The gcc builtins are also full memory barriers.
// FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
EmitMemoryBarrier(true, true, true, true);
-
- Result =
- Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
- Intrinsic::atomic_load_or,
+
+ Result =
+ Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
+ Intrinsic::atomic_load_or,
Ty, 2),
C, C + 2);
-
+
// The gcc builtins are also full memory barriers.
// FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
EmitMemoryBarrier(true, true, true, true);
@@ -5392,13 +5392,13 @@
Ty[1] = PointerType::getUnqual(ResultTy);
C[0] = Builder.CreateBitCast(C[0], Ty[1]);
C[1] = Builder.CreateIntCast(C[1], Ty[0], "cast");
-
+
// The gcc builtins are also full memory barriers.
// FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
EmitMemoryBarrier(true, true, true, true);
-
- Result =
- Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
+
+ Result =
+ Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
Intrinsic::atomic_load_and,
Ty, 2),
C, C + 2);
@@ -5430,21 +5430,21 @@
Ty[1] = PointerType::getUnqual(ResultTy);
C[0] = Builder.CreateBitCast(C[0], Ty[1]);
C[1] = Builder.CreateIntCast(C[1], Ty[0], "cast");
-
+
// The gcc builtins are also full memory barriers.
// FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
EmitMemoryBarrier(true, true, true, true);
-
- Result =
- Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
- Intrinsic::atomic_load_xor,
+
+ Result =
+ Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
+ Intrinsic::atomic_load_xor,
Ty, 2),
C, C + 2);
-
+
// The gcc builtins are also full memory barriers.
// FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
EmitMemoryBarrier(true, true, true, true);
-
+
Result = Builder.CreateXor(Result, C[1]);
Result = Builder.CreateIntToPtr(Result, ResultTy);
return true;
@@ -5468,21 +5468,21 @@
Ty[1] = PointerType::getUnqual(ResultTy);
C[0] = Builder.CreateBitCast(C[0], Ty[1]);
C[1] = Builder.CreateIntCast(C[1], Ty[0], "cast");
-
+
// The gcc builtins are also full memory barriers.
// FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
EmitMemoryBarrier(true, true, true, true);
-
- Result =
- Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
- Intrinsic::atomic_load_nand,
+
+ Result =
+ Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
+ Intrinsic::atomic_load_nand,
Ty, 2),
C, C + 2);
-
+
// The gcc builtins are also full memory barriers.
// FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
EmitMemoryBarrier(true, true, true, true);
-
+
Result = Builder.CreateAnd(Builder.CreateNot(Result), C[1]);
Result = Builder.CreateIntToPtr(Result, ResultTy);
return true;
@@ -5514,7 +5514,7 @@
tree arglist = TREE_OPERAND(exp, 1);
tree t1 = build1 (INDIRECT_REF, type, TREE_VALUE (arglist));
TREE_THIS_VOLATILE(t1) = 1;
- tree t = build2 (MODIFY_EXPR, type, t1,
+ tree t = build2 (MODIFY_EXPR, type, t1,
build_int_cst (type, (HOST_WIDE_INT)0));
EmitMODIFY_EXPR(t, 0);
Result = 0;
@@ -5566,7 +5566,7 @@
bool TreeToLLVM::EmitBuiltinUnaryOp(Value *InVal, Value *&Result,
Intrinsic::ID Id) {
// The intrinsic might be overloaded in which case the argument is of
- // varying type. Make sure that we specify the actual type for "iAny"
+ // varying type. Make sure that we specify the actual type for "iAny"
// by passing it as the 3rd and 4th parameters. This isn't needed for
// most intrinsics, but is needed for ctpop, cttz, ctlz.
const Type *Ty = InVal->getType();
@@ -5578,8 +5578,8 @@
Value *TreeToLLVM::EmitBuiltinSQRT(tree exp) {
Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
const Type* Ty = Amt->getType();
-
- return Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
+
+ return Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
Intrinsic::sqrt, &Ty, 1),
Amt);
}
@@ -5597,7 +5597,7 @@
SmallVector<Value *,2> Args;
Args.push_back(Val);
Args.push_back(Pow);
- return Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
+ return Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
Intrinsic::powi, &Ty, 1),
Args.begin(), Args.end());
}
@@ -5614,7 +5614,7 @@
SmallVector<Value *,2> Args;
Args.push_back(Val);
Args.push_back(Pow);
- return Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
+ return Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
Intrinsic::pow, &Ty, 1),
Args.begin(), Args.end());
}
@@ -5629,7 +5629,7 @@
Value *Amt = Emit(TREE_VALUE(arglist), 0);
bool AmtIsSigned = !TYPE_UNSIGNED(TREE_TYPE(TREE_VALUE(arglist)));
bool ExpIsSigned = !TYPE_UNSIGNED(TREE_TYPE(exp));
- Result = CastToAnyType(Amt, AmtIsSigned, ConvertType(TREE_TYPE(exp)),
+ Result = CastToAnyType(Amt, AmtIsSigned, ConvertType(TREE_TYPE(exp)),
ExpIsSigned);
return true;
}
@@ -5662,17 +5662,17 @@
return true;
}
-/// EmitBuiltinMemCopy - Emit an llvm.memcpy or llvm.memmove intrinsic,
+/// EmitBuiltinMemCopy - Emit an llvm.memcpy or llvm.memmove intrinsic,
/// depending on the value of isMemMove.
bool TreeToLLVM::EmitBuiltinMemCopy(tree exp, Value *&Result, bool isMemMove,
bool SizeCheck) {
tree arglist = TREE_OPERAND(exp, 1);
if (SizeCheck) {
- if (!validate_arglist(arglist, POINTER_TYPE, POINTER_TYPE,
+ if (!validate_arglist(arglist, POINTER_TYPE, POINTER_TYPE,
INTEGER_TYPE, INTEGER_TYPE, VOID_TYPE))
return false;
} else {
- if (!validate_arglist(arglist, POINTER_TYPE, POINTER_TYPE,
+ if (!validate_arglist(arglist, POINTER_TYPE, POINTER_TYPE,
INTEGER_TYPE, VOID_TYPE))
return false;
}
@@ -5701,11 +5701,11 @@
bool TreeToLLVM::EmitBuiltinMemSet(tree exp, Value *&Result, bool SizeCheck) {
tree arglist = TREE_OPERAND(exp, 1);
if (SizeCheck) {
- if (!validate_arglist(arglist, POINTER_TYPE, INTEGER_TYPE,
+ if (!validate_arglist(arglist, POINTER_TYPE, INTEGER_TYPE,
INTEGER_TYPE, INTEGER_TYPE, VOID_TYPE))
return false;
} else {
- if (!validate_arglist(arglist, POINTER_TYPE, INTEGER_TYPE,
+ if (!validate_arglist(arglist, POINTER_TYPE, INTEGER_TYPE,
INTEGER_TYPE, VOID_TYPE))
return false;
}
@@ -5749,7 +5749,7 @@
Value *Ptr = Emit(TREE_VALUE(arglist), 0);
Value *ReadWrite = 0;
Value *Locality = 0;
-
+
if (TREE_CHAIN(arglist)) { // Args 1/2 are optional
ReadWrite = Emit(TREE_VALUE(TREE_CHAIN(arglist)), 0);
if (!isa<ConstantInt>(ReadWrite)) {
@@ -5763,7 +5763,7 @@
ReadWrite = Builder.getFolder().CreateIntCast(cast<Constant>(ReadWrite),
Type::getInt32Ty(Context), false);
}
-
+
if (TREE_CHAIN(TREE_CHAIN(arglist))) {
Locality = Emit(TREE_VALUE(TREE_CHAIN(TREE_CHAIN(arglist))), 0);
if (!isa<ConstantInt>(Locality)) {
@@ -5778,15 +5778,15 @@
}
}
}
-
+
// Default to highly local read.
if (ReadWrite == 0)
ReadWrite = Constant::getNullValue(Type::getInt32Ty(Context));
if (Locality == 0)
Locality = ConstantInt::get(Type::getInt32Ty(Context), 3);
-
+
Ptr = BitCastToType(Ptr, PointerType::getUnqual(Type::getInt8Ty(Context)));
-
+
Value *Ops[3] = { Ptr, ReadWrite, Locality };
Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::prefetch),
Ops, Ops+3);
@@ -5799,7 +5799,7 @@
tree arglist = TREE_OPERAND(exp, 1);
if (!validate_arglist(arglist, INTEGER_TYPE, VOID_TYPE))
return false;
-
+
ConstantInt *Level = dyn_cast<ConstantInt>(Emit(TREE_VALUE(arglist), 0));
if (!Level) {
if (isFrame)
@@ -5808,7 +5808,7 @@
error("invalid argument to %<__builtin_return_address%>");
return false;
}
-
+
Intrinsic::ID IID =
!isFrame ? Intrinsic::returnaddress : Intrinsic::frameaddress;
Result = Builder.CreateCall(Intrinsic::getDeclaration(TheModule, IID), Level);
@@ -5827,7 +5827,7 @@
// offset are defined. This seems to be needed for: ARM, MIPS, Sparc.
// Unfortunately, these constants are defined as RTL expressions and
// should be handled separately.
-
+
Result = BitCastToType(Ptr, PointerType::getUnqual(Type::getInt8Ty(Context)));
return true;
@@ -5843,7 +5843,7 @@
// Result = Ptr - RETURN_ADDR_OFFSET, if offset is defined. This seems to be
// needed for: MIPS, Sparc. Unfortunately, these constants are defined
// as RTL expressions and should be handled separately.
-
+
Result = BitCastToType(Ptr, PointerType::getUnqual(Type::getInt8Ty(Context)));
return true;
@@ -5853,7 +5853,7 @@
tree arglist = TREE_OPERAND(exp, 1);
if (!validate_arglist(arglist, VOID_TYPE))
return false;
-
+
Result = Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
Intrinsic::stacksave));
return true;
@@ -6041,7 +6041,7 @@
tree arglist = TREE_OPERAND(exp, 1);
if (!validate_arglist(arglist, POINTER_TYPE, VOID_TYPE))
return false;
-
+
Value *Ptr = Emit(TREE_VALUE(arglist), 0);
Ptr = BitCastToType(Ptr, PointerType::getUnqual(Type::getInt8Ty(Context)));
@@ -6075,22 +6075,22 @@
bool TreeToLLVM::EmitBuiltinVAStart(tree exp) {
tree arglist = TREE_OPERAND(exp, 1);
tree fntype = TREE_TYPE(current_function_decl);
-
+
if (TYPE_ARG_TYPES(fntype) == 0 ||
(TREE_VALUE(tree_last(TYPE_ARG_TYPES(fntype))) == void_type_node)) {
error("`va_start' used in function with fixed args");
return true;
}
-
+
tree last_parm = tree_last(DECL_ARGUMENTS(current_function_decl));
tree chain = TREE_CHAIN(arglist);
// Check for errors.
if (fold_builtin_next_arg (chain))
return true;
-
+
tree arg = TREE_VALUE(chain);
-
+
Value *ArgVal = Emit(TREE_VALUE(arglist), 0);
Constant *llvm_va_start_fn = Intrinsic::getDeclaration(TheModule,
@@ -6113,7 +6113,7 @@
bool TreeToLLVM::EmitBuiltinVACopy(tree exp) {
tree Arg1T = TREE_VALUE(TREE_OPERAND(exp, 1));
tree Arg2T = TREE_VALUE(TREE_CHAIN(TREE_OPERAND(exp, 1)));
-
+
Value *Arg1 = Emit(Arg1T, 0); // Emit the address of the destination.
// The second arg of llvm.va_copy is a pointer to a valist.
Value *Arg2;
@@ -6294,7 +6294,7 @@
DSTi = Builder.CreateICmpEQ(LHSi, RHSi, "tmpi");
}
return Builder.CreateAnd(DSTr, DSTi);
- case NE_EXPR: // (a+ib) != (c+id) = (a != c) | (b != d)
+ case NE_EXPR: // (a+ib) != (c+id) = (a != c) | (b != d)
if (LHSr->getType()->isFloatingPoint()) {
DSTr = Builder.CreateFCmpUNE(LHSr, RHSr, "tmpr");
DSTi = Builder.CreateFCmpUNE(LHSi, RHSi, "tmpi");
@@ -6887,9 +6887,9 @@
const Type *Ty = ConvertType(type);
if (const VectorType *PTy = dyn_cast<VectorType>(Ty)) {
assert(DestLoc == 0 && "Dest location for packed value?");
-
+
std::vector<Value *> BuildVecOps;
-
+
// Insert zero initializers for any uninitialized values.
Constant *Zero = Constant::getNullValue(PTy->getElementType());
BuildVecOps.resize(cast<VectorType>(Ty)->getNumElements(), Zero);
@@ -6899,22 +6899,22 @@
tree purpose, value;
FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (exp), ix, purpose, value) {
if (!purpose) continue; // Not actually initialized?
-
+
unsigned FieldNo = TREE_INT_CST_LOW(purpose);
// Update the element.
if (FieldNo < BuildVecOps.size())
BuildVecOps[FieldNo] = Emit(value, 0);
}
-
+
return BuildVector(BuildVecOps);
}
assert(!Ty->isSingleValueType() && "Constructor for scalar type??");
-
+
// Start out with the value zero'd out.
EmitAggregateZero(*DestLoc, type);
-
+
VEC(constructor_elt, gc) *elt = CONSTRUCTOR_ELTS(exp);
switch (TREE_CODE(TREE_TYPE(exp))) {
case ARRAY_TYPE:
@@ -6944,7 +6944,7 @@
} else {
// Scalar value. Evaluate to a register, then do the store.
Value *V = Emit(tree_value, 0);
- Value *Ptr = BitCastToType(DestLoc->Ptr,
+ Value *Ptr = BitCastToType(DestLoc->Ptr,
PointerType::getUnqual(V->getType()));
StoreInst *St = Builder.CreateStore(V, Ptr, DestLoc->Volatile);
St->setAlignment(DestLoc->getAlignment());
@@ -6964,8 +6964,8 @@
"Isn't a constant!");
switch (TREE_CODE(exp)) {
case FDESC_EXPR: // Needed on itanium
- default:
- debug_tree(exp);
+ default:
+ debug_tree(exp);
assert(0 && "Unknown constant to convert!");
abort();
case INTEGER_CST: return ConvertINTEGER_CST(exp);
@@ -6979,7 +6979,7 @@
case MINUS_EXPR: return ConvertBinOp_CST(exp);
case CONSTRUCTOR: return ConvertCONSTRUCTOR(exp);
case VIEW_CONVERT_EXPR: return Convert(TREE_OPERAND(exp, 0));
- case ADDR_EXPR:
+ case ADDR_EXPR:
return TheFolder->CreateBitCast(EmitLV(TREE_OPERAND(exp, 0)),
ConvertType(TREE_TYPE(exp)));
}
@@ -6987,7 +6987,7 @@
Constant *TreeConstantToLLVM::ConvertINTEGER_CST(tree exp) {
const Type *Ty = ConvertType(TREE_TYPE(exp));
-
+
// Handle i128 specially.
if (const IntegerType *IT = dyn_cast<IntegerType>(Ty)) {
if (IT->getBitWidth() == 128) {
@@ -6998,12 +6998,12 @@
return ConstantInt::get(Context, APInt(128, 2, Bits));
}
}
-
+
// Build the value as a ulong constant, then constant fold it to the right
// type. This handles overflow and other things appropriately.
uint64_t IntValue = getINTEGER_CSTVal(exp);
ConstantInt *C = ConstantInt::get(Type::getInt64Ty(Context), IntValue);
- // The destination type can be a pointer, integer or floating point
+ // The destination type can be a pointer, integer or floating point
// so we need a generalized cast here
Instruction::CastOps opcode = CastInst::getCastOpcode(C, false, Ty,
!TYPE_UNSIGNED(TREE_TYPE(exp)));
@@ -7030,11 +7030,11 @@
// This, then, makes the conversion pretty simple. The tricky part is
// getting the byte ordering correct and make sure you don't print any
// more than 32 bits per integer on platforms with ints > 32 bits.
- //
- // We want to switch the words of UArr if host and target endianness
+ //
+ // We want to switch the words of UArr if host and target endianness
// do not match. FLOAT_WORDS_BIG_ENDIAN describes the target endianness.
// The host's used to be available in HOST_WORDS_BIG_ENDIAN, but the gcc
- // maintainers removed this in a fit of cleanliness between 4.0
+ // maintainers removed this in a fit of cleanliness between 4.0
// and 4.2. llvm::sys has a substitute.
UArr[0] = RealArr[0]; // Long -> int convert
@@ -7076,7 +7076,7 @@
std::vector<Constant*> Elts;
for (tree elt = TREE_VECTOR_CST_ELTS(exp); elt; elt = TREE_CHAIN(elt))
Elts.push_back(Convert(TREE_VALUE(elt)));
-
+
// The vector should be zero filled if insufficient elements are provided.
if (Elts.size() < TYPE_VECTOR_SUBPARTS(TREE_TYPE(exp))) {
tree EltType = TREE_TYPE(TREE_TYPE(exp));
@@ -7084,16 +7084,16 @@
while (Elts.size() < TYPE_VECTOR_SUBPARTS(TREE_TYPE(exp)))
Elts.push_back(Zero);
}
-
+
return ConstantVector::get(Elts);
}
Constant *TreeConstantToLLVM::ConvertSTRING_CST(tree exp) {
const ArrayType *StrTy = cast<ArrayType>(ConvertType(TREE_TYPE(exp)));
const Type *ElTy = StrTy->getElementType();
-
+
unsigned Len = (unsigned)TREE_STRING_LENGTH(exp);
-
+
std::vector<Constant*> Elts;
if (ElTy == Type::getInt8Ty(Context)) {
const unsigned char *InStr =(const unsigned char *)TREE_STRING_POINTER(exp);
@@ -7129,11 +7129,11 @@
} else {
assert(0 && "Unknown character type!");
}
-
+
unsigned LenInElts = Len /
TREE_INT_CST_LOW(TYPE_SIZE_UNIT(TREE_TYPE(TREE_TYPE(exp))));
unsigned ConstantSize = StrTy->getNumElements();
-
+
if (LenInElts != ConstantSize) {
// If this is a variable sized array type, set the length to LenInElts.
if (ConstantSize == 0) {
@@ -7143,7 +7143,7 @@
StrTy = ArrayType::get(ElTy, LenInElts);
}
}
-
+
if (ConstantSize < LenInElts) {
// Only some chars are being used, truncate the string: char X[2] = "foo";
Elts.resize(ConstantSize);
@@ -7169,11 +7169,11 @@
const Type *Ty = ConvertType(TREE_TYPE(exp));
bool EltIsSigned = !TYPE_UNSIGNED(TREE_TYPE(TREE_OPERAND(exp, 0)));
bool TyIsSigned = !TYPE_UNSIGNED(TREE_TYPE(exp));
-
+
// If this is a structure-to-structure cast, just return the uncasted value.
if (!Elt->getType()->isSingleValueType() || !Ty->isSingleValueType())
return Elt;
-
+
// Elt and Ty can be integer, float or pointer here: need generalized cast
Instruction::CastOps opcode = CastInst::getCastOpcode(Elt, EltIsSigned,
Ty, TyIsSigned);
@@ -7185,8 +7185,8 @@
bool EltIsSigned = !TYPE_UNSIGNED(TREE_TYPE(TREE_OPERAND(exp, 0)));
const Type *Ty = ConvertType(TREE_TYPE(exp));
bool TyIsSigned = !TYPE_UNSIGNED(TREE_TYPE(exp));
- Instruction::CastOps opcode = CastInst::getCastOpcode(Elt, EltIsSigned, Ty,
- TyIsSigned);
+ Instruction::CastOps opcode = CastInst::getCastOpcode(Elt, EltIsSigned, Ty,
+ TyIsSigned);
return TheFolder->CreateCast(opcode, Elt, Ty);
}
@@ -7210,7 +7210,7 @@
case PLUS_EXPR: Result = TheFolder->CreateAdd(LHS, RHS); break;
case MINUS_EXPR: Result = TheFolder->CreateSub(LHS, RHS); break;
}
-
+
const Type *Ty = ConvertType(TREE_TYPE(exp));
bool TyIsSigned = !TYPE_UNSIGNED(TREE_TYPE(exp));
opcode = CastInst::getCastOpcode(Result, LHSIsSigned, Ty, TyIsSigned);
@@ -7226,7 +7226,7 @@
return Constant::getNullValue(ConvertType(TREE_TYPE(exp)));
switch (TREE_CODE(TREE_TYPE(exp))) {
- default:
+ default:
debug_tree(exp);
assert(0 && "Unknown ctor!");
case VECTOR_TYPE:
@@ -7240,12 +7240,12 @@
Constant *TreeConstantToLLVM::ConvertArrayCONSTRUCTOR(tree exp) {
// Vectors are like arrays, but the domain is stored via an array
// type indirectly.
-
+
// If we have a lower bound for the range of the type, get it.
tree InitType = TREE_TYPE(exp);
tree min_element = size_zero_node;
std::vector<Constant*> ResultElts;
-
+
if (TREE_CODE(InitType) == VECTOR_TYPE) {
ResultElts.resize(TYPE_VECTOR_SUBPARTS(InitType));
} else {
@@ -7253,7 +7253,7 @@
tree Domain = TYPE_DOMAIN(InitType);
if (Domain && TYPE_MIN_VALUE(Domain))
min_element = fold_convert(sizetype, TYPE_MIN_VALUE(Domain));
-
+
if (Domain && TYPE_MAX_VALUE(Domain)) {
tree max_element = fold_convert(sizetype, TYPE_MAX_VALUE(Domain));
tree size = size_binop (MINUS_EXPR, max_element, min_element);
@@ -7272,11 +7272,11 @@
// Find and decode the constructor's value.
Constant *Val = Convert(elt_value);
SomeVal = Val;
-
+
// Get the index position of the element within the array. Note that this
// can be NULL_TREE, which means that it belongs in the next available slot.
tree index = elt_index;
-
+
// The first and last field to fill in, inclusive.
unsigned FieldOffset, FieldLastOffset;
if (index && TREE_CODE(index) == RANGE_EXPR) {
@@ -7300,7 +7300,7 @@
FieldOffset = NextFieldToFill;
FieldLastOffset = FieldOffset;
}
-
+
// Process all of the elements in the range.
for (--FieldOffset; FieldOffset != FieldLastOffset; ) {
++FieldOffset;
@@ -7311,17 +7311,17 @@
ResultElts.resize(FieldOffset+1);
ResultElts[FieldOffset] = Val;
}
-
+
NextFieldToFill = FieldOffset+1;
}
}
-
+
// Zero length array.
if (ResultElts.empty())
return ConstantArray::get(
cast<ArrayType>(ConvertType(TREE_TYPE(exp))), ResultElts);
assert(SomeVal && "If we had some initializer, we should have some value!");
-
+
// Do a post-pass over all of the elements. We're taking care of two things
// here:
// #1. If any elements did not have initializers specified, provide them
@@ -7338,12 +7338,12 @@
else if (ResultElts[i]->getType() != ElTy)
AllEltsSameType = false;
}
-
+
if (TREE_CODE(InitType) == VECTOR_TYPE) {
assert(AllEltsSameType && "Vector of heterogeneous element types?");
return ConstantVector::get(ResultElts);
}
-
+
if (AllEltsSameType)
return ConstantArray::get(
ArrayType::get(ElTy, ResultElts.size()), ResultElts);
@@ -7415,9 +7415,9 @@
const Type *PadTy = Type::getInt8Ty(Context);
if (AlignedEltOffs-EltOffs != 1)
PadTy = ArrayType::get(PadTy, AlignedEltOffs-EltOffs);
- ResultElts.insert(ResultElts.begin()+i,
+ ResultElts.insert(ResultElts.begin()+i,
Constant::getNullValue(PadTy));
-
+
// The padding is now element "i" and just bumped us up to "AlignedEltOffs".
EltOffs = AlignedEltOffs;
++e; // One extra element to scan.
@@ -7488,7 +7488,7 @@
ConvertToPacked();
assert(NextFieldByteStart*8 <= GCCFieldOffsetInBits &&
"Packing didn't fix the problem!");
-
+
// Recurse to add the field after converting to packed.
return AddFieldToRecordConstant(Val, GCCFieldOffsetInBits);
}
@@ -7506,7 +7506,7 @@
ResultElts.push_back(Constant::getNullValue(FillTy));
NextFieldByteStart = GCCFieldOffsetInBits/8;
-
+
// Recurse to add the field. This handles the case when the LLVM struct
// needs to be converted to packed after inserting tail padding.
return AddFieldToRecordConstant(Val, GCCFieldOffsetInBits);
@@ -7691,7 +7691,7 @@
FillTy = ArrayType::get(FillTy, GCCStructSize - NextFieldByteStart);
ResultElts.push_back(Constant::getNullValue(FillTy));
NextFieldByteStart = GCCStructSize;
-
+
// At this point, we know that our struct should have the right size.
// However, if the size of the struct is not a multiple of the largest
// element alignment, the rounding could bump up the struct more. In this
@@ -7747,7 +7747,7 @@
ConstantInt *ValC = cast<ConstantInt>(Val);
uint64_t FieldSizeInBits = getInt64(DECL_SIZE(Field), true);
uint64_t ValueSizeInBits = Val->getType()->getPrimitiveSizeInBits();
-
+
// G++ has various bugs handling {} initializers where it doesn't
// synthesize a zero node of the right type. Instead of figuring out G++,
// just hack around it by special casing zero and allowing it to be the
@@ -7757,7 +7757,7 @@
ValC = ConstantInt::get(Context, ValAsInt.zext(FieldSizeInBits));
ValueSizeInBits = FieldSizeInBits;
}
-
+
assert(ValueSizeInBits >= FieldSizeInBits &&
"disagreement between LLVM and GCC on bitfield size");
if (ValueSizeInBits != FieldSizeInBits) {
@@ -7779,7 +7779,7 @@
LayoutInfo.HandleTailPadding(getInt64(StructTypeSizeTree, true));
// Okay, we're done, return the computed elements.
- return ConstantStruct::get(Context, LayoutInfo.ResultElts,
+ return ConstantStruct::get(Context, LayoutInfo.ResultElts,
LayoutInfo.StructIsPacked);
}
@@ -7823,8 +7823,8 @@
Constant *LV;
switch (TREE_CODE(exp)) {
- default:
- debug_tree(exp);
+ default:
+ debug_tree(exp);
assert(0 && "Unknown constant lvalue to convert!");
abort();
case FUNCTION_DECL:
@@ -7853,11 +7853,11 @@
LV = Convert(TREE_OPERAND(exp, 0));
break;
case COMPOUND_LITERAL_EXPR: // FIXME: not gimple - defined by C front-end
- /* This used to read
+ /* This used to read
return EmitLV(COMPOUND_LITERAL_EXPR_DECL(exp));
- but gcc warns about that and there doesn't seem to be any way to stop it
+ but gcc warns about that and there doesn't seem to be any way to stop it
with casts or the like. The following is equivalent with no checking
- (since we know TREE_CODE(exp) is COMPOUND_LITERAL_EXPR the checking
+ (since we know TREE_CODE(exp) is COMPOUND_LITERAL_EXPR the checking
doesn't accomplish anything anyway). */
LV = EmitLV(DECL_EXPR_DECL (TREE_OPERAND (exp, 0)));
break;
@@ -7907,7 +7907,7 @@
// the type of the initializer. Correct for this now.
const Type *Ty = ConvertType(TREE_TYPE(exp));
if (Ty == Type::getVoidTy(Context)) Ty = Type::getInt8Ty(Context); // void* -> i8*.
-
+
return TheFolder->CreateBitCast(Val, Ty->getPointerTo());
}
@@ -7915,7 +7915,7 @@
Constant *TreeConstantToLLVM::EmitLV_LABEL_DECL(tree exp) {
assert(TheTreeToLLVM &&
"taking the address of a label while not compiling the function!");
-
+
// Figure out which function this is for, verify it's the one we're compiling.
if (DECL_CONTEXT(exp)) {
assert(TREE_CODE(DECL_CONTEXT(exp)) == FUNCTION_DECL &&
@@ -7923,7 +7923,7 @@
assert(TheTreeToLLVM->getFUNCTION_DECL() == DECL_CONTEXT(exp) &&
"Taking the address of a label that isn't in the current fn!?");
}
-
+
BasicBlock *BB = getLabelDeclBlock(exp);
Constant *C = TheTreeToLLVM->getIndirectGotoBlockNumber(BB);
return
@@ -7961,9 +7961,9 @@
if (Slot) return Slot;
SlotP = &Slot;
}
-
+
// Create a new string global.
- GlobalVariable *GV = new GlobalVariable(*TheModule, Init->getType(),
+ GlobalVariable *GV = new GlobalVariable(*TheModule, Init->getType(),
StringIsConstant,
GlobalVariable::PrivateLinkage, Init,
".str");
@@ -8001,7 +8001,7 @@
} else {
ArrayAddr = Convert(Array);
}
-
+
Constant *IndexVal = Convert(Index);
const Type *IntPtrTy = getTargetData().getIntPtrType(Context);
@@ -8019,17 +8019,17 @@
Constant *TreeConstantToLLVM::EmitLV_COMPONENT_REF(tree exp) {
Constant *StructAddrLV = EmitLV(TREE_OPERAND(exp, 0));
-
+
// Ensure that the struct type has been converted, so that the fielddecls
// are laid out.
const Type *StructTy = ConvertType(TREE_TYPE(TREE_OPERAND(exp, 0)));
-
+
tree FieldDecl = TREE_OPERAND(exp, 1);
-
+
StructAddrLV = TheFolder->CreateBitCast(StructAddrLV,
PointerType::getUnqual(StructTy));
const Type *FieldTy = ConvertType(getDeclaredType(FieldDecl));
-
+
// BitStart - This is the actual offset of the field from the start of the
// struct, in bits. For bitfields this may be on a non-byte boundary.
unsigned BitStart = getComponentRefOffsetInBits(exp);
@@ -8048,23 +8048,23 @@
ConstantInt::get(Type::getInt32Ty(Context), MemberIndex)
};
FieldPtr = TheFolder->CreateGetElementPtr(StructAddrLV, Ops+1, 2);
-
+
FieldPtr = ConstantFoldInstOperands(Instruction::GetElementPtr,
FieldPtr->getType(), Ops,
- 3, Context, &TD);
-
+ 3, Context, &TD);
+
// Now that we did an offset from the start of the struct, subtract off
// the offset from BitStart.
if (MemberIndex) {
const StructLayout *SL = TD.getStructLayout(cast<StructType>(StructTy));
BitStart -= SL->getElementOffset(MemberIndex) * 8;
}
-
+
} else {
Constant *Offset = Convert(field_offset);
Constant *Ptr = TheFolder->CreatePtrToInt(StructAddrLV, Offset->getType());
Ptr = TheFolder->CreateAdd(Ptr, Offset);
- FieldPtr = TheFolder->CreateIntToPtr(Ptr,
+ FieldPtr = TheFolder->CreateIntToPtr(Ptr,
PointerType::getUnqual(FieldTy));
}
More information about the llvm-commits
mailing list