Project stage 2

Task: Apply FMV cloning to functions automatically.

Investigation

My primary investigation started with locating the code to turn on the AFMV(Auto Function Multi Versioning) and the array list of architectures being passed.

Following commands and keyword were used to locate the required code file:

git log --oneline --grep="multiversioning" , gave me the git SHAW to investigate
git show 8ec2f1922a1, where 8ec2f1922a1 is the git SHAW
grep "target_clones" . , helped me to find the keyword target_clones

Changes

Finally I fond the file "gcc/gcc/multiple_target.cc" where the code was located,

static bool expand_target_clones (struct cgraph_node *node, bool definition) {
definition = true;

. . .

}

The above function contains the primary logic for passing the target clones to the fmv.

  const int num_attrs = 2;
  char attrs2[num_attrs][5] = {"sve","sve2"};

  for (i = 0; i < num_attrs; i++) {
    char *attr = attrs2[i];
     /* Create new target clone.  */
    tree attributes = make_attribute (new_attr_name, attr,
                                         DECL_ATTRIBUTES (node->decl));
. . .

}

I added hardcoded the variables to pass to the internal function calls make_attribute () and changed the definition Boolean to true so that AFMV is always on.

Tests:

Following is the result of my changes:


I create a basic HelloWorld program with only sve2 but on objectdum I can see bot sve and sve2 options were created because of the hardcoded array.



Comments

Popular posts from this blog

Project Stage 1 Inspection

AArch64 and x86_64 assembler code