예제 #1
0
llvm::ModRefInfo SwiftAAResult::getModRefInfo(llvm::ImmutableCallSite CS,
                                              const llvm::MemoryLocation &Loc) {
  // We know the mod-ref behavior of various runtime functions.
  switch (classifyInstruction(*CS.getInstruction())) {
  case RT_AllocObject:
  case RT_NoMemoryAccessed:
  case RT_Retain:
  case RT_RetainUnowned:
  case RT_CheckUnowned:
  case RT_ObjCRetain:
  case RT_BridgeRetain:
  case RT_UnknownRetain:
  case RT_RetainN:
  case RT_UnknownRetainN:
  case RT_BridgeRetainN:
  case RT_FixLifetime:
    // These entrypoints don't modify any compiler-visible state.
    return MRI_NoModRef;
  case RT_ReleaseN:
  case RT_UnknownReleaseN:
  case RT_BridgeReleaseN:
  case RT_Release:
  case RT_ObjCRelease:
  case RT_BridgeRelease:
  case RT_UnknownRelease:
  case RT_Unknown:
    break;
  }

  return AAResultBase::getModRefInfo(CS, Loc);
}
예제 #2
0
ModRefInfo SwiftAAResult::getModRefInfo(llvm::ImmutableCallSite CS,
                                        const llvm::MemoryLocation &Loc) {
  // We know at compile time that certain entry points do not modify any
  // compiler-visible state ever. Quickly check if we have one of those
  // instructions and return if so.
  if (ModRefInfo::NoModRef ==
      getConservativeModRefForKind(*CS.getInstruction()))
    return ModRefInfo::NoModRef;

  // Otherwise, delegate to the rest of the AA ModRefInfo machinery.
  return AAResultBase::getModRefInfo(CS, Loc);
}