summaryrefslogtreecommitdiffstats
path: root/llvm/include/llvm-types.h
blob: 1b8d09c89fb3f00db0de52165cb9e35596e13e61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*
 *  (C) 2010 by Computer System Laboratory, IIS, Academia Sinica, Taiwan.
 *      See COPYRIGHT in top-level directory.
 */

#ifndef __LLVM_TYPES_H
#define __LLVM_TYPES_H

#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/CallSite.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/GetElementPtrTypeIterator.h"
#include "llvm/IR/Operator.h"
#include "llvm/IR/Verifier.h"
#include "llvm/IR/ValueHandle.h"
#include "llvm/IR/ValueSymbolTable.h"
#include "llvm/IR/InstIterator.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/Analysis/CFG.h"
#include "llvm/Analysis/CodeMetrics.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/IRReader/IRReader.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Support/DynamicLibrary.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/Host.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Transforms/Utils/Cloning.h"

#if defined(LLVM_V35)
#include "llvm/MC/MCDisassembler.h"
#include "llvm/ExecutionEngine/ObjectImage.h"
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Support/MemoryObject.h"
#elif defined(LLVM_V38)
#include "llvm/MC/MCDisassembler.h"
#include "llvm/Object/SymbolSize.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Support/MemoryObject.h"
#elif defined(LLVM_V39)
#include "llvm/MC/MCDisassembler/MCDisassembler.h"
#include "llvm/Object/SymbolSize.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/Support/MemoryObject.h"
#else
#include "llvm/MC/MCDisassembler/MCDisassembler.h"
#include "llvm/Object/SymbolSize.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#endif

#include <vector>
#include <set>
#include <map>
#include "llvm-macro.h"
#include "qemu-types.h"

using namespace llvm;

class HelperInfo;

typedef std::vector<TranslationBlock *> TBVec;
typedef std::vector<std::pair<BlockID, uint16_t> > RestoreVec;
typedef std::map<uintptr_t, std::string> TCGHelperMap;   /* <func_ptr, func_name> */
typedef std::map<std::string, HelperInfo*> HelperMap;
typedef std::map<std::string, uintptr_t> SymbolMap;
typedef std::map<intptr_t, Type *> FlatType;       /* <state_off, state_ty> */
typedef std::vector<Instruction *> IVec;
typedef std::vector<BasicBlock *> BBVec;


static inline const DataLayout *getDataLayout(Module *Mod) {
#if defined(LLVM_V35)
    return Mod->getDataLayout();
#else
    return &Mod->getDataLayout();
#endif
}

static inline AllocaInst *CreateAlloca(Type *Ty, unsigned AddrSpace,
                                       const Twine &Name,
                                       Instruction *InsertBefore = nullptr) {
#if defined(LLVM_V35) || defined(LLVM_V38) || defined(LLVM_V39)
    return new AllocaInst(Ty, Name, InsertBefore);
#else
    return new AllocaInst(Ty, AddrSpace, Name, InsertBefore);
#endif
}

static inline AllocaInst *CreateAlloca(Type *Ty, unsigned AddrSpace,
                                       Value *ArraySize = nullptr,
                                       const Twine &Name = "",
                                       Instruction *InsertBefore = nullptr) {
#if defined(LLVM_V35) || defined(LLVM_V38) || defined(LLVM_V39)
    return new AllocaInst(Ty, ArraySize, Name, InsertBefore);
#else
    return new AllocaInst(Ty, AddrSpace, ArraySize, Name, InsertBefore);
#endif
}

static inline void InlineFunc(CallInst *CI) {
#if defined(LLVM_V38) || defined(LLVM_V39)
    AssumptionCacheTracker ACT;
    InlineFunctionInfo IFI(nullptr, &ACT);
#else
    InlineFunctionInfo IFI;
#endif
    InlineFunction(CI, IFI);
}

#endif

/*
 * vim: ts=8 sts=4 sw=4 expandtab
 */
OpenPOWER on IntegriCloud