1696bd635SAlexander Shaposhnikov //===-- RenderScriptExpressionOpts.h ----------------------------*- C++ -*-===//
219459580SLuke Drummond //
32946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
42946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
52946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
619459580SLuke Drummond //
719459580SLuke Drummond //===----------------------------------------------------------------------===//
819459580SLuke Drummond 
9*cdc514e4SJonas Devlieghere #ifndef LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_RENDERSCRIPT_RENDERSCRIPTRUNTIME_RENDERSCRIPTEXPRESSIONOPTS_H
10*cdc514e4SJonas Devlieghere #define LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_RENDERSCRIPT_RENDERSCRIPTRUNTIME_RENDERSCRIPTEXPRESSIONOPTS_H
1119459580SLuke Drummond 
1219459580SLuke Drummond #include "llvm/IR/Module.h"
1319459580SLuke Drummond #include "llvm/Support/TargetRegistry.h"
1419459580SLuke Drummond #include "llvm/Target/TargetMachine.h"
1519459580SLuke Drummond #include "llvm/Target/TargetOptions.h"
1619459580SLuke Drummond 
1719459580SLuke Drummond #include "lldb/Target/LanguageRuntime.h"
1819459580SLuke Drummond #include "lldb/Target/Process.h"
1919459580SLuke Drummond #include "lldb/lldb-private.h"
2019459580SLuke Drummond 
2119459580SLuke Drummond #include "RenderScriptRuntime.h"
2219459580SLuke Drummond #include "RenderScriptx86ABIFixups.h"
2319459580SLuke Drummond 
24b9c1b51eSKate Stone // RenderScriptRuntimeModulePass is a simple llvm::ModulesPass that is used
2580af0b9eSLuke Drummond // during expression evaluation to apply RenderScript-specific fixes for
2680af0b9eSLuke Drummond // expression evaluation. In particular this is used to make expression IR
2780af0b9eSLuke Drummond // conformant with the ABI generated by the slang frontend. This ModulePass is
2880af0b9eSLuke Drummond // executed in ClangExpressionParser::PrepareForExecution whenever an
2980af0b9eSLuke Drummond // expression's DWARF language is eLanguageTypeExtRenderscript
3019459580SLuke Drummond 
31b9c1b51eSKate Stone class RenderScriptRuntimeModulePass : public llvm::ModulePass {
3219459580SLuke Drummond public:
3319459580SLuke Drummond   static char ID;
34b9c1b51eSKate Stone   RenderScriptRuntimeModulePass(const lldb_private::Process *process)
35b9c1b51eSKate Stone       : ModulePass(ID), m_process_ptr(process) {}
3619459580SLuke Drummond 
371756630dSRaphael Isemann   bool runOnModule(llvm::Module &module) override;
3819459580SLuke Drummond 
3919459580SLuke Drummond private:
4019459580SLuke Drummond   const lldb_private::Process *m_process_ptr;
4119459580SLuke Drummond };
4219459580SLuke Drummond 
43b9c1b51eSKate Stone namespace lldb_private {
44b9c1b51eSKate Stone namespace lldb_renderscript {
45b9c1b51eSKate Stone struct RSIRPasses : public lldb_private::LLVMUserExpression::IRPasses {
4619459580SLuke Drummond   RSIRPasses(lldb_private::Process *process);
4719459580SLuke Drummond 
4819459580SLuke Drummond   ~RSIRPasses();
4919459580SLuke Drummond };
5019459580SLuke Drummond } // namespace lldb_renderscript
5119459580SLuke Drummond } // namespace lldb_private
5219459580SLuke Drummond #endif
53