https://lwn.net/Articles/691932/

https://gcc.gnu.org/wiki/FunctionMultiVersioning

why multi-versioning

This aim of this project is to make it really easy for the developer to specify multiple versions of a function, each catered to a specific target ISA feature. GCC then takes care of creating the dispatching code necessary to execute the right function version.

how this is implemented

When the front-end sees a call (pointer) to a function version, it generates a new dispatcher function decl and replaces the existing call (pointer) to be a call (pointer) to the dispatcher function. The body of the dispatcher function is later generated when building the call graph. The dispatcher function has the logic to determine the right function version at runtime. At run-time, calling the function version, either directly or indirectly, will invoke the dispatcher logic which will execute the right function version.

dispatcher function body

  1. at runtime, use CPU check built-ins to check CPU capability;
  2. IFUNC mechanism so the look up is only needed once.
    IFUNC mechanism reuses existing support from compiler/linker as well as the dynamic linker at runtime. Although we can create a custom version of such indirection, like a function pointer initialized at runtime by checking CPU capabilities.

function multi-versioning in GCC的更多相关文章

  1. GCC的编译和安装 很好的资料

    http://blog.csdn.net/yrj/article/details/492404 1.GCC的编译和安装2.预处理    #define 可以支持不定数量的参数.    例子如下:    ...

  2. DiscuzX /source/function/function_core.php通用核心函数库文件分析

    ... <?php /** * [Discuz!] (C)2001-2099 Comsenz Inc. * This is NOT a freeware, use is subject to l ...

  3. C++ Standards Support in GCC - GCC 对 C++ 标准的支持

    C++ Standards Support in GCC - 2019-2-20 GCC supports different dialects of C++, corresponding to th ...

  4. gcc __attribute__关键字举例之visibility【转】

    转自:https://blog.csdn.net/starstarstone/article/details/7493144?utm_source=tuicool&utm_medium=ref ...

  5. GCC生成动态库

    main.c #include <stdio.h> void hello(void); int main(int argc, char ** argv) { printf("Th ...

  6. GCC提供的几个內建函数

    参考 https://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Other-Builtins.html#Other-Builtins https://en.wikipe ...

  7. 〖C语言〗C语言一个函数传递无限制多参数(不确定参数函数)的方法

    /* * ===================================================================================== * * Filen ...

  8. kbuild-(directory)

    -INDEX - this file: info on the kernel build process kbuild.txt - developer information on kbuild kc ...

  9. 玩转JavaScript OOP[4]——实现继承的12种套路

    概述 在之前的文章中,我们借助构造函数实现了"类",然后结合原型对象实现了"继承",并了解了JavaScript中原型链的概念. 理解这些内容,有助于我们更深入 ...

  10. Laravel 数据库读写分离

    config/database.php ... 'mysql' => [ 'driver' => 'mysql', 'host' => env('DB_HOST', 'localho ...

随机推荐

  1. 兔子的晚会 2016Vijos省选集训 day1

    兔子的晚会 (xor.c/pas/cpp)============================= 很久很久之前,兔子王国里居住着一群兔子.每到新年,兔子国王和他的守卫总是去现场参加晚会来欢庆新年. ...

  2. 【BZOJ4519】[Cqoi2016]不同的最小割 最小割树

    [BZOJ4519][Cqoi2016]不同的最小割 Description 学过图论的同学都知道最小割的概念:对于一个图,某个对图中结点的划分将图中所有结点分成两个部分,如果结点s,t不在同一个部分 ...

  3. android菜鸟学习笔记16----Android项目打包安装过程(Run as Android Application)

    右击项目名称,Run as Android Appication之后,Android项目打包安装过程: 1.打包生成.apk文件: 1)把源码中的.java文件编译生成.class文件 2)将所有的. ...

  4. 关于maven的profile

    1 什么是profile profile本质上就是不同的环境对应不同的配置. 这样的好处是,在命令行中指定具体的profile的时候,会有自己独特的参数或者独特的配置来为不同的环境生成不同的目标代码. ...

  5. mooc课程mit6.00.1x--problem set1解决方法

    counting vowels: 计算字符串中含有元音字母aeiou的数量 char = 'azcbobobegghakl' num = 0 #利用in方法直接查找字符串char中含有的元音字母数量 ...

  6. 我的Java开发学习之旅------>解惑Java进行三目运算时的自动类型转换

    今天看到两个面试题,居然都做错了.通过这两个面试题,也加深对三目运算是的自动类型转换的理解. 题目1.以下代码输出结果是(). public class Test { public static vo ...

  7. [容易] A + B 问题

    题目来源:http://www.lintcode.com/zh-cn/problem/a-b-problem/

  8. 【linux】在linux挂在windows共享目录

    mount -t cifs -o username=用户名,password='密码',vers=2.0 //windows共享目录 /linux挂载目录

  9. JavaScript预解释是一种毫无节操的机制

    前言 JavaScript是一门解释型的语言 , 想要运行JavaScript代码需要两个阶段 编译阶段: 编译阶段就是我们常说的JavaScript预解释(预处理)阶段,在这个阶段JavaScrip ...

  10. WINFROM中自定义控件之绑定数据即时更新

    相信在WINFROM中写自定义控件或者用户控件,很多人都多多少少用过点 最近发现一个用户控件,绑定的数据源没办法自动更新,其实以前处理过这类的问题,可是这次遇到又花了1个多小时,所以决定记下来 在用户 ...