Skip to content

Commit

Permalink
Added support for Noclone and Optimize Function Attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamnarlawar77 committed Oct 5, 2019
1 parent d35bac2 commit ad22512
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Function.cpp
Expand Up @@ -82,6 +82,7 @@ static int builtin_functions_cnt;
static std::vector<string> common_func_attributes;
static std::vector<string> visibility_choices;
static std::vector<string> sanitize_choices;
static std::vector<string> optimize_options;

void
InitializeAttributesChoices()
Expand All @@ -107,6 +108,7 @@ InitializeAttributesChoices()
common_func_attributes.push_back("noinline");
common_func_attributes.push_back("noplt");
common_func_attributes.push_back("stack_protect");
common_func_attributes.push_back("noclone");

//Pushing visibility choices
visibility_choices.push_back("default");
Expand All @@ -122,6 +124,15 @@ InitializeAttributesChoices()
sanitize_choices.push_back("pointer-compare");
sanitize_choices.push_back("pointer-subtract");
sanitize_choices.push_back("leak");

//pushing optimization options
optimize_options.push_back("-O0");
optimize_options.push_back("-O1");
optimize_options.push_back("-O2");
optimize_options.push_back("-O3");
optimize_options.push_back("-Os");
optimize_options.push_back("-Ofast");
optimize_options.push_back("-Og");
}

void
Expand All @@ -135,6 +146,7 @@ Function::InitializeAttributes()

func_attr_generator.attributes.push_back(new MultiChoiceAttribute("visibility", FuncAttrProb, visibility_choices));
func_attr_generator.attributes.push_back(new MultiChoiceAttribute("no_sanitize", FuncAttrProb, sanitize_choices));
func_attr_generator.attributes.push_back(new MultiChoiceAttribute("optimize", FuncAttrProb, optimize_options));
func_attr_generator.attributes.push_back(new AlignedAttribute("aligned", FuncAttrProb, 16));
func_attr_generator.attributes.push_back(new SectionAttribute("section", FuncAttrProb));
}
Expand Down

0 comments on commit ad22512

Please sign in to comment.