Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions common/tl/compiler/tl-compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// Copyright (c) 2020 LLC «V Kontakte»
// Distributed under the GPL v3 License, see LICENSE.notice.txt

#include <assert.h>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
Expand Down
4 changes: 3 additions & 1 deletion common/tl/compiler/tl-parser-new.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "common/tl/compiler/tl-parser-new.h"

#include <cassert>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>
Expand All @@ -13,10 +14,11 @@
#include <string>
#include <sys/stat.h>
#include <sys/types.h>
#include <type_traits>
#include <unistd.h>
#include <utility>

#include "common/c-tree.h"

#include "common/crc32.h"
#include "common/kprintf.h"
#include "common/tl/compiler/tl-tl.h"
Expand Down
27 changes: 26 additions & 1 deletion compiler/class-assumptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,40 @@
*/
#include "compiler/class-assumptions.h"

#include <algorithm>
#include <atomic>
#include <chrono>
#include <fmt/format.h>
#include <forward_list>
#include <iterator>
#include <thread>

#include <type_traits>
#include <utility>
#include <vector>

#include "auto/compiler/vertex/vertex-types.h"
#include "common/algorithms/find.h"
#include "common/termformat/termformat.h"
#include "common/wrappers/copyable-atomic.h"
#include "common/wrappers/fmt_format.h"
#include "common/wrappers/iterator_range.h"
#include "compiler/compiler-core.h"
#include "compiler/data/class-data.h"
#include "compiler/data/class-members.h"
#include "compiler/data/ffi-data.h"
#include "compiler/data/function-data.h"
#include "compiler/data/function-modifiers.h"
#include "compiler/ffi/ffi_types.h"
#include "compiler/function-pass.h"
#include "compiler/inferring/primitive-type.h"
#include "compiler/kphp_assert.h"
#include "compiler/phpdoc.h"
#include "compiler/pipes/deduce-implicit-types-and-casts.h"
#include "compiler/pipes/instantiate-ffi-operations.h"
#include "compiler/stage.h"
#include "compiler/type-hint.h"
#include "compiler/utils/string-utils.h"
#include "compiler/vertex-meta_op_base.h"
#include "compiler/vertex-util.h"
#include "compiler/vertex.h"

Expand Down
4 changes: 4 additions & 0 deletions compiler/class-assumptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@

#pragma once

#include <string>

#include "compiler/data/data_ptr.h"
#include "compiler/data/vertex-adaptor.h"
#include "compiler/debug.h"

class TypeHint;

class Assumption {
DEBUG_STRING_METHOD {
return as_human_readable();
Expand Down
8 changes: 8 additions & 0 deletions compiler/code-gen/code-gen-task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
// Distributed under the GPL v3 License, see LICENSE.notice.txt

#include "compiler/code-gen/code-gen-task.h"

#include <string>

#include "compiler/code-gen/code-gen-root-cmd.h"
#include "compiler/stage.h"
#include "compiler/threading/data-stream.h"
#include "compiler/threading/profiler.h"

class WriterData;

// this os exists to be passed to CodeGenerator constructor,
// but it won't be used actually, as CodeGenerator is not created in "just calc hashes" mode
Expand Down
10 changes: 8 additions & 2 deletions compiler/code-gen/code-gen-task.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@

#pragma once

#include <memory>
#include <utility>

#include "compiler/code-gen/code-gen-root-cmd.h"
#include "compiler/code-gen/code-generator.h"
#include "compiler/scheduler/scheduler-base.h"
#include "compiler/scheduler/task.h"
#include "compiler/stage.h"
#include "compiler/threading/profiler.h"

ProfilerRaw& get_code_gen_profiler();
template<class DataT>
class DataStream;

struct CodeGenRootCmd;
ProfilerRaw& get_code_gen_profiler();

class CodeGenSchedulerTask : public Task {
CodeGenerator W;
Expand Down
7 changes: 7 additions & 0 deletions compiler/code-gen/code-generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@
// Distributed under the GPL v3 License, see LICENSE.notice.txt

#include "compiler/code-gen/code-generator.h"

#include <forward_list>
#include <utility>

#include "compiler/compiler-core.h"
#include "compiler/data/src-file.h"
#include "compiler/index.h"
#include "compiler/kphp_assert.h"
#include "compiler/threading/data-stream.h"

void CodeGenerator::open_file_create_writer(bool compile_with_debug_info_flag, bool compile_with_crc, const std::string& file_name, const std::string& subdir) {
std::string full_file_name = G->cpp_dir;
Expand Down
4 changes: 4 additions & 0 deletions compiler/code-gen/code-generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
// Distributed under the GPL v3 License, see LICENSE.notice.txt

#pragma once

#include <cstring>
#include <string>
#include <string_view>
#include <vector>

#include "common/algorithms/simd-int-to-string.h"
Expand All @@ -15,6 +18,7 @@
#include "compiler/threading/data-stream.h"

struct CGContext {

std::vector<std::string> catch_labels;
std::vector<int> catch_label_used;
FunctionPtr parent_func;
Expand Down
26 changes: 22 additions & 4 deletions compiler/code-gen/const-globals-batched-mem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,34 @@

#include "compiler/code-gen/const-globals-batched-mem.h"

#include <common/algorithms/string-algorithms.h>
#include <compiler/data/function-data.h>

#include <algorithm>
#include <fmt/format.h>
#include <forward_list>
#include <iterator>
#include <memory>
#include <string>
#include <utility>

#include "auto/compiler/vertex/vertex-op_var.h"
#include "auto/compiler/vertex/vertex-types.h"
#include "common/algorithms/find.h"
#include "common/algorithms/hashes.h"
#include "common/algorithms/string-algorithms.h"
#include "common/php-functions.h"

#include "common/wrappers/fmt_format.h"
#include "common/wrappers/string_view.h"
#include "compiler/code-gen/code-generator.h"
#include "compiler/code-gen/common.h"
#include "compiler/code-gen/includes.h"
#include "compiler/compiler-core.h"
#include "compiler/compiler-settings.h"
#include "compiler/data/function-data.h"
#include "compiler/data/var-data.h"
#include "compiler/inferring/primitive-type.h"
#include "compiler/inferring/public.h"
#include "compiler/inferring/type-data.h"
#include "compiler/kphp_assert.h"
#include "compiler/vertex-meta_op_base.h"

// see const-globals-batched-mem.h for detailed comments of what's going on

Expand Down
2 changes: 2 additions & 0 deletions compiler/code-gen/const-globals-batched-mem.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

#pragma once

#include <cstdint>
#include <set>
#include <vector>

#include "compiler/data/data_ptr.h"
#include "compiler/data/vertex-adaptor.h"
Expand Down
27 changes: 26 additions & 1 deletion compiler/code-gen/declarations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,23 @@

#include "compiler/code-gen/declarations.h"

#include "common/algorithms/compare.h"
#include <algorithm>
#include <atomic>
#include <cstdint>
#include <fmt/format.h>
#include <forward_list>
#include <initializer_list>
#include <iterator>
#include <type_traits>
#include <unordered_set>
#include <utility>

#include "common/algorithms/compare.h"
#include "common/algorithms/find.h"
#include "common/tlo-parsing/tl-objects.h"
#include "common/wrappers/fmt_format.h"
#include "common/wrappers/iterator_range.h"
#include "compiler/code-gen/code-generator.h"
#include "compiler/code-gen/common.h"
#include "compiler/code-gen/const-globals-batched-mem.h"
#include "compiler/code-gen/files/json-encoder-tags.h"
Expand All @@ -14,17 +29,27 @@
#include "compiler/code-gen/namespace.h"
#include "compiler/code-gen/naming.h"
#include "compiler/code-gen/vertex-compiler.h"
#include "compiler/compiler-core.h"
#include "compiler/compiler-settings.h"
#include "compiler/data/class-data.h"
#include "compiler/data/class-members.h"
#include "compiler/data/ffi-data.h"
#include "compiler/data/function-data.h"
#include "compiler/data/kphp-json-tags.h"
#include "compiler/data/lib-data.h"
#include "compiler/data/src-file.h"
#include "compiler/data/var-data.h"
#include "compiler/data/vertex-adaptor.h"
#include "compiler/ffi/ffi_types.h"
#include "compiler/inferring/primitive-type.h"
#include "compiler/inferring/public.h"
#include "compiler/inferring/type-data.h"
#include "compiler/kphp_assert.h"
#include "compiler/stage.h"
#include "compiler/tl-classes.h"
#include "compiler/utils/string-utils.h"
#include "compiler/vertex-util.h"
#include "compiler/vertex.h"

VarDeclaration VarPlainDeclaration(VarPtr var) {
return {var, false, false};
Expand Down
6 changes: 5 additions & 1 deletion compiler/code-gen/declarations.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@

#pragma once

#include <cstddef>
#include <map>
#include <memory>
#include <string>
#include <vector>

#include "auto/compiler/vertex/vertex-types.h"
#include "common/tlo-parsing/tl-objects.h"

#include "common/wrappers/string_view.h"
#include "compiler/code-gen/code-gen-root-cmd.h"
#include "compiler/code-gen/code-generator.h"
#include "compiler/code-gen/gen-out-style.h"
Expand Down
4 changes: 4 additions & 0 deletions compiler/code-gen/files/cmake-lists-txt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@
#include "compiler/code-gen/files/cmake-lists-txt.h"

#include <filesystem>
#include <fmt/format.h>
#include <fstream>
#include <string>

#include "common/wrappers/fmt_format.h"
#include "compiler/code-gen/code-generator.h"
#include "compiler/code-gen/common.h"
#include "compiler/compiler-core.h"
#include "compiler/compiler-settings.h"

void CmakeListsTxt::compile_include_cmake() const noexcept {
// 1) creating of file outside of CompilerSettings::dest_cpp_dir directory is unable with CodeGenerator,
Expand Down
25 changes: 25 additions & 0 deletions compiler/code-gen/files/const-vars-init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,41 @@

#include "compiler/code-gen/files/const-vars-init.h"

#include <algorithm>
#include <cstddef>
#include <fmt/format.h>
#include <string>
#include <vector>

#include "auto/compiler/vertex/vertex-op_string.h"
#include "auto/compiler/vertex/vertex-types.h"
#include "common/algorithms/find.h"
#include "common/algorithms/hashes.h"
#include "common/wrappers/fmt_format.h"
#include "compiler/code-gen/code-generator.h"
#include "compiler/code-gen/common.h"
#include "compiler/code-gen/const-globals-batched-mem.h"
#include "compiler/code-gen/declarations.h"
#include "compiler/code-gen/includes.h"
#include "compiler/code-gen/namespace.h"
#include "compiler/code-gen/naming.h"
#include "compiler/code-gen/raw-data.h"
#include "compiler/code-gen/vertex-compiler.h"
#include "compiler/compiler-core.h"
#include "compiler/compiler-settings.h"
#include "compiler/data/data_ptr.h"
#include "compiler/data/function-data.h"
#include "compiler/data/src-file.h"
#include "compiler/data/var-data.h"
#include "compiler/data/vertex-adaptor.h"
#include "compiler/inferring/primitive-type.h"
#include "compiler/inferring/public.h"
#include "compiler/inferring/type-data.h"
#include "compiler/inferring/var-node.h"
#include "compiler/kphp_assert.h"
#include "compiler/location.h"
#include "compiler/stage.h"
#include "compiler/vertex-meta_op_base.h"

struct InitConstVar {
VarPtr var;
Expand Down
9 changes: 9 additions & 0 deletions compiler/code-gen/files/function-header.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,23 @@

#include "compiler/code-gen/files/function-header.h"

#include <cstddef>
#include <map>
#include <set>
#include <string>

#include "compiler/code-gen/code-generator.h"
#include "compiler/code-gen/common.h"
#include "compiler/code-gen/const-globals-batched-mem.h"
#include "compiler/code-gen/declarations.h"
#include "compiler/code-gen/files/function-source.h"
#include "compiler/code-gen/includes.h"
#include "compiler/code-gen/namespace.h"
#include "compiler/code-gen/vertex-compiler.h"
#include "compiler/compiler-core.h"
#include "compiler/compiler-settings.h"
#include "compiler/data/function-data.h"
#include "compiler/stage.h"

FunctionH::FunctionH(FunctionPtr function)
: function(function) {}
Expand Down
1 change: 1 addition & 0 deletions compiler/code-gen/files/function-header.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "compiler/data/data_ptr.h"

struct FunctionH : CodeGenRootCmd {

FunctionPtr function;
explicit FunctionH(FunctionPtr function);
void compile(CodeGenerator& W) const final;
Expand Down
9 changes: 9 additions & 0 deletions compiler/code-gen/files/function-source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,22 @@

#include "compiler/code-gen/files/function-source.h"

#include <cstddef>
#include <map>
#include <set>
#include <string>

#include "compiler/code-gen/code-generator.h"
#include "compiler/code-gen/common.h"
#include "compiler/code-gen/const-globals-batched-mem.h"
#include "compiler/code-gen/declarations.h"
#include "compiler/code-gen/includes.h"
#include "compiler/code-gen/namespace.h"
#include "compiler/code-gen/naming.h"
#include "compiler/code-gen/vertex-compiler.h"
#include "compiler/compiler-core.h"
#include "compiler/compiler-settings.h"
#include "compiler/data/function-data.h"
#include "compiler/stage.h"

FunctionCpp::FunctionCpp(FunctionPtr function)
Expand Down
Loading
Loading