1 /****************************************************************************
2 * Copyright (C) 2014-2015 Intel Corporation. All Rights Reserved.
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:
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
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
25 * @brief Includes all the builder related functionality
29 ******************************************************************************/
35 //////////////////////////////////////////////////////////////////////////
36 /// @brief Contructor for Builder.
37 /// @param pJitMgr - JitManager which contains modules, function passes, etc.
38 Builder::Builder(JitManager
*pJitMgr
)
41 mVWidth
= pJitMgr
->mVWidth
;
43 mpIRBuilder
= &pJitMgr
->mBuilder
;
45 mVoidTy
= Type::getVoidTy(pJitMgr
->mContext
);
46 mFP16Ty
= Type::getHalfTy(pJitMgr
->mContext
);
47 mFP32Ty
= Type::getFloatTy(pJitMgr
->mContext
);
48 mDoubleTy
= Type::getDoubleTy(pJitMgr
->mContext
);
49 mInt1Ty
= Type::getInt1Ty(pJitMgr
->mContext
);
50 mInt8Ty
= Type::getInt8Ty(pJitMgr
->mContext
);
51 mInt16Ty
= Type::getInt16Ty(pJitMgr
->mContext
);
52 mInt32Ty
= Type::getInt32Ty(pJitMgr
->mContext
);
53 mInt8PtrTy
= PointerType::get(mInt8Ty
, 0);
54 mInt16PtrTy
= PointerType::get(mInt16Ty
, 0);
55 mInt32PtrTy
= PointerType::get(mInt32Ty
, 0);
56 mInt64Ty
= Type::getInt64Ty(pJitMgr
->mContext
);
57 mV4FP32Ty
= StructType::get(pJitMgr
->mContext
, std::vector
<Type
*>(4, mFP32Ty
), false); // vector4 float type (represented as structure)
58 mV4Int32Ty
= StructType::get(pJitMgr
->mContext
, std::vector
<Type
*>(4, mInt32Ty
), false); // vector4 int type
59 mSimdInt16Ty
= VectorType::get(mInt16Ty
, mVWidth
);
60 mSimdInt32Ty
= VectorType::get(mInt32Ty
, mVWidth
);
61 mSimdInt64Ty
= VectorType::get(mInt64Ty
, mVWidth
);
62 mSimdFP16Ty
= VectorType::get(mFP16Ty
, mVWidth
);
63 mSimdFP32Ty
= VectorType::get(mFP32Ty
, mVWidth
);
64 mSimdVectorTy
= StructType::get(pJitMgr
->mContext
, std::vector
<Type
*>(4, mSimdFP32Ty
), false);
66 if (sizeof(uint32_t*) == 4)
69 mSimdIntPtrTy
= mSimdInt32Ty
;
73 SWR_ASSERT(sizeof(uint32_t*) == 8);
75 mSimdIntPtrTy
= mSimdInt64Ty
;