1/*
2 * Copyright 2017, The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef WRAPPER_H
18#define WRAPPER_H
19
20#include <stdint.h>
21
22namespace llvm {
23class Module;
24}
25
26namespace android {
27namespace spirit {
28
29class Builder;
30class Instruction;
31class Module;
32class Pass;
33class VariableInst;
34
35// TODO: avoid exposing these methods while still unit testing them
36void AddHeader(Module *m);
37VariableInst *AddBuffer(Instruction *elementType, uint32_t binding, Builder &b,
38                        Module *m);
39
40bool AddWrapper(const char *name, const uint32_t signature,
41                const uint32_t numInput, Builder &b, Module *m);
42
43// Find the LLVM generated buffer for all non-allocation glboal variables, and
44// correctly decorate it and its type with annotations for binding numbers, etc.
45bool DecorateGlobalBuffer(llvm::Module &M, Builder &b, Module *m);
46
47} // namespace spirit
48} // namespace android
49
50namespace rs2spirv {
51
52android::spirit::Pass* CreateWrapperPass(const llvm::Module &LLVMModule);
53
54} // namespace rs2spirv
55
56#endif
57