Skip to content

[Sim, SemaGen, CMake] Added cached-interp. Changed sema_gen to cpp_gen. Added cmake.#14

Open
egorshamshura wants to merge 14 commits intoProteusLab:masterfrom
egorshamshura:add-cached-interp
Open

[Sim, SemaGen, CMake] Added cached-interp. Changed sema_gen to cpp_gen. Added cmake.#14
egorshamshura wants to merge 14 commits intoProteusLab:masterfrom
egorshamshura:add-cached-interp

Conversation

@egorshamshura
Copy link
Contributor

No description provided.

@egorshamshura egorshamshura changed the title [Sim, SemaGen] Added cached-interp. Changed sema_gen to cpp_gen. [Sim, SemaGen, CMake] Added cached-interp. Changed sema_gen to cpp_gen. Added cmake. Feb 13, 2026
@egorshamshura egorshamshura force-pushed the add-cached-interp branch 20 times, most recently from 675a727 to f406ae7 Compare February 18, 2026 08:56
@egorshamshura egorshamshura force-pushed the add-cached-interp branch 6 times, most recently from 0be8c14 to 4f82916 Compare February 19, 2026 13:53
@egorshamshura egorshamshura force-pushed the add-cached-interp branch 7 times, most recently from 685c386 to 89010af Compare February 19, 2026 14:13
@@ -0,0 +1,4 @@
set(CMAKE_CXX_STANDARD 23)
Copy link
Member

Choose a reason for hiding this comment

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

Consider using per target properties

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to target properties

"CMAKE_BUILD_TYPE": "Debug"
}
}
]
Copy link
Member

Choose a reason for hiding this comment

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

Consider adding build presets also

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

jobs:
formatting-check:
name: Formatting check
runs-on: ubuntu-latest
Copy link
Member

Choose a reason for hiding this comment

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

Fix particular ubuntu version

Copy link
Contributor Author

Choose a reason for hiding this comment

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

started to use ubuntu-22.04

set(BUNDLE_PATH "bundle")
endif()

add_custom_target(bundle_install ALL
Copy link
Member

Choose a reason for hiding this comment

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

Don't forget to check ruby version & executable via FindRuby cmake package https://cmake.org/cmake/help/latest/module/FindRuby.html

Copy link
Member

Choose a reason for hiding this comment

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

I guess it's better to be done on configure, not at build stage

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed


target_include_directories(sim PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${protea_simlib_SOURCE_DIR})
target_link_libraries(sim elfio CLI11 fmt)
set_property(TARGET sim PROPERTY CXX_STANDARD 23)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
set_property(TARGET sim PROPERTY CXX_STANDARD 23)
target_compile_features(sim PRIVATE cxx_std_23)

Moreover, it should be done via interface target, which also provides all required compile options

add_custom_target(${PROJECT_NAME} ALL DEPENDS ${PROTEA_SIMGEN_OUTPUT_FILES})
add_dependencies(${PROJECT_NAME} protea_irgen)

add_executable(sim ${PROTEA_SIMGEN_OUTPUT_SOURCES}
Copy link
Member

Choose a reason for hiding this comment

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

Add this to install

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

Comment on lines 40 to 56
Copy link
Member

Choose a reason for hiding this comment

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

This file should not be generated

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Comment on lines 30 to 40
auto bytes = cpu.m_memory->read<isa::Word>(curAddr);
auto inst = decode(bytes);
if (!inst.has_value()) {
throw std::runtime_error{"Cannot decode bytes"};
}

bb.insns.push_back(*inst);
if (isa::isTerminator(inst->m_opc)) {
break;
}
curAddr += getILen(inst->m_opc);
Copy link
Member

Choose a reason for hiding this comment

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

It seems like you already know exact instruction size while reading isa::Word from memory

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems like you already know exact instruction size while reading isa::Word from memory

It is not true for x86, so I need to add length of the instruction.

Copy link
Member

Choose a reason for hiding this comment

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

In this case you should not read the whole word from memory

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed, currently support only fixed-length instruction size

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants