Hi,
I’m a newbie and want to extend LLVM for my project.
I’ll appreciate any help.
(I thought I posted similar post to llvm-dev mailing list, but it didn’t seem to be posted at that time.)
The goal of the project is to provide software fault tolerance using LLVM compiler.
With pragma, a user can specify which variables to be protected (maybe by duplicating and comparing.) within a region.
The general idea is to annotate the code with the information of the variables to be protected.
pragma fault_tolerance protect(a)
{
a = b * c;
…
d = a + b;
}
Clang compiles it into the following code semantically.
{
a = b * c;
_save_copy(a, loc1, loc2);
…
_retrieve_and_compare(a, loc1, loc2);
d = a + b;
}
I’m using OpenMP implementation as a reference.
As an initial test, I’m implementing it as a new OpenMP directive.
In OpenMP implementation, I’m using OMP_Parallel_Directive as the reference.
With the pragma, OMP_Fault_Tolerance_Directive is created and variable ‘a’ information is kept.
I’m trying to find the variable(s) used in the region and inject a new statement.
I’m having trouble how to check if a statement has a matching variable as either LHS or RHS.
I saw there are lots of matcher routines including ‘AST_POLYMORPHIC_MATCHER_P()’.
However, I cannot find an example of its usage in the compiler code.
Any help for that?
David