21 #include <llvm/IR/Constants.h>
22 #include <llvm/IR/Instruction.h>
23 #include <llvm/IR/Module.h>
24 #include <llvm/IR/Value.h>
30 llvm::Module* llvm_module)
const {
31 auto& context = llvm_module->getContext();
32 auto f = llvm_module->getFunction(
"fixed_width_int_decode");
34 llvm::Value*
args[] = {
36 llvm::ConstantInt::get(llvm::Type::getInt32Ty(context),
byte_width_),
38 return llvm::CallInst::Create(
f, args);
42 : byte_width_{byte_width} {}
46 llvm::Module* llvm_module)
const {
47 auto& context = llvm_module->getContext();
48 auto f = llvm_module->getFunction(
"fixed_width_unsigned_decode");
50 llvm::Value*
args[] = {
52 llvm::ConstantInt::get(llvm::Type::getInt32Ty(context),
byte_width_),
54 return llvm::CallInst::Create(
f, args);
58 : byte_width_{byte_width}, baseline_{baseline} {}
62 llvm::Module* llvm_module)
const {
63 auto& context = llvm_module->getContext();
64 auto f = llvm_module->getFunction(
"diff_fixed_width_int_decode");
66 llvm::Value*
args[] = {
68 llvm::ConstantInt::get(llvm::Type::getInt32Ty(context),
byte_width_),
69 llvm::ConstantInt::get(llvm::Type::getInt32Ty(context),
baseline_),
71 return llvm::CallInst::Create(
f, args);
78 llvm::Module* llvm_module)
const {
79 auto f = llvm_module->getFunction(
is_double_ ?
"fixed_width_double_decode"
80 :
"fixed_width_float_decode");
82 llvm::Value*
args[] = {byte_stream, pos};
83 return llvm::CallInst::Create(
f, args);
91 llvm::Module* llvm_module)
const {
92 auto& context = llvm_module->getContext();
93 auto f = llvm_module->getFunction(
"fixed_width_small_date_decode");
95 llvm::Value*
args[] = {
97 llvm::ConstantInt::get(llvm::Type::getInt32Ty(context),
byte_width_),
98 llvm::ConstantInt::get(llvm::Type::getInt32Ty(context),
null_val_),
99 llvm::ConstantInt::get(llvm::Type::getInt64Ty(context),
ret_null_val_),
101 return llvm::CallInst::Create(
f, args);
FixedWidthUnsigned(const size_t byte_width)
llvm::Instruction * codegenDecode(llvm::Value *byte_stream, llvm::Value *pos, llvm::Module *llvm_module) const override
llvm::Instruction * codegenDecode(llvm::Value *byte_stream, llvm::Value *pos, llvm::Module *llvm_module) const override
FixedWidthSmallDate(const size_t byte_width)
FixedWidthReal(const bool is_double)
DiffFixedWidthInt(const size_t byte_width, const int64_t baseline)
llvm::Instruction * codegenDecode(llvm::Value *byte_stream, llvm::Value *pos, llvm::Module *llvm_module) const override
FixedWidthInt(const size_t byte_width)
llvm::Instruction * codegenDecode(llvm::Value *byte_stream, llvm::Value *pos, llvm::Module *llvm_module) const override
llvm::Instruction * codegenDecode(llvm::Value *byte_stream, llvm::Value *pos, llvm::Module *llvm_module) const override
static constexpr int64_t ret_null_val_
torch::Tensor f(torch::Tensor x, torch::Tensor W_target, torch::Tensor b_target)