Path: blob/21.2-virgl/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_builder.hpp
4574 views
//============================================================================1// Copyright (C) 2014-2020 Intel Corporation. All Rights Reserved.2//3// Permission is hereby granted, free of charge, to any person obtaining a4// copy of this software and associated documentation files (the "Software"),5// to deal in the Software without restriction, including without limitation6// the rights to use, copy, modify, merge, publish, distribute, sublicense,7// and/or sell copies of the Software, and to permit persons to whom the8// Software is furnished to do so, subject to the following conditions:9//10// The above copyright notice and this permission notice (including the next11// paragraph) shall be included in all copies or substantial portions of the12// Software.13//14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS20// IN THE SOFTWARE.21//22// @file ${filename}23//24// @brief auto-generated file25//26// DO NOT EDIT27//28// Generation Command Line:29// ${'\n// '.join(cmdline)}30//31//============================================================================32// clang-format off33#pragma once3435//============================================================================36// Auto-generated ${comment}37//============================================================================38%for func in functions:39<%argList = ', '.join(func['args'])%>\40${func['decl']}41{42%if isX86:43%if len(func['args']) != 0:44SmallVector<Type*, ${len(func['args'])}> argTypes;45%for arg in func['args']:46argTypes.push_back(${arg}->getType());47%endfor48#if LLVM_VERSION_MAJOR >= 1249#define VEC_GET_NUM_ELEMS cast<FixedVectorType>(a->getType())->getNumElements()50#elif LLVM_VERSION_MAJOR >= 1151#define VEC_GET_NUM_ELEMS cast<VectorType>(a->getType())->getNumElements()52#else53#define VEC_GET_NUM_ELEMS a->getType()->getVectorNumElements()54#endif55FunctionType* pFuncTy = FunctionType::get(${ func['returnType'] }, argTypes, false);56%else:57FunctionType* pFuncTy = FunctionType::get(${ func['returnType'] }, {}, false);58%endif:59#if LLVM_VERSION_MAJOR >= 960Function* pFunc = cast<Function>(JM()->mpCurrentModule->getOrInsertFunction("meta.intrinsic.${func['name']}", pFuncTy).getCallee());61#else62Function* pFunc = cast<Function>(JM()->mpCurrentModule->getOrInsertFunction("meta.intrinsic.${func['name']}", pFuncTy));63#endif64return CALL(pFunc, std::initializer_list<Value*>{${argList}}, name);65%elif isIntrin:66%if len(func['types']) != 0:67SmallVector<Type*, ${len(func['types'])}> args;68%for arg in func['types']:69args.push_back(${arg}->getType());70%endfor71Function* pFunc = Intrinsic::getDeclaration(JM()->mpCurrentModule, Intrinsic::${func['intrin']}, args);72return CALL(pFunc, std::initializer_list<Value*>{${argList}}, name);73%else:74Function* pFunc = Intrinsic::getDeclaration(JM()->mpCurrentModule, Intrinsic::${func['intrin']});75return CALL(pFunc, std::initializer_list<Value*>{${argList}}, name);76%endif77%else:78return IRB()->${func['intrin']}(${argList});79%endif80}8182% endfor83// clang-format on848586