]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/include/llvm/Analysis/TypeMetadataUtils.h
Merge ^/head r307383 through r307735.
[FreeBSD/FreeBSD.git] / contrib / llvm / include / llvm / Analysis / TypeMetadataUtils.h
1 //===- TypeMetadataUtils.h - Utilities related to type metadata --*- C++ -*-==//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains functions that make it easier to manipulate type metadata
11 // for devirtualization.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_ANALYSIS_TYPEMETADATAUTILS_H
16 #define LLVM_ANALYSIS_TYPEMETADATAUTILS_H
17
18 #include "llvm/ADT/SmallVector.h"
19 #include "llvm/IR/CallSite.h"
20
21 namespace llvm {
22
23 /// A call site that could be devirtualized.
24 struct DevirtCallSite {
25   /// The offset from the address point to the virtual function.
26   uint64_t Offset;
27   /// The call site itself.
28   CallSite CS;
29 };
30
31 /// Given a call to the intrinsic @llvm.type.test, find all devirtualizable
32 /// call sites based on the call and return them in DevirtCalls.
33 void findDevirtualizableCallsForTypeTest(
34     SmallVectorImpl<DevirtCallSite> &DevirtCalls,
35     SmallVectorImpl<CallInst *> &Assumes, CallInst *CI);
36
37 /// Given a call to the intrinsic @llvm.type.checked.load, find all
38 /// devirtualizable call sites based on the call and return them in DevirtCalls.
39 void findDevirtualizableCallsForTypeCheckedLoad(
40     SmallVectorImpl<DevirtCallSite> &DevirtCalls,
41     SmallVectorImpl<Instruction *> &LoadedPtrs,
42     SmallVectorImpl<Instruction *> &Preds, bool &HasNonCallUses, CallInst *CI);
43 }
44
45 #endif