Lines Matching refs:StructTy
161 bool shouldIgnoreStructType(StructType *StructTy);
163 StructType *StructTy, SmallString<MaxStructCounterNameSize> &NameStr);
165 Module &M, const DataLayout &DL, StructType *StructTy,
175 bool insertCounterUpdate(Instruction *I, StructType *StructTy,
177 unsigned getFieldCounterIdx(StructType *StructTy) { in getFieldCounterIdx() argument
180 unsigned getArrayCounterIdx(StructType *StructTy) { in getArrayCounterIdx() argument
181 return StructTy->getNumElements(); in getArrayCounterIdx()
183 unsigned getStructCounterSize(StructType *StructTy) { in getStructCounterSize() argument
187 return (StructTy->getNumElements()/*field*/ + 1/*array*/); in getStructCounterSize()
286 bool EfficiencySanitizer::shouldIgnoreStructType(StructType *StructTy) { in shouldIgnoreStructType() argument
287 if (StructTy == nullptr || StructTy->isOpaque() /* no struct body */) in shouldIgnoreStructType()
293 StructType *StructTy, SmallString<MaxStructCounterNameSize> &NameStr) { in createStructCounterName() argument
296 if (StructTy->hasName()) in createStructCounterName()
297 NameStr += StructTy->getName(); in createStructCounterName()
305 Twine(StructTy->getNumElements()).toVector(NameStr); in createStructCounterName()
307 for (int i = StructTy->getNumElements() - 1; i >= 0; --i) { in createStructCounterName()
309 Twine(StructTy->getElementType(i)->getTypeID()).toVector(NameStr); in createStructCounterName()
313 if (StructTy->isLiteral()) { in createStructCounterName()
322 Module &M, const DataLayout &DL, StructType *StructTy, in createCacheFragAuxGV() argument
328 auto *TypeNameArrayTy = ArrayType::get(Int8PtrTy, StructTy->getNumElements()); in createCacheFragAuxGV()
333 auto *OffsetArrayTy = ArrayType::get(Int32Ty, StructTy->getNumElements()); in createCacheFragAuxGV()
338 auto *SizeArrayTy = ArrayType::get(Int32Ty, StructTy->getNumElements()); in createCacheFragAuxGV()
342 for (unsigned i = 0; i < StructTy->getNumElements(); ++i) { in createCacheFragAuxGV()
343 Type *Ty = StructTy->getElementType(i); in createCacheFragAuxGV()
353 DL.getStructLayout(StructTy)->getElementOffset(i))); in createCacheFragAuxGV()
402 for (auto &StructTy : Vec) { in createCacheFragInfoGV() local
403 if (shouldIgnoreStructType(StructTy)) { in createCacheFragInfoGV()
411 createStructCounterName(StructTy, CounterNameStr); in createCacheFragInfoGV()
420 getStructCounterSize(StructTy)); in createCacheFragInfoGV()
428 StructTyMap.insert(std::pair<Type *, GlobalVariable *>(StructTy, Counters)); in createCacheFragInfoGV()
434 createCacheFragAuxGV(M, DL, StructTy, TypeName, Offset, Size); in createCacheFragInfoGV()
439 getFieldCounterIdx(StructTy)); in createCacheFragInfoGV()
443 getArrayCounterIdx(StructTy)); in createCacheFragInfoGV()
448 DL.getStructLayout(StructTy)->getSizeInBytes()), in createCacheFragInfoGV()
449 ConstantInt::get(Int32Ty, StructTy->getNumElements()), in createCacheFragInfoGV()
740 StructType *StructTy = nullptr; in instrumentGetElementPtr() local
744 StructTy = cast<StructType>(SourceTy); in instrumentGetElementPtr()
747 !shouldIgnoreStructType(StructTy) && StructTyMap.count(StructTy) != 0) in instrumentGetElementPtr()
748 Res |= insertCounterUpdate(I, StructTy, getArrayCounterIdx(StructTy)); in instrumentGetElementPtr()
759 StructTy = dyn_cast<StructType>(ArrayTy->getElementType()); in instrumentGetElementPtr()
760 if (shouldIgnoreStructType(StructTy) || StructTyMap.count(StructTy) == 0) in instrumentGetElementPtr()
763 CounterIdx = getArrayCounterIdx(StructTy); in instrumentGetElementPtr()
765 StructTy = cast<StructType>(Ty); in instrumentGetElementPtr()
766 if (shouldIgnoreStructType(StructTy) || StructTyMap.count(StructTy) == 0) in instrumentGetElementPtr()
771 Idx->getSExtValue() < StructTy->getNumElements()); in instrumentGetElementPtr()
772 CounterIdx = getFieldCounterIdx(StructTy) + Idx->getSExtValue(); in instrumentGetElementPtr()
774 Res |= insertCounterUpdate(I, StructTy, CounterIdx); in instrumentGetElementPtr()
784 StructType *StructTy, in insertCounterUpdate() argument
786 GlobalVariable *CounterArray = StructTyMap[StructTy]; in insertCounterUpdate()
800 ArrayType::get(IRB.getInt64Ty(), getStructCounterSize(StructTy)), in insertCounterUpdate()