blob: 0cdab0d97f0f30573fad638cc3ff7f5b60f669ab [file] [log] [blame]
alan-bakera1be3322020-04-20 12:48:18 -04001// Copyright 2020 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
15#ifndef CLSPV_LIB_SPEC_CONSTANT_H_
16#define CLSPV_LIB_SPEC_CONSTANT_H_
17
18#include <utility>
19#include <vector>
20
21#include "clspv/SpecConstant.h"
22#include "llvm/IR/Module.h"
23
24namespace clspv {
25
26// Record the use of workgroup size spec constants. Always uses 0, 1 and 2 as
27// the spec ids.
28void AddWorkgroupSpecConstants(llvm::Module *module);
29
30// Allocates a specialization id for |kind|.
31uint32_t AllocateSpecConstant(llvm::Module *module, SpecConstant kind);
32
33// Returns the allocated specializations ids.
34std::vector<std::pair<SpecConstant, uint32_t>>
35GetSpecConstants(llvm::Module *module);
36
37} // namespace clspv
38
39#endif // CLSPV_LIB_SPEC_CONSTANT_H_