David Neto | 48f56a4 | 2017-10-06 16:44:25 -0400 | [diff] [blame] | 1 | // Copyright 2017 The Clspv Authors. All rights reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
David Neto | 4feb7a4 | 2017-10-06 17:29:42 -0400 | [diff] [blame] | 15 | #ifndef CLSPV_LIB_ARGKIND_H_ |
| 16 | #define CLSPV_LIB_ARGKIND_H_ |
David Neto | 48f56a4 | 2017-10-06 16:44:25 -0400 | [diff] [blame] | 17 | |
Diego Novillo | a4c44fa | 2019-04-11 10:56:15 -0400 | [diff] [blame] | 18 | #include "llvm/ADT/DenseMap.h" |
David Neto | c6f3ab2 | 2018-04-06 18:02:31 -0400 | [diff] [blame] | 19 | #include "llvm/IR/Function.h" |
| 20 | #include "llvm/IR/Module.h" |
| 21 | #include "llvm/IR/Type.h" |
David Neto | 48f56a4 | 2017-10-06 16:44:25 -0400 | [diff] [blame] | 22 | |
alan-baker | f5e5f69 | 2018-11-27 08:33:24 -0500 | [diff] [blame] | 23 | #include "clspv/ArgKind.h" |
David Neto | 48f56a4 | 2017-10-06 16:44:25 -0400 | [diff] [blame] | 24 | |
alan-baker | f5e5f69 | 2018-11-27 08:33:24 -0500 | [diff] [blame] | 25 | namespace clspv { |
David Neto | 862b7d8 | 2018-06-14 18:48:37 -0400 | [diff] [blame] | 26 | |
alan-baker | c4579bb | 2020-04-29 14:15:50 -0400 | [diff] [blame] | 27 | // Enum for how pod args are implemented. Gets added as metadata to each |
| 28 | // kernel. |
| 29 | enum PodArgImpl { |
| 30 | kSSBO, |
| 31 | kUBO, |
| 32 | kPushConstant, |
| 33 | // Shared interface across all shaders. |
| 34 | kGlobalPushConstant, |
| 35 | }; |
David Neto | 862b7d8 | 2018-06-14 18:48:37 -0400 | [diff] [blame] | 36 | |
alan-baker | c4579bb | 2020-04-29 14:15:50 -0400 | [diff] [blame] | 37 | // Returns the style of pod args used by |F|. Note that |F| must be a kernel. |
| 38 | PodArgImpl GetPodArgsImpl(llvm::Function &F); |
| 39 | |
| 40 | // Returns the ArgKind for pod args in kernel |F|. |
| 41 | ArgKind GetArgKindForPodArgs(llvm::Function &F); |
| 42 | |
| 43 | // Returns the ArgKind for |Arg|. |
| 44 | ArgKind GetArgKind(llvm::Argument &Arg); |
David Neto | 48f56a4 | 2017-10-06 16:44:25 -0400 | [diff] [blame] | 45 | |
David Neto | c6f3ab2 | 2018-04-06 18:02:31 -0400 | [diff] [blame] | 46 | // Returns true if the given type is a pointer-to-local type. |
Diego Novillo | a4c44fa | 2019-04-11 10:56:15 -0400 | [diff] [blame] | 47 | bool IsLocalPtr(llvm::Type *type); |
David Neto | c6f3ab2 | 2018-04-06 18:02:31 -0400 | [diff] [blame] | 48 | |
David Neto | 48f56a4 | 2017-10-06 16:44:25 -0400 | [diff] [blame] | 49 | } // namespace clspv |
| 50 | |
| 51 | #endif |