IRForTarget.h revision ba992c58b25ec0a67ef430024dc3dca154982dc9
1//===-- IRForTarget.h ---------------------------------------------*- 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#ifndef liblldb_IRForTarget_h_
11#define liblldb_IRForTarget_h_
12
13#include "llvm/Pass.h"
14
15namespace llvm {
16    class BasicBlock;
17    class CallInst;
18    class Function;
19    class Module;
20    class TargetData;
21    class Value;
22}
23
24namespace lldb_private {
25    class ClangExpressionDeclMap;
26}
27
28class IRForTarget : public llvm::ModulePass
29{
30public:
31    IRForTarget(const void *pid,
32                lldb_private::ClangExpressionDeclMap *decl_map,
33                const llvm::TargetData *target_data);
34    ~IRForTarget();
35    bool runOnModule(llvm::Module &M);
36    void assignPassManager(llvm::PMStack &PMS,
37                           llvm::PassManagerType T = llvm::PMT_ModulePassManager);
38    llvm::PassManagerType getPotentialPassManagerType() const;
39private:
40    bool MaybeHandleVariable(llvm::Module &M,
41                             llvm::Value *V,
42                             bool Store);
43    bool MaybeHandleCall(llvm::Module &M,
44                         llvm::CallInst *C);
45    bool runOnBasicBlock(llvm::Module &M,
46                         llvm::BasicBlock &BB);
47    bool removeGuards(llvm::Module &M,
48                      llvm::BasicBlock &BB);
49    bool replaceVariables(llvm::Module &M,
50                          llvm::Function *F);
51    bool replaceFunctions(llvm::Module &M,
52                          llvm::Function *F);
53
54    lldb_private::ClangExpressionDeclMap *m_decl_map;
55    const llvm::TargetData *m_target_data;
56};
57
58#endif