Skip to content

Commit 037dc17

Browse files
authored
init (#610)
1 parent 35f1f39 commit 037dc17

File tree

197 files changed

+1961
-1053
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

197 files changed

+1961
-1053
lines changed

build/plugins/cp.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,25 @@
44

55

66
def oncopy(unit, *args):
7-
keywords = {'RESULT': 1, 'KEEP_DIR_STRUCT': 0, 'DESTINATION': 1, 'FROM': 1}
7+
keywords = {
8+
'RESULT': 1,
9+
'KEEP_DIR_STRUCT': 0,
10+
'DESTINATION': 1,
11+
'FROM': 1,
12+
'OUTPUT_INCLUDES': -1,
13+
'AUTO': 0,
14+
'WITH_CONTEXT': 0,
15+
}
816

917
flat_args, spec_args = sort_by_keywords(keywords, args)
1018

1119
dest_dir = spec_args['DESTINATION'][0] if 'DESTINATION' in spec_args else ''
1220
from_dir = spec_args['FROM'][0] if 'FROM' in spec_args else ''
21+
output_includes = spec_args['OUTPUT_INCLUDES'] if 'OUTPUT_INCLUDES' in spec_args else None
1322
keep_struct = 'KEEP_DIR_STRUCT' in spec_args
1423
save_in_var = 'RESULT' in spec_args
24+
auto = 'AUTO' in spec_args
25+
with_context = 'WITH_CONTEXT' in spec_args
1526
targets = []
1627

1728
for source in flat_args:
@@ -25,6 +36,12 @@ def oncopy(unit, *args):
2536
target_path = os.path.join(dest_dir, rel_path, filename)
2637
if save_in_var:
2738
targets.append(target_path)
28-
unit.oncopy_file([source_path, target_path])
39+
unit.oncopy_file(
40+
[source_path, target_path]
41+
+ (['OUTPUT_INCLUDES'] + output_includes if output_includes else [])
42+
+ (['OUTPUT_INCLUDES', source_path] if with_context else [])
43+
+ (['AUTO'] if auto else [])
44+
)
45+
2946
if save_in_var:
3047
unit.set([spec_args["RESULT"][0], " ".join(targets)])

build/plugins/llvm_bc.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33

44
def onllvm_bc(unit, *args):
5-
free_args, kwds = sort_by_keywords({'SYMBOLS': -1, 'NAME': 1, 'GENERATE_MACHINE_CODE': 0, 'NO_COMPILE': 0}, args)
5+
free_args, kwds = sort_by_keywords(
6+
{'SYMBOLS': -1, 'NAME': 1, 'GENERATE_MACHINE_CODE': 0, 'NO_COMPILE': 0, 'SUFFIX': 1}, args
7+
)
68
name = kwds['NAME'][0]
79
symbols = kwds.get('SYMBOLS')
8-
obj_suf = unit.get('OBJ_SUF')
10+
obj_suf = kwds['SUFFIX'][0] if 'SUFFIX' in kwds else '' + unit.get('OBJ_SUF')
911
skip_compile_step = 'NO_COMPILE' in kwds
1012
merged_bc = name + '_merged' + obj_suf + '.bc'
1113
out_bc = name + '_optimized' + obj_suf + '.bc'

ydb/core/engine/mkql_engine_flat_extfunc.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "mkql_engine_flat_impl.h"
33
#include "mkql_keys.h"
44
#include <ydb/library/yql/minikql/computation/mkql_computation_node_holders.h>
5+
#include <ydb/library/yql/minikql/computation/mkql_computation_node_holders_codegen.h>
56
#include <ydb/library/yql/minikql/computation/mkql_computation_node_pack.h>
67
#include <ydb/library/yql/minikql/computation/mkql_custom_list.h>
78
#include <ydb/library/yql/minikql/mkql_node_cast.h>

ydb/core/kqp/runtime/kqp_compute.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "kqp_compute.h"
22

33
#include <ydb/library/yql/minikql/computation/mkql_computation_node_codegen.h>
4+
#include <ydb/library/yql/minikql/computation/mkql_computation_node_holders_codegen.h>
45
#include <ydb/library/yql/minikql/comp_nodes/mkql_factories.h>
56
#include <ydb/library/yql/minikql/mkql_node_cast.h>
67
#include <ydb/library/yql/minikql/mkql_program_builder.h>

ydb/library/yql/core/spilling/storage/file_storage/ya.make

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,6 @@ PEERDIR(
1010

1111
NO_COMPILER_WARNINGS()
1212

13-
IF (NOT MKQL_DISABLE_CODEGEN)
14-
PEERDIR(
15-
ydb/library/yql/minikql/codegen
16-
contrib/libs/llvm12/lib/IR
17-
contrib/libs/llvm12/lib/ExecutionEngine/MCJIT
18-
contrib/libs/llvm12/lib/Linker
19-
contrib/libs/llvm12/lib/Target/X86
20-
contrib/libs/llvm12/lib/Target/X86/AsmParser
21-
contrib/libs/llvm12/lib/Transforms/IPO
22-
)
23-
ELSE()
24-
CFLAGS(
25-
-DMKQL_DISABLE_CODEGEN
26-
)
27-
ENDIF()
28-
2913
YQL_LAST_ABI_VERSION()
3014

3115
END()

ydb/library/yql/core/spilling/storage/ya.make

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,6 @@ PEERDIR(
1111

1212
NO_COMPILER_WARNINGS()
1313

14-
IF (NOT MKQL_DISABLE_CODEGEN)
15-
PEERDIR(
16-
ydb/library/yql/minikql/codegen
17-
contrib/libs/llvm12/lib/IR
18-
contrib/libs/llvm12/lib/ExecutionEngine/MCJIT
19-
contrib/libs/llvm12/lib/Linker
20-
contrib/libs/llvm12/lib/Target/X86
21-
contrib/libs/llvm12/lib/Target/X86/AsmParser
22-
contrib/libs/llvm12/lib/Transforms/IPO
23-
)
24-
ELSE()
25-
CFLAGS(
26-
-DMKQL_DISABLE_CODEGEN
27-
)
28-
ENDIF()
29-
3014
YQL_LAST_ABI_VERSION()
3115

3216
END()

ydb/library/yql/core/spilling/ya.make

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,6 @@ PEERDIR(
2323

2424
NO_COMPILER_WARNINGS()
2525

26-
IF (NOT MKQL_DISABLE_CODEGEN)
27-
PEERDIR(
28-
ydb/library/yql/minikql/codegen
29-
contrib/libs/llvm12/lib/IR
30-
contrib/libs/llvm12/lib/ExecutionEngine/MCJIT
31-
contrib/libs/llvm12/lib/Linker
32-
contrib/libs/llvm12/lib/Target/X86
33-
contrib/libs/llvm12/lib/Target/X86/AsmParser
34-
contrib/libs/llvm12/lib/Transforms/IPO
35-
)
36-
ELSE()
37-
CFLAGS(
38-
-DMKQL_DISABLE_CODEGEN
39-
)
40-
ENDIF()
41-
4226
YQL_LAST_ABI_VERSION()
4327

4428
END()

ydb/library/yql/minikql/codegen/codegen.cpp

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,5 @@
11
#include "codegen.h"
2-
#include <llvm/ExecutionEngine/ExecutionEngine.h>
3-
#include <llvm/ExecutionEngine/JITEventListener.h>
4-
#include <llvm/ExecutionEngine/MCJIT.h>
5-
#include <llvm/IR/DiagnosticInfo.h>
6-
#include <llvm/IR/DiagnosticPrinter.h>
7-
#include <llvm/IR/LegacyPassManager.h>
8-
#include <llvm/IR/LLVMContext.h>
9-
#include <llvm/IR/Module.h>
10-
#include <llvm/IR/Verifier.h>
11-
#include <llvm/IRReader/IRReader.h>
12-
#include <llvm/Linker/Linker.h>
13-
#include <llvm-c/Disassembler.h>
14-
#include <llvm/Support/Host.h>
15-
#include <llvm/Support/ManagedStatic.h>
16-
#include <llvm/Support/SourceMgr.h>
17-
#include <llvm/Support/TargetSelect.h>
18-
#include <llvm/Support/Timer.h>
19-
#include <llvm/Support/ErrorHandling.h>
20-
#include <llvm/Transforms/IPO.h>
21-
#include <llvm/Transforms/IPO/PassManagerBuilder.h>
22-
#include <llvm/Transforms/Instrumentation.h>
23-
#include <llvm/Transforms/Instrumentation/AddressSanitizer.h>
24-
#include <llvm/Transforms/Instrumentation/MemorySanitizer.h>
25-
#include <llvm/Transforms/Instrumentation/ThreadSanitizer.h>
26-
#include <llvm/LinkAllPasses.h>
27-
2+
#include "codegen_llvm_deps.h" // Y_IGNORE
283
#include <contrib/libs/re2/re2/re2.h>
294

305
#include <util/generic/maybe.h>
@@ -211,10 +186,16 @@ namespace NCodegen {
211186

212187
namespace {
213188

214-
void FatalErrorHandler(void* user_data, const std::string& reason, bool gen_crash_diag) {
189+
void FatalErrorHandler(void* user_data,
190+
#if LLVM_VERSION_MAJOR == 12
191+
const std::string& reason
192+
#else
193+
const char* reason
194+
#endif
195+
, bool gen_crash_diag) {
215196
Y_UNUSED(user_data);
216197
Y_UNUSED(gen_crash_diag);
217-
ythrow yexception() << "LLVM fatal error: " << reason.c_str();
198+
ythrow yexception() << "LLVM fatal error: " << reason;
218199
}
219200

220201
void AddAddressSanitizerPasses(const llvm::PassManagerBuilder& builder, llvm::legacy::PassManagerBase& pm) {
@@ -313,7 +294,9 @@ class TCodegen : public ICodegen, private llvm::JITEventListener {
313294
targetOptions.EnableFastISel = true;
314295
// init manually, this field was lost in llvm::TargetOptions ctor :/
315296
// make coverity happy
297+
#if LLVM_VERSION_MAJOR == 12
316298
targetOptions.StackProtectorGuardOffset = 0;
299+
#endif
317300

318301
std::string what;
319302
auto&& engineBuilder = llvm::EngineBuilder(std::move(module));
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#pragma once
2+
3+
#include <llvm/ExecutionEngine/ExecutionEngine.h>
4+
#include <llvm/ExecutionEngine/JITEventListener.h>
5+
#include <llvm/ExecutionEngine/MCJIT.h>
6+
#include <llvm/IR/DiagnosticInfo.h>
7+
#include <llvm/IR/DiagnosticPrinter.h>
8+
#include <llvm/IR/LegacyPassManager.h>
9+
#include <llvm/IR/LLVMContext.h>
10+
#include <llvm/IR/Module.h>
11+
#include <llvm/IR/Verifier.h>
12+
#include <llvm/IRReader/IRReader.h>
13+
#include <llvm/Linker/Linker.h>
14+
#include <llvm-c/Disassembler.h>
15+
#include <llvm/Support/Host.h>
16+
#include <llvm/Support/ManagedStatic.h>
17+
#include <llvm/Support/SourceMgr.h>
18+
#include <llvm/Support/TargetSelect.h>
19+
#include <llvm/Support/Timer.h>
20+
#include <llvm/Support/ErrorHandling.h>
21+
#include <llvm/Transforms/IPO.h>
22+
#include <llvm/Transforms/IPO/PassManagerBuilder.h>
23+
#include <llvm/Transforms/Instrumentation.h>
24+
#include <llvm/Transforms/Instrumentation/AddressSanitizer.h>
25+
#include <llvm/Transforms/Instrumentation/MemorySanitizer.h>
26+
#include <llvm/Transforms/Instrumentation/ThreadSanitizer.h>
27+
#include <llvm/LinkAllPasses.h>

ydb/library/yql/minikql/codegen/codegen_ut.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
#include "codegen.h"
1+
#include <ydb/library/yql/minikql/codegen/codegen.h>
22

3-
#include <llvm/IR/Constants.h>
4-
#include <llvm/IR/DerivedTypes.h>
5-
#include <llvm/IR/Instructions.h>
6-
#include <llvm/IR/LLVMContext.h>
7-
#include <llvm/IR/Module.h>
3+
#include <codegen_ut_llvm_deps.h> // Y_IGNORE
84

95
#include <library/cpp/testing/unittest/registar.h>
106
#include <library/cpp/resource/resource.h>

0 commit comments

Comments
 (0)