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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
11 changes: 9 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,21 @@

#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();
class ProfilerRaw;
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
7 changes: 7 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 <string.h>
#include <string>
#include <string_view>
#include <vector>

#include "common/algorithms/simd-int-to-string.h"
Expand All @@ -14,7 +17,11 @@
#include "compiler/inferring/type-data.h"
#include "compiler/threading/data-stream.h"

class TypeData;
template<class DataT>
class DataStream;
struct CGContext {

std::vector<std::string> catch_labels;
std::vector<int> catch_label_used;
FunctionPtr parent_func;
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 <map>
#include <set>
#include <stddef.h>

@Shamzik Shamzik Sep 4, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not <cstddef>?

#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
2 changes: 2 additions & 0 deletions compiler/code-gen/files/function-header.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
#include "compiler/code-gen/code-generator.h"
#include "compiler/data/data_ptr.h"

class CodeGenerator;
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 <map>
#include <set>
#include <stddef.h>
#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
2 changes: 2 additions & 0 deletions compiler/code-gen/files/function-source.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
#include "compiler/code-gen/code-generator.h"
#include "compiler/data/data_ptr.h"

class CodeGenerator;
struct FunctionCpp : CodeGenRootCmd {

FunctionPtr function;
explicit FunctionCpp(FunctionPtr function);
void compile(CodeGenerator& W) const final;
Expand Down
14 changes: 14 additions & 0 deletions compiler/code-gen/files/global-vars-memory-stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,28 @@

#include "compiler/code-gen/files/global-vars-memory-stats.h"

#include <algorithm>
#include <cmath>
#include <string>
#include <utility>

#include "common/algorithms/find.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/compiler-core.h"
#include "compiler/compiler-settings.h"
#include "compiler/data/function-data.h"
#include "compiler/data/src-file.h"
#include "compiler/data/var-data.h"
#include "compiler/inferring/primitive-type.h"
#include "compiler/inferring/public.h"
#include "compiler/inferring/type-data.h"

GlobalVarsMemoryStats::GlobalVarsMemoryStats(const std::vector<VarPtr>& all_globals) {
for (VarPtr global_var : all_globals) {
Expand Down
4 changes: 4 additions & 0 deletions compiler/code-gen/files/global-vars-memory-stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@

#pragma once

#include <vector>

#include "compiler/code-gen/code-gen-root-cmd.h"
#include "compiler/code-gen/code-generator.h"
#include "compiler/data/data_ptr.h"

class CodeGenerator;
struct GlobalVarsMemoryStats : CodeGenRootCmd {

explicit GlobalVarsMemoryStats(const std::vector<VarPtr>& all_globals);

void compile(CodeGenerator& W) const final;
Expand Down
11 changes: 11 additions & 0 deletions compiler/code-gen/files/init-scripts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,32 @@

#include <chrono>
#include <cstdint>
#include <memory>
#include <stddef.h>
#include <string>
#include <vector>

#include "common/algorithms/string-algorithms.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/files/shape-keys.h"
#include "compiler/code-gen/gen-out-style.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/compiler-core.h"
#include "compiler/compiler-settings.h"
#include "compiler/data/ffi-data.h"
#include "compiler/data/function-data.h"
#include "compiler/data/lib-data.h"
#include "compiler/data/src-file.h"
#include "compiler/kphp_assert.h"

struct StaticInit {

void compile(CodeGenerator& W) const;
};

Expand Down
2 changes: 2 additions & 0 deletions compiler/code-gen/files/init-scripts.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
#include "compiler/code-gen/code-generator.h"
#include "compiler/data/data_ptr.h"

class CodeGenerator;
struct InitScriptsCpp : CodeGenRootCmd {

SrcFilePtr main_file_id;
explicit InitScriptsCpp(SrcFilePtr main_file_id);
void compile(CodeGenerator& W) const final;
Expand Down
7 changes: 7 additions & 0 deletions compiler/code-gen/files/lib-header.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,19 @@

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

#include <string>
#include <utility>

#include "compiler/code-gen/code-generator.h"
#include "compiler/code-gen/common.h"
#include "compiler/code-gen/declarations.h"
#include "compiler/code-gen/gen-out-style.h"
#include "compiler/code-gen/includes.h"
#include "compiler/code-gen/namespace.h"
#include "compiler/code-gen/naming.h"
#include "compiler/compiler-core.h"
#include "compiler/compiler-settings.h"
#include "compiler/data/function-data.h"
#include "compiler/data/lib-data.h"

void StaticLibraryRunGlobalHeaderH::compile(CodeGenerator& W) const {
Expand Down
5 changes: 5 additions & 0 deletions compiler/code-gen/files/lib-header.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@

#pragma once

#include <vector>

#include "compiler/code-gen/code-gen-root-cmd.h"
#include "compiler/code-gen/code-generator.h"
#include "compiler/data/data_ptr.h"

class CodeGenerator;
struct StaticLibraryRunGlobalHeaderH : CodeGenRootCmd {

void compile(CodeGenerator& W) const final;
};

Expand Down
2 changes: 2 additions & 0 deletions compiler/code-gen/files/shape-keys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
#include "compiler/code-gen/files/shape-keys.h"

#include <string_view>
#include <type_traits>

#include "compiler/code-gen/code-generator.h"
#include "compiler/code-gen/common.h"
#include "compiler/code-gen/includes.h"
#include "compiler/code-gen/naming.h"
#include "compiler/compiler-core.h"
#include "compiler/compiler-settings.h"

std::string ShapeKeys::get_function_name() noexcept {
return "init_shape_demangler";
Expand Down
4 changes: 3 additions & 1 deletion compiler/code-gen/files/shape-keys.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
#pragma once

#include <map>
#include <stdint.h>
#include <string>
#include <utility>

#include "compiler/code-gen/code-gen-root-cmd.h"

class CodeGenerator;

struct ShapeKeys : CodeGenRootCmd {

explicit ShapeKeys(std::map<std::int64_t, std::string> shape_keys_storage) noexcept
: shape_keys_storage_(std::move(shape_keys_storage)) {}

Expand Down
9 changes: 9 additions & 0 deletions compiler/code-gen/files/tl2cpp/tl-constructor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,18 @@

#include "compiler/code-gen/files/tl2cpp/tl-constructor.h"

#include <iterator>
#include <memory>

#include "common/algorithms/string-algorithms.h"
#include "common/functional/identity.h"
#include "common/tlo-parsing/tl-objects.h"
#include "compiler/code-gen/code-generator.h"
#include "compiler/code-gen/common.h"
#include "compiler/code-gen/files/tl2cpp/tl-combinator.h"
#include "compiler/code-gen/files/tl2cpp/tl-template-php-type-helpers.h"
#include "compiler/code-gen/naming.h"
#include "compiler/compiler-core.h"

namespace tl2cpp {
const vk::tlo_parsing::combinator* constructor;
Expand Down
5 changes: 5 additions & 0 deletions compiler/code-gen/files/tl2cpp/tl-constructor.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@

#pragma once

#include <string>
#include <vector>

#include "compiler/code-gen/files/tl2cpp/tl2cpp-utils.h"

class CodeGenerator;

namespace tl2cpp {
struct TlConstructorDecl {
const vk::tlo_parsing::combinator* constructor;
Expand Down
9 changes: 9 additions & 0 deletions compiler/code-gen/files/tl2cpp/tl-module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,18 @@

#include "compiler/code-gen/files/tl2cpp/tl-module.h"

#include <algorithm>

#include "compiler/code-gen/code-generator.h"
#include "compiler/code-gen/common.h"
#include "compiler/code-gen/files/tl2cpp/tl-constructor.h"
#include "compiler/code-gen/files/tl2cpp/tl-function.h"
#include "compiler/code-gen/files/tl2cpp/tl-type.h"
#include "compiler/code-gen/files/tl2cpp/tl2cpp-utils.h"
#include "compiler/compiler-core.h"
#include "compiler/compiler-settings.h"
#include "compiler/data/data_ptr.h"
#include "compiler/kphp_assert.h"

namespace tl2cpp {
std::unordered_map<std::string, Module> modules;
Expand Down
8 changes: 8 additions & 0 deletions compiler/code-gen/files/tl2cpp/tl-module.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,19 @@

#pragma once

#include <memory>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

#include "common/tlo-parsing/tl-objects.h"
#include "compiler/code-gen/files/tl2cpp/tl2cpp-utils.h"
#include "compiler/code-gen/includes.h"

class CodeGenerator;

namespace tl2cpp {
class Module;

Expand Down
Loading
Loading