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 
9cdc514e4SJonas Devlieghere #ifndef LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_RENDERSCRIPT_RENDERSCRIPTRUNTIME_RENDERSCRIPTEXPRESSIONOPTS_H
10cdc514e4SJonas Devlieghere #define LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_RENDERSCRIPT_RENDERSCRIPTRUNTIME_RENDERSCRIPTEXPRESSIONOPTS_H
1119459580SLuke Drummond 
1219459580SLuke Drummond #include "llvm/IR/Module.h"
1389b57061SReid Kleckner #include "llvm/MC/TargetRegistry.h"
14*3c4410dfSserge-sans-paille #include "llvm/Pass.h"
1519459580SLuke Drummond #include "llvm/Target/TargetMachine.h"
1619459580SLuke Drummond #include "llvm/Target/TargetOptions.h"
1719459580SLuke Drummond 
1819459580SLuke Drummond #include "lldb/Target/LanguageRuntime.h"
1919459580SLuke Drummond #include "lldb/Target/Process.h"
2019459580SLuke Drummond #include "lldb/lldb-private.h"
2119459580SLuke Drummond 
2219459580SLuke Drummond #include "RenderScriptRuntime.h"
2319459580SLuke Drummond #include "RenderScriptx86ABIFixups.h"
2419459580SLuke Drummond 
25b9c1b51eSKate Stone // RenderScriptRuntimeModulePass is a simple llvm::ModulesPass that is used
2680af0b9eSLuke Drummond // during expression evaluation to apply RenderScript-specific fixes for
2780af0b9eSLuke Drummond // expression evaluation. In particular this is used to make expression IR
2880af0b9eSLuke Drummond // conformant with the ABI generated by the slang frontend. This ModulePass is
2980af0b9eSLuke Drummond // executed in ClangExpressionParser::PrepareForExecution whenever an
3080af0b9eSLuke Drummond // expression's DWARF language is eLanguageTypeExtRenderscript
3119459580SLuke Drummond 
32b9c1b51eSKate Stone class RenderScriptRuntimeModulePass : public llvm::ModulePass {
3319459580SLuke Drummond public:
3419459580SLuke Drummond   static char ID;
RenderScriptRuntimeModulePass(const lldb_private::Process * process)35b9c1b51eSKate Stone   RenderScriptRuntimeModulePass(const lldb_private::Process *process)
36b9c1b51eSKate Stone       : ModulePass(ID), m_process_ptr(process) {}
3719459580SLuke Drummond 
381756630dSRaphael Isemann   bool runOnModule(llvm::Module &module) override;
3919459580SLuke Drummond 
4019459580SLuke Drummond private:
4119459580SLuke Drummond   const lldb_private::Process *m_process_ptr;
4219459580SLuke Drummond };
4319459580SLuke Drummond 
44b9c1b51eSKate Stone namespace lldb_private {
45b9c1b51eSKate Stone namespace lldb_renderscript {
46b9c1b51eSKate Stone struct RSIRPasses : public lldb_private::LLVMUserExpression::IRPasses {
4719459580SLuke Drummond   RSIRPasses(lldb_private::Process *process);
4819459580SLuke Drummond 
4919459580SLuke Drummond   ~RSIRPasses();
5019459580SLuke Drummond };
5119459580SLuke Drummond } // namespace lldb_renderscript
5219459580SLuke Drummond } // namespace lldb_private
5319459580SLuke Drummond #endif
54