Lines Matching refs:StructTy
165 bool shouldIgnoreStructType(StructType *StructTy);
167 StructType *StructTy, SmallString<MaxStructCounterNameSize> &NameStr);
169 Module &M, const DataLayout &DL, StructType *StructTy,
179 bool insertCounterUpdate(Instruction *I, StructType *StructTy,
181 unsigned getFieldCounterIdx(StructType *StructTy) {
184 unsigned getArrayCounterIdx(StructType *StructTy) {
185 return StructTy->getNumElements();
187 unsigned getStructCounterSize(StructType *StructTy) {
191 return (StructTy->getNumElements()/*field*/ + 1/*array*/);
289 bool EfficiencySanitizer::shouldIgnoreStructType(StructType *StructTy) {
290 if (StructTy == nullptr || StructTy->isOpaque() /* no struct body */)
296 StructType *StructTy, SmallString<MaxStructCounterNameSize> &NameStr) {
299 if (StructTy->hasName())
300 NameStr += StructTy->getName();
308 Twine(StructTy->getNumElements()).toVector(NameStr);
310 for (int i = StructTy->getNumElements() - 1; i >= 0; --i) {
312 Twine(StructTy->getElementType(i)->getTypeID()).toVector(NameStr);
316 if (StructTy->isLiteral()) {
325 Module &M, const DataLayout &DL, StructType *StructTy,
331 auto *TypeNameArrayTy = ArrayType::get(Int8PtrTy, StructTy->getNumElements());
336 auto *OffsetArrayTy = ArrayType::get(Int32Ty, StructTy->getNumElements());
341 auto *SizeArrayTy = ArrayType::get(Int32Ty, StructTy->getNumElements());
345 for (unsigned i = 0; i < StructTy->getNumElements(); ++i) {
346 Type *Ty = StructTy->getElementType(i);
356 DL.getStructLayout(StructTy)->getElementOffset(i)));
406 for (auto &StructTy : Vec) {
407 if (shouldIgnoreStructType(StructTy)) {
415 createStructCounterName(StructTy, CounterNameStr);
424 getStructCounterSize(StructTy));
432 StructTyMap.insert(std::pair<Type *, GlobalVariable *>(StructTy, Counters));
438 createCacheFragAuxGV(M, DL, StructTy, TypeName, Offset, Size);
443 getFieldCounterIdx(StructTy));
447 getArrayCounterIdx(StructTy));
453 DL.getStructLayout(StructTy)->getSizeInBytes()),
454 ConstantInt::get(Int32Ty, StructTy->getNumElements()),
741 StructType *StructTy;
745 StructTy = cast<StructType>(SourceTy);
748 !shouldIgnoreStructType(StructTy) && StructTyMap.count(StructTy) != 0)
749 Res |= insertCounterUpdate(I, StructTy, getArrayCounterIdx(StructTy));
760 StructTy = dyn_cast<StructType>(ArrayTy->getElementType());
761 if (shouldIgnoreStructType(StructTy) || StructTyMap.count(StructTy) == 0)
764 CounterIdx = getArrayCounterIdx(StructTy);
766 StructTy = cast<StructType>(Ty);
767 if (shouldIgnoreStructType(StructTy) || StructTyMap.count(StructTy) == 0)
769 // Get the StructTy's subfield index.
772 Idx->getSExtValue() < StructTy->getNumElements());
773 CounterIdx = getFieldCounterIdx(StructTy) + Idx->getSExtValue();
775 Res |= insertCounterUpdate(I, StructTy, CounterIdx);
785 StructType *StructTy,
787 GlobalVariable *CounterArray = StructTyMap[StructTy];
801 ArrayType::get(IRB.getInt64Ty(), getStructCounterSize(StructTy)),