mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 01:22:04 +00:00
Fix compile functions data type offset
This commit is contained in:
parent
a5ef0067b8
commit
b491e75a56
@ -80,6 +80,28 @@ private:
|
||||
llvm::TargetMachine & target_machine;
|
||||
};
|
||||
|
||||
// class AssemblyPrinter
|
||||
// {
|
||||
// public:
|
||||
|
||||
// explicit AssemblyPrinter(llvm::TargetMachine &target_machine_)
|
||||
// : target_machine(target_machine_)
|
||||
// {
|
||||
// }
|
||||
|
||||
// void print(llvm::Module & module)
|
||||
// {
|
||||
// llvm::legacy::PassManager pass_manager;
|
||||
// target_machine.Options.MCOptions.AsmVerbose = true;
|
||||
// if (target_machine.addPassesToEmitFile(pass_manager, llvm::errs(), nullptr, llvm::CodeGenFileType::CGFT_AssemblyFile))
|
||||
// throw Exception(ErrorCodes::CANNOT_COMPILE_CODE, "MachineCode cannot be printed");
|
||||
|
||||
// pass_manager.run(module);
|
||||
// }
|
||||
// private:
|
||||
// llvm::TargetMachine & target_machine;
|
||||
// };
|
||||
|
||||
/** MemoryManager for module.
|
||||
* Keep total allocated size during RuntimeDyld linker execution.
|
||||
* Actual compiled code memory is stored in llvm::SectionMemoryManager member, we cannot use ZeroBase optimization here
|
||||
@ -216,9 +238,6 @@ CHJIT::CompiledModule CHJIT::compileModule(std::unique_ptr<llvm::Module> module)
|
||||
|
||||
auto buffer = compiler->compile(*module);
|
||||
|
||||
// llvm::errs() << "Module after optimizations " << "\n";
|
||||
// module->print(llvm::errs(), nullptr);
|
||||
|
||||
llvm::Expected<std::unique_ptr<llvm::object::ObjectFile>> object = llvm::object::ObjectFile::createObjectFile(*buffer);
|
||||
|
||||
if (!object)
|
||||
|
@ -329,21 +329,18 @@ static void compileAddIntoAggregateStatesFunctions(llvm::Module & module, const
|
||||
std::vector<ColumnDataPlaceholder> columns;
|
||||
size_t previous_columns_size = 0;
|
||||
|
||||
for (size_t i = 0; i < functions.size(); ++i)
|
||||
for (const auto & function : functions)
|
||||
{
|
||||
auto argument_types = functions[i].function->getArgumentTypes();
|
||||
auto argument_types = function.function->getArgumentTypes();
|
||||
|
||||
ColumnDataPlaceholder data_placeholder;
|
||||
|
||||
std::cerr << "Function " << functions[i].function->getName() << std::endl;
|
||||
|
||||
size_t function_arguments_size = argument_types.size();
|
||||
|
||||
for (size_t column_argument_index = 0; column_argument_index < function_arguments_size; ++column_argument_index)
|
||||
{
|
||||
const auto & argument_type = argument_types[previous_columns_size + column_argument_index];
|
||||
auto * data = b.CreateLoad(column_data_type, b.CreateConstInBoundsGEP1_32(column_data_type, columns_arg, column_argument_index));
|
||||
std::cerr << "Argument type " << argument_type->getName() << std::endl;
|
||||
const auto & argument_type = argument_types[column_argument_index];
|
||||
auto * data = b.CreateLoad(column_data_type, b.CreateConstInBoundsGEP1_32(column_data_type, columns_arg, previous_columns_size + column_argument_index));
|
||||
data_placeholder.data_init = b.CreatePointerCast(b.CreateExtractValue(data, {0}), toNativeType(b, removeNullable(argument_type))->getPointerTo());
|
||||
columns.emplace_back(data_placeholder);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user