-
Notifications
You must be signed in to change notification settings - Fork 9
Shankara/llzk to pcl pass #209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 10 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
e324293
updating clang format to include pcl headers
shankarapailoor a63c049
prioritize pcl headers
shankarapailoor bb271cd
adding llzk-to-pcl lowering pass
shankarapailoor ebe9555
adding changelog
shankarapailoor b26ebc8
fixing NE
shankarapailoor 3c71c66
Have the PCL Lowering Pass throw an error if the dialect isn't found …
shankarapailoor 39400af
updating comments
shankarapailoor 64e929c
addressing code review feedback
shankarapailoor d069355
fixing comment typo
shankarapailoor c73861f
adding failing test and more passing ones
shankarapailoor 39e69fb
addressing more code review feedback
shankarapailoor 3d21423
enabling llzk-to-pcl pass at compile time
shankarapailoor bce8688
fixing formatting
shankarapailoor efe01d5
removing irrelevant comments
shankarapailoor 77ad2ac
llvm::dyn_cast -> llvm::isa
shankarapailoor 857949a
applying more code review feedback
shankarapailoor 1cac461
adding size checks before cast
shankarapailoor 6684780
nit
shankarapailoor 79d1464
nit
shankarapailoor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| added: | ||
| - Added a pass to convert llzk to pcl |
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| //===-- Parsers.h -----------------------------------------------*- C++ -*-===// | ||
| // | ||
| // Command line parsers for LLZK transformation passes. | ||
| // | ||
| // Part of the LLZK Project, under the Apache License v2.0. | ||
| // See LICENSE.txt for license information. | ||
| // Copyright 2025 Veridise Inc. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include <llvm/ADT/APInt.h> | ||
| #include <llvm/ADT/StringExtras.h> | ||
| #include <llvm/Support/CommandLine.h> | ||
|
|
||
| // Custom command line parsers | ||
| namespace llvm { | ||
| namespace cl { | ||
|
|
||
| // Parser for APInt | ||
| template <> class parser<APInt> : public basic_parser<APInt> { | ||
| public: | ||
| parser(Option &O) : basic_parser(O) {} | ||
|
|
||
| bool parse(Option &O, StringRef, StringRef Arg, APInt &Val) { | ||
| if (Arg.empty()) { | ||
| return O.error("empty integer literal"); | ||
| } | ||
| // Decimal-only: allocate a safe width then shrink. | ||
0xddom marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| unsigned bits = std::max(1u, 4u * (unsigned)Arg.size()); | ||
shankarapailoor marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| APInt tmp(bits, Arg, 10); | ||
| unsigned active = tmp.getActiveBits(); | ||
| if (active == 0) { | ||
| active = 1; | ||
| } | ||
| Val = tmp.zextOrTrunc(active); | ||
| return false; | ||
| } | ||
|
|
||
| // Prints how the passed option differs from the default one specified in the pass | ||
| // For example, if V = 17 and Default = 11 then it should print | ||
| // [OptionName] 17 (bits=5) (default: 11 (bits=4)) | ||
shankarapailoor marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| void printOptionDiff( | ||
| const Option &O, const APInt &V, OptionValue<APInt> Default, size_t GlobalWidth | ||
| ) const { | ||
| std::string Cur = llvm::toString(V, 10, false); | ||
| Cur += " (bits=" + std::to_string(V.getBitWidth()) + ")"; | ||
|
|
||
| std::string Def = "<unspecified>"; | ||
| if (Default.hasValue()) { | ||
| const APInt &D = Default.getValue(); | ||
| Def = llvm::toString(D, 10, false); | ||
| Def += " (bits=" + std::to_string(D.getBitWidth()) + ")"; | ||
| } | ||
|
|
||
| printOptionName(O, GlobalWidth); | ||
| llvm::outs() << Cur << " (default: " << Def << ")\n"; | ||
| } | ||
| }; | ||
|
|
||
| } // namespace cl | ||
| } // namespace llvm | ||
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.