Skip to content

Commit

Permalink
cg: Generate NoInstrument, NoProfile and NotTailCalled attributes.
Browse files Browse the repository at this point in the history
  • Loading branch information
xlauko authored and Jezurko committed Nov 6, 2024
1 parent ca28e8a commit 2467f1b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
5 changes: 3 additions & 2 deletions include/vast/CodeGen/DefaultAttrVisitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ namespace vast::cg {
mlir_attr VisitConstInitAttr(const clang::ConstInitAttr *attr);
mlir_attr VisitConstructorAttr(const clang::ConstructorAttr *attr);
mlir_attr VisitLoaderUninitializedAttr(const clang::LoaderUninitializedAttr *attr);
mlir_attr VisitNoInstrumentFunctionAttr(const clang::NoInstrumentFunctionAttr *attr);
mlir_attr VisitPackedAttr(const clang::PackedAttr *attr);
mlir_attr VisitPureAttr(const clang::PureAttr *attr);
mlir_attr VisitSwiftAttrAttr(const clang::SwiftAttrAttr *attr);
Expand All @@ -55,6 +54,9 @@ namespace vast::cg {
mlir_attr VisitBuiltinAttr(const clang::BuiltinAttr *attr);
mlir_attr VisitAsmLabelAttr(const clang::AsmLabelAttr *attr);
mlir_attr VisitAllocAlignAttr(const clang::AllocAlignAttr *attr);
mlir_attr VisitNoInstrumentFunctionAttr(const clang::NoInstrumentFunctionAttr *attr);
mlir_attr VisitNoProfileFunctionAttr(const clang::NoProfileFunctionAttr *attr);
mlir_attr VisitNotTailCalledAttr(const clang::NotTailCalledAttr *attr);
mlir_attr VisitAllocSizeAttr(const clang::AllocSizeAttr *attr);
mlir_attr VisitEnableIfAttr(const clang::EnableIfAttr *attr);
mlir_attr VisitC11NoReturnAttr(const clang::C11NoReturnAttr *attr);
Expand Down Expand Up @@ -91,7 +93,6 @@ namespace vast::cg {
mlir_attr VisitAssumeAlignedAttr(const clang::AssumeAlignedAttr *attr);
mlir_attr VisitCountedByAttr(const clang::CountedByAttr *attr);
mlir_attr VisitCleanupAttr(const clang::CleanupAttr *attr);
mlir_attr VisitNoProfileFunctionAttr(const clang::NoProfileFunctionAttr *attr);

private:
template< typename attr_t, typename... args_t >
Expand Down
19 changes: 12 additions & 7 deletions lib/vast/CodeGen/DefaultAttrVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ namespace vast::cg
return make< hl::LoaderUninitializedAttr >();
}

mlir_attr default_attr_visitor::VisitNoInstrumentFunctionAttr(const clang::NoInstrumentFunctionAttr *) {
return make< hl::NoInstrumentFunctionAttr >();
}

mlir_attr default_attr_visitor::VisitPackedAttr(const clang::PackedAttr *) {
return make< hl::PackedAttr >();
}
Expand Down Expand Up @@ -131,6 +127,18 @@ namespace vast::cg
return make< hl::AllocAlignAttr >(attr->getParamIndex().getSourceIndex());
}

mlir_attr default_attr_visitor::VisitNoInstrumentFunctionAttr(const clang::NoInstrumentFunctionAttr *) {
return make< hl::NoInstrumentFunctionAttr >();
}

mlir_attr default_attr_visitor::VisitNoProfileFunctionAttr(const clang::NoProfileFunctionAttr *) {
return make< hl::NoProfileFunctionAttr >();
}

mlir_attr default_attr_visitor::VisitNotTailCalledAttr(const clang::NotTailCalledAttr *) {
return make< hl::NotTailCalledAttr >();
}

mlir_attr default_attr_visitor::VisitAllocSizeAttr(const clang::AllocSizeAttr *attr) {
auto num = attr->getNumElemsParam().isValid() ? attr->getNumElemsParam().getSourceIndex() : int();
return make< hl::AllocSizeAttr >(attr->getElemSizeParam().getSourceIndex(), num);
Expand Down Expand Up @@ -289,7 +297,4 @@ namespace vast::cg
return make< hl::CleanupAttr >(attr->getFunctionDecl()->getName());
}

mlir_attr default_attr_visitor::VisitNoProfileFunctionAttr(const clang::NoProfileFunctionAttr *attr) {
return make< hl::NoProfileInstrumentFunctionAttr >();
}
} // namespace vast::cg

0 comments on commit 2467f1b

Please sign in to comment.