[llvm-dev] How to insert vector type input parameter for function in C/C++ API?
Craig Topper via llvm-dev
llvm-dev at lists.llvm.org
Mon Apr 10 16:59:30 PDT 2017
There are quite a few different ways to make constant vectors. You can
create a splat of integer constants by using ConstantInt::get(<vector
type>, <scalar value>) The scalar value can be an uint64_t or an APInt.
Of if you have a Constant * you want to splat you can use
ConstantVector::getSplat. If it's not a splat, you can use
ConstantDataVector::get which will take an array of uint8_t, uint16_t,
uint32_t, or uin64_t and auto infer the width and element count. Or you can
use ConstantVector::get which will take an array of individual Constant *
that all have the same scalar type.
I don't have any complete code for implementing a function. Most of my
interaction with these APIs has been in converting intrinsics into native
IR in lib/IR/AutoUpgrade.cpp and clang's lib/CodeGen/CGBuiltin.cpp. I'm
sure you'll find every function I mentioned above used in one or both of
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev