swr/rast: Add autogen of helper llvm intrinsics.
[mesa.git] / src / gallium / drivers / swr / rasterizer / jitter / builder.h
1 /****************************************************************************
2 * Copyright (C) 2014-2015 Intel Corporation. All Rights Reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 *
23 * @file builder.h
24 *
25 * @brief Includes all the builder related functionality
26 *
27 * Notes:
28 *
29 ******************************************************************************/
30 #pragma once
31
32 #include "JitManager.h"
33 #include "common/formats.h"
34
35 namespace SwrJit
36 {
37 using namespace llvm;
38 struct Builder
39 {
40 Builder(JitManager *pJitMgr);
41 virtual ~Builder() {}
42
43 IRBuilder<> *IRB() { return mpIRBuilder; };
44 JitManager *JM() { return mpJitMgr; }
45
46 JitManager *mpJitMgr;
47 IRBuilder<> *mpIRBuilder;
48
49 uint32_t mVWidth; // vector width simd8
50 uint32_t mVWidth16; // vector width simd16
51
52 // Built in types: scalar
53
54 Type* mVoidTy;
55 Type* mInt1Ty;
56 Type* mInt8Ty;
57 Type* mInt16Ty;
58 Type* mInt32Ty;
59 Type* mInt64Ty;
60 Type* mIntPtrTy;
61 Type* mFP16Ty;
62 Type* mFP32Ty;
63 Type* mFP32PtrTy;
64 Type* mDoubleTy;
65 Type* mInt8PtrTy;
66 Type* mInt16PtrTy;
67 Type* mInt32PtrTy;
68
69 // Built in types: simd8
70
71 Type* mSimdFP16Ty;
72 Type* mSimdFP32Ty;
73 Type* mSimdInt1Ty;
74 Type* mSimdInt16Ty;
75 Type* mSimdInt32Ty;
76 Type* mSimdInt64Ty;
77 Type* mSimdIntPtrTy;
78 Type* mSimdVectorTy;
79 Type* mSimdVectorTRTy;
80
81 // Built in types: simd16
82
83 Type* mSimd16FP16Ty;
84 Type* mSimd16FP32Ty;
85 Type* mSimd16Int1Ty;
86 Type* mSimd16Int16Ty;
87 Type* mSimd16Int32Ty;
88 Type* mSimd16Int64Ty;
89 Type* mSimd16IntPtrTy;
90 Type* mSimd16VectorTy;
91 Type* mSimd16VectorTRTy;
92
93 #include "gen_builder.hpp"
94 #include "gen_builder_x86.hpp"
95 #include "gen_builder_intrin.hpp"
96 #include "builder_misc.h"
97 #include "builder_math.h"
98 #include "builder_mem.h"
99
100 protected:
101
102 void SetPrivateContext(Value* pPrivateContext)
103 {
104 mpPrivateContext = pPrivateContext;
105 NotifyPrivateContextSet();
106 }
107 virtual void NotifyPrivateContextSet() {}
108 inline Value* GetPrivateContext() { return mpPrivateContext; }
109
110 private:
111 Value* mpPrivateContext;
112
113 };
114 }