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