1 //===-- ExpressionOpts.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 LLDB_RENDERSCRIPT_EXPROPTS_H
11 #define LLDB_RENDERSCRIPT_EXPROPTS_H
12 
13 // C Includes
14 // C++ Includes
15 // Other libraries and framework includes
16 #include "llvm/IR/Module.h"
17 #include "llvm/Support/TargetRegistry.h"
18 #include "llvm/Target/TargetMachine.h"
19 #include "llvm/Target/TargetOptions.h"
20 
21 // Project includes
22 #include "lldb/Target/LanguageRuntime.h"
23 #include "lldb/Target/Process.h"
24 #include "lldb/lldb-private.h"
25 
26 #include "RenderScriptRuntime.h"
27 #include "RenderScriptx86ABIFixups.h"
28 
29 // RenderScriptRuntimeModulePass is a simple llvm::ModulesPass that is used during expression evaluation to apply
30 // RenderScript-specific fixes for expression evaluation.
31 // In particular this is used to make expression IR conformant with the ABI generated by the slang frontend. This
32 // ModulePass is executed in ClangExpressionParser::PrepareForExecution whenever an expression's DWARF language is
33 // eLanguageTypeExtRenderscript
34 
35 class RenderScriptRuntimeModulePass : public llvm::ModulePass
36 {
37 public:
38     static char ID;
39     RenderScriptRuntimeModulePass(const lldb_private::Process *process) : ModulePass(ID), m_process_ptr(process) {}
40 
41     bool
42     runOnModule(llvm::Module &module);
43 
44 private:
45     const lldb_private::Process *m_process_ptr;
46 };
47 
48 namespace lldb_private
49 {
50 namespace lldb_renderscript
51 {
52 struct RSIRPasses : public lldb_private::LLVMUserExpression::IRPasses
53 {
54     RSIRPasses(lldb_private::Process *process);
55 
56     ~RSIRPasses();
57 };
58 } // namespace lldb_renderscript
59 } // namespace lldb_private
60 #endif
61