Skip to content
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

Kashirin Alexander Lab1 Var 4 #17

Conversation

AlexanderVladislavovich

No description provided.

AveZorgen and others added 30 commits March 4, 2024 22:18
* first commit

* remove redundant foreach

* getting funcname shorter
* first commit

* make action

* made tests more diversed and got rid of using namespace
* Task is ready!

* Update!

* Update for workflow

* Update code

* Update code

* 1. The ASTContext *Context field was removed from the PrintClassVisitor class as unnecessary.
2. The CreateASTConsumer method of the PrintClassLASTAction class now returns make_unique, not new.
3. The help option for the plugin has been added and tested.

* Update code for reload actions (windows-build failed).
This code represents a plugin for Clang that allows outputting information about class members in C++. The program relies on using the Clang tooling and its Abstract Syntax Tree (AST) to analyze and output information about structures and classes in the source code.

The program consists of several components:

- **MemberInfoPrinter:** This class is responsible for printing information about class members, such as fields, methods, and static members. It accesses the Clang AST to retrieve information about each member and prints its name, type, and access specifier.

- **UserTypePrinter:** This class is responsible for printing information about user-defined types, such as structures and classes. It determines the type of each user-defined type and prints the corresponding information.

- **ClassMembersPrinter:** This class is a subclass of `clang::RecursiveASTVisitor` and traverses the AST to find and print information about class members. It uses `MemberInfoPrinter` and `UserTypePrinter` to print information about members and types.

- **ClassMembersConsumer:** This class is an `ASTConsumer` that processes the AST and runs `ClassMembersPrinter` for each detected class or structure.

- **ClassFieldPrinterAction:** This class represents the action of the Clang plugin. It creates an instance of `ClassMembersConsumer` to process the AST and output information about class members.

The program allows analyzing C++ source code and outputting information about class members, their types, and access specifiers.

Example:
```
// CHECK: TestClass (class)
class TestClass {
public:
  int publicInt; // CHECK-NEXT: |_ publicInt (int|public)
  static int publicStaticInt; // CHECK-NEXT: |_ publicStaticInt (int|public|static)
  void publicFunc() {} // CHECK-NEXT: |_ publicFunc (void (void)|public|method)

private:
  int privateInt; // CHECK-NEXT: |_ privateInt (int|private)
  static int privateStaticInt; // CHECK-NEXT: |_ privateStaticInt (int|private|static)
  void privateFunc() {} // CHECK-NEXT: |_ privateFunc (void (void)|private|method)
};
```

In the provided example, a class `TestClass` is shown with various members, including public, private, static variables, and methods. The `CHECK` comments represent the expected output of the program in the format defined in the main code.
* warning plugin

* fixed

* add -i option

* fix clang-tidy

* fix CMakeLists

* fix clang-tidy 2

---------

Co-authored-by: m-ly4 <mikelitch@gmail.com>
Add a plugin printing a warning on deprecated function.
…omplr-tech#18)

* refactoring

* refactoring

* changes

* changes2

* change

* finish

---------

Co-authored-by: root <root@DESKTOP-J78SGPM>
Co-authored-by: m-ly4 <mikelitch@gmail.com>
A plugin that adds the attribute((always_inline)) to functions without condition.
The plugin allows all functions that don't have conditions (for example, if, do...while, etc.), add the always_inline attribute.
Struct fields printer plugin
Implemented identifier renaming (variable name, function name, class name).
overinvest and others added 29 commits May 19, 2024 18:12
I have implemented a pass in MLIR that counts the number of times each function is called by other functions within the module. The goal was to attach this count as an attribute to each function operation. To achieve this, we iterated through all operations in the module, tracking function calls and their frequencies. Then, we attached the call count as an attribute to each function operation. Finally, we registered this pass to be accessible as a plugin.
Pass, that counts number of performed machine instructions in function.
* Implemented fma pass which merge add and mul

* fix

* fix test

* lil fix

* Update mlir/test/Transforms/lab4/alexseev_danila/test.mlir

---------

Co-authored-by: Alexseev Danila <user@DESKTOP-9FK8SDU.localdomain>
Implemented mlir pass that breaks arith.ceildivui and arith.ceildivsi operations into calculation following the rule: ceildiv(a, b) = (a + b - 1) / b.
Has features:

A support for d = a - b * c and d = b * c - a.
If the result of a fadd or fsub operation is not used anywhere else, we can safely delete it.
Issues:

Works correctly with -O1+. With -O0 I cannot bypass store operation because I can't catch it with getDefiningOp. I can catch load operation, but it's operand is not a result of fadd. It's a result of alloca, so it's useless. I hope it's okay.
The pass is designed to count the number of calls to each function in the module and add this count as an attribute to the corresponding function.
The purpose of this laboratory work is to implement a pass that counts the number of calls to each function in the module.
Added a plugin that changes integer multiplication by bitwise shift if at least one of the operands is power of two.
This pass can merge multiplication and addition into a single match.fma
Write a pass that breaks arith.ceildivui and arith.ceildivsi operations into calculation following the rule: ceildiv(a, b) = (a + b - 1) / b
---------

Co-authored-by: root <root@DESKTOP-P3E2N2D>
MLIR pass counting number of a function calls
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.