-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(ir optimizer): shorter and more functional code when trying …
…to compact instructions
- Loading branch information
Showing
3 changed files
with
116 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
* @file IROptimizer.hpp | ||
* @author Alexandre Plateau ([email protected]) | ||
* @brief Optimize IR based on IR entity grouped by 2 (or more) | ||
* @version 0.1 | ||
* @version 0.2 | ||
* @date 2024-10-11 | ||
* | ||
* @copyright Copyright (c) 2024 | ||
|
@@ -16,6 +16,8 @@ | |
#include <Ark/Compiler/ValTableElem.hpp> | ||
#include <Ark/Compiler/IntermediateRepresentation/Entity.hpp> | ||
|
||
#include <optional> | ||
|
||
namespace Ark::internal | ||
{ | ||
class ARK_API IROptimizer final | ||
|
@@ -49,6 +51,11 @@ namespace Ark::internal | |
std::vector<IR::Block> m_ir; | ||
std::vector<std::string> m_symbols; | ||
std::vector<ValTableElem> m_values; | ||
|
||
[[nodiscard]] std::optional<IR::Entity> compactEntities(const IR::Entity& first, const IR::Entity& second); | ||
[[nodiscard]] std::optional<IR::Entity> compactEntities(const IR::Entity& first, const IR::Entity& second, const IR::Entity& third); | ||
|
||
[[nodiscard]] bool isNumber(uint16_t id, double expected_number) const; | ||
}; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters