Home | History | Annotate | Download | only in compiler
      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 
     22 namespace llvm {
     23 class Module;
     24 }
     25 
     26 namespace android {
     27 namespace spirit {
     28 
     29 class Builder;
     30 class Instruction;
     31 class Module;
     32 class Pass;
     33 class VariableInst;
     34 
     35 // TODO: avoid exposing these methods while still unit testing them
     36 void AddHeader(Module *m);
     37 VariableInst *AddBuffer(Instruction *elementType, uint32_t binding, Builder &b,
     38                         Module *m);
     39 
     40 bool 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.
     45 bool DecorateGlobalBuffer(llvm::Module &M, Builder &b, Module *m);
     46 
     47 } // namespace spirit
     48 } // namespace android
     49 
     50 namespace rs2spirv {
     51 
     52 android::spirit::Pass* CreateWrapperPass(const llvm::Module &LLVMModule);
     53 
     54 } // namespace rs2spirv
     55 
     56 #endif
     57