llvm.org GIT mirror llvm / b8bce92
Back out r166591, not sure why this made it through since I cancelled the command. Bleh, sorry about this! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166596 91177308-0d34-0410-b5e6-96231b3b80d8 Micah Villmow 6 years ago
12 changed file(s) with 19 addition(s) and 50 deletion(s). Raw diff Collapse all Expand all
12671267 llvm::Value *unwindExceptionClass =
12681268 builder.CreateLoad(builder.CreateStructGEP(
12691269 builder.CreatePointerCast(unwindException,
1270 ourUnwindExceptionType->getPointerTo(0)),
1270 ourUnwindExceptionType->getPointerTo()),
12711271 0));
12721272
12731273 // Branch to the externalExceptionBlock if the exception is foreign or
388388 static PointerType *getInt32PtrTy(LLVMContext &C, unsigned AS = 0);
389389 static PointerType *getInt64PtrTy(LLVMContext &C, unsigned AS = 0);
390390
391 /// getPointerTo - Return a pointer to the current type for the given address space.
392 /// This is equivalent to PointerType::get(Foo, AddrSpace).
393 PointerType *getPointerTo(unsigned AddrSpace);
394
395 /// getPointerTo - Return a pointer to the current type for the address space
396 /// space of the passed in type.
397 PointerType *getPointerTo(const Type *Ty);
398
399 /// getPointerTo - Retrun a pointer to the current type.
400 PointerType *getPointerTo();
391 /// getPointerTo - Return a pointer to the current type. This is equivalent
392 /// to PointerType::get(Foo, AddrSpace).
393 PointerType *getPointerTo(unsigned AddrSpace = 0);
394
401395 private:
402396 /// isSizedDerivedType - Derived types like structures and arrays are sized
403397 /// iff all of the members of the type are sized as well. Since asking for
20672067 // Also pass the return address of the remainder.
20682068 SDValue FIPtr = DAG.CreateStackTemporary(RetVT);
20692069 Entry.Node = FIPtr;
2070 Entry.Ty = RetTy->getPointerTo(0);
2070 Entry.Ty = RetTy->getPointerTo();
20712071 Entry.isSExt = isSigned;
20722072 Entry.isZExt = !isSigned;
20732073 Args.push_back(Entry);
23192319
23202320 // Also pass the address of the overflow check.
23212321 Entry.Node = Temp;
2322 Entry.Ty = PtrTy->getPointerTo(0);
2322 Entry.Ty = PtrTy->getPointerTo();
23232323 Entry.isSExt = true;
23242324 Entry.isZExt = false;
23252325 Args.push_back(Entry);
585585 Type *Int32Ty = Type::getInt32Ty(*Ctx);
586586 Type *Int64Ty = Type::getInt64Ty(*Ctx);
587587 Type *Args[] = {
588 Int32Ty->getPointerTo(Int32Ty), // uint32_t *predecessor
589 Int64Ty->getPointerTo(Int64Ty)->getPointerTo(Int64Ty) // uint64_t **counters
588 Int32Ty->getPointerTo(), // uint32_t *predecessor
589 Int64Ty->getPointerTo()->getPointerTo() // uint64_t **counters
590590 };
591591 FunctionType *FTy = FunctionType::get(Type::getVoidTy(*Ctx), Args, false);
592592 return M->getOrInsertFunction("__llvm_gcov_indirect_counter_increment", FTy);
732732 Value *GEP = Builder.CreateGEP(Arg, ZExtPred);
733733 Value *Counter = Builder.CreateLoad(GEP, "counter");
734734 Cond = Builder.CreateICmpEQ(Counter,
735 Constant::getNullValue(
736 Int64Ty->getPointerTo(Counter->getType())));
735 Constant::getNullValue(Int64Ty->getPointerTo()));
737736 Builder.CreateCondBr(Cond, Exit, CounterEnd);
738737
739738 // ++*counter;
133133 // types.
134134 Type *GlobalDtorElems[2] = {
135135 Type::getInt32Ty(Mod->getContext()),
136 FunctionType::get(Type::getVoidTy(Mod->getContext()), false)
137 ->getPointerTo()
136 FunctionType::get(Type::getVoidTy(Mod->getContext()), false)->getPointerTo()
138137 };
139138 StructType *GlobalDtorElemTy =
140139 StructType::get(Mod->getContext(), GlobalDtorElems, false);
374374 const size_t ByteSize = 1 << Idx;
375375 const size_t BitSize = ByteSize * 8;
376376 Type *Ty = Type::getIntNTy(IRB.getContext(), BitSize);
377 Type *PtrTy = Ty->getPointerTo(Addr->getType());
377 Type *PtrTy = Ty->getPointerTo();
378378 Value *Args[] = {IRB.CreatePointerCast(Addr, PtrTy),
379379 createOrdering(&IRB, LI->getOrdering())};
380380 CallInst *C = CallInst::Create(TsanAtomicLoad[Idx],
389389 const size_t ByteSize = 1 << Idx;
390390 const size_t BitSize = ByteSize * 8;
391391 Type *Ty = Type::getIntNTy(IRB.getContext(), BitSize);
392 Type *PtrTy = Ty->getPointerTo(Addr->getType());
392 Type *PtrTy = Ty->getPointerTo();
393393 Value *Args[] = {IRB.CreatePointerCast(Addr, PtrTy),
394394 IRB.CreateIntCast(SI->getValueOperand(), Ty, false),
395395 createOrdering(&IRB, SI->getOrdering())};
27622762 : II.getRawDest()->getType();
27632763 if (!EmitMemCpy) {
27642764 if (IsVectorElement)
2765 OtherPtrTy = VecTy->getElementType()->getPointerTo(OtherPtrTy);
2765 OtherPtrTy = VecTy->getElementType()->getPointerTo();
27662766 else if (IntTy && !IsWholeAlloca)
2767 OtherPtrTy = SubIntTy->getPointerTo(OtherPtrTy);
2767 OtherPtrTy = SubIntTy->getPointerTo();
27682768 else
27692769 OtherPtrTy = NewAI.getType();
27702770 }
776776 GetElementPtrInst *Gep2 = cast(Gep->clone());
777777 Gep2->setOperand(NumOperands - 1, LastIndex);
778778 Ptr = Builder.Insert(Gep2);
779 Ptr = Builder.CreateBitCast(Ptr, StTy->getPointerTo(Ptr->getType()));
779 Ptr = Builder.CreateBitCast(Ptr, StTy->getPointerTo());
780780 Value *Val = getVectorValue(SI->getValueOperand());
781781 Builder.CreateStore(Val, Ptr)->setAlignment(Alignment);
782782 break;
805805 GetElementPtrInst *Gep2 = cast(Gep->clone());
806806 Gep2->setOperand(NumOperands - 1, LastIndex);
807807 Ptr = Builder.Insert(Gep2);
808 Ptr = Builder.CreateBitCast(Ptr, RetTy->getPointerTo(Ptr->getType()));
808 Ptr = Builder.CreateBitCast(Ptr, RetTy->getPointerTo());
809809 LI = Builder.CreateLoad(Ptr);
810810 LI->setAlignment(Alignment);
811811 // Use this vector value for all users of the load.
16721672 // Note that a non-inbounds gep is used, as null isn't within any object.
16731673 Type *AligningTy =
16741674 StructType::get(Type::getInt1Ty(Ty->getContext()), Ty, NULL);
1675 Constant *NullPtr = Constant::getNullValue(AligningTy->getPointerTo(Ty));
1675 Constant *NullPtr = Constant::getNullValue(AligningTy->getPointerTo());
16761676 Constant *Zero = ConstantInt::get(Type::getInt64Ty(Ty->getContext()), 0);
16771677 Constant *One = ConstantInt::get(Type::getInt32Ty(Ty->getContext()), 1);
16781678 Constant *Indices[2] = { Zero, One };
778778 return PointerType::get(this, addrs);
779779 }
780780
781 PointerType *Type::getPointerTo(const Type *Ty) {
782 unsigned AS = 0;
783 // For pointers, we return a new pointer based on the address space.
784 if (Ty->isPointerTy()) AS = Ty->getPointerAddressSpace();
785 // For vector of pointers, we return a new pointer based on the
786 // address space of the element pointer type.
787 if (Ty->isVectorTy())
788 AS = Ty->getVectorElementType()->getPointerAddressSpace();
789 // Otherwise return a pointer based on the default address space
790 // since we want a pointer to the current type without having
791 // a type that can give us the correct address space.
792 // An example of this occuring is that you want to get a pointer to
793 // all of the arguments in a function. However, the PointerType
794 // for a non-pointer type cannot be determined by the type, so
795 // the default value is used.
796 return getPointerTo(AS);
797 }
798
799 PointerType *Type::getPointerTo() {
800 return getPointerTo(this);
801 }
802
803781 bool PointerType::isValidElementType(Type *ElemTy) {
804782 return !ElemTy->isVoidTy() && !ElemTy->isLabelTy() &&
805783 !ElemTy->isMetadataTy();
433433 if (ArrayType *ATy = dyn_cast(GV.getType())) {
434434 StructType *STy = dyn_cast(ATy->getElementType());
435435 PointerType *FuncPtrTy =
436 FunctionType::get(Type::getVoidTy(*Context), false)
437 ->getPointerTo(GV.getType());
436 FunctionType::get(Type::getVoidTy(*Context), false)->getPointerTo();
438437 Assert1(STy && STy->getNumElements() == 2 &&
439438 STy->getTypeAtIndex(0u)->isIntegerTy(32) &&
440439 STy->getTypeAtIndex(1) == FuncPtrTy,