mkql_block_impl_codegen.h.txt 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #pragma once
  2. #include <yql/essentials/minikql/computation/mkql_block_item.h>
  3. #include "mkql_llvm_base.h"
  4. #include <yql/essentials/minikql/codegen/codegen.h>
  5. namespace NKikimr::NMiniKQL {
  6. #ifndef MKQL_DISABLE_CODEGEN
  7. class TLLVMFieldsStructureBlockState: public TLLVMFieldsStructure<TComputationValue<TBlockState>> {
  8. private:
  9. using TBase = TLLVMFieldsStructure<TComputationValue<TBlockState>>;
  10. llvm::IntegerType*const CountType;
  11. llvm::PointerType*const PointerType;
  12. llvm::ArrayType*const SkipSpaceType;
  13. protected:
  14. using TBase::Context;
  15. static constexpr auto BaseFields = 3U;
  16. public:
  17. std::vector<llvm::Type*> GetFieldsArray() {
  18. std::vector<llvm::Type*> result = TBase::GetFields();
  19. result.emplace_back(CountType);
  20. result.emplace_back(PointerType);
  21. result.emplace_back(SkipSpaceType);
  22. return result;
  23. }
  24. llvm::Constant* GetCount() {
  25. return llvm::ConstantInt::get(llvm::Type::getInt32Ty(Context), TBase::GetFieldsCount() + 0);
  26. }
  27. llvm::Constant* GetPointer() {
  28. return llvm::ConstantInt::get(llvm::Type::getInt32Ty(Context), TBase::GetFieldsCount() + 1);
  29. }
  30. TLLVMFieldsStructureBlockState(llvm::LLVMContext& context, size_t width)
  31. : TBase(context)
  32. , CountType(llvm::Type::getInt64Ty(Context))
  33. , PointerType(llvm::PointerType::getUnqual(llvm::ArrayType::get(llvm::Type::getInt128Ty(Context), width)))
  34. , SkipSpaceType(llvm::ArrayType::get(llvm::Type::getInt64Ty(Context), 9U)) // Skip std::vectors Values & Arrays
  35. {}
  36. };
  37. #endif
  38. } //namespace NKikimr::NMiniKQL