blob: 00425b781ee0ca2e70f2645d72842d179b678cf7 [file] [log] [blame]
Alexander Shaposhnikov696bd632016-11-26 05:23:44 +00001//===-- RenderScriptExpressionOpts.h ----------------------------*- C++ -*-===//
Luke Drummond19459582016-07-28 14:21:07 +00002//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Luke Drummond19459582016-07-28 14:21:07 +00006//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_RENDERSCRIPT_EXPROPTS_H
10#define LLDB_RENDERSCRIPT_EXPROPTS_H
11
Luke Drummond19459582016-07-28 14:21:07 +000012#include "llvm/IR/Module.h"
13#include "llvm/Support/TargetRegistry.h"
14#include "llvm/Target/TargetMachine.h"
15#include "llvm/Target/TargetOptions.h"
16
Luke Drummond19459582016-07-28 14:21:07 +000017#include "lldb/Target/LanguageRuntime.h"
18#include "lldb/Target/Process.h"
19#include "lldb/lldb-private.h"
20
21#include "RenderScriptRuntime.h"
22#include "RenderScriptx86ABIFixups.h"
23
Kate Stoneb9c1b512016-09-06 20:57:50 +000024// RenderScriptRuntimeModulePass is a simple llvm::ModulesPass that is used
Luke Drummond80af0b92016-10-05 16:27:48 +000025// during expression evaluation to apply RenderScript-specific fixes for
26// expression evaluation. In particular this is used to make expression IR
27// conformant with the ABI generated by the slang frontend. This ModulePass is
28// executed in ClangExpressionParser::PrepareForExecution whenever an
29// expression's DWARF language is eLanguageTypeExtRenderscript
Luke Drummond19459582016-07-28 14:21:07 +000030
Kate Stoneb9c1b512016-09-06 20:57:50 +000031class RenderScriptRuntimeModulePass : public llvm::ModulePass {
Luke Drummond19459582016-07-28 14:21:07 +000032public:
Kate Stoneb9c1b512016-09-06 20:57:50 +000033 static char ID;
34 RenderScriptRuntimeModulePass(const lldb_private::Process *process)
35 : ModulePass(ID), m_process_ptr(process) {}
Luke Drummond19459582016-07-28 14:21:07 +000036
Kate Stoneb9c1b512016-09-06 20:57:50 +000037 bool runOnModule(llvm::Module &module);
Luke Drummond19459582016-07-28 14:21:07 +000038
39private:
Kate Stoneb9c1b512016-09-06 20:57:50 +000040 const lldb_private::Process *m_process_ptr;
Luke Drummond19459582016-07-28 14:21:07 +000041};
42
Kate Stoneb9c1b512016-09-06 20:57:50 +000043namespace lldb_private {
44namespace lldb_renderscript {
45struct RSIRPasses : public lldb_private::LLVMUserExpression::IRPasses {
46 RSIRPasses(lldb_private::Process *process);
Luke Drummond19459582016-07-28 14:21:07 +000047
Kate Stoneb9c1b512016-09-06 20:57:50 +000048 ~RSIRPasses();
Luke Drummond19459582016-07-28 14:21:07 +000049};
50} // namespace lldb_renderscript
51} // namespace lldb_private
52#endif