1.4K Star 7.6K Fork 1.4K

GVP方舟编译器 / OpenArkCompiler

 / 详情

【clang2mpl】The corresponding MIR and section attribute are not generated in clang2mpl

已完成
成员
创建于  
2021-07-13 14:12

c code:
输入图片说明

  1. asm(".globl " "start_set_test_set"); The corresponding Maple IR is not generated.
  2. attribute((section("set_" "test_set"))) section attribute is not generated.

建议:
添加新primtype: PTY_inlineasm, 生成var $start_set_test_set inlineasm,通过判断primtype,生成对应的汇编
输入图片说明

评论 (5)

jinzhu 创建了任务
jinzhu 优先级设置为严重
jinzhu 优先级严重 修改为主要
jinzhu 负责人设置为Brice Dobry
jinzhu 修改了描述
jinzhu 负责人Brice Dobry 修改为未设置
jinzhu 修改了描述
展开全部操作日志

I see the problem with the asm statements. These are a different type of node in the Clang AST, a FileScopeAsmDecl, which I did not yet add support for. I will work on this today.

For 1, we'll define a new Maple IR directive asmdecl, which will be used when there is inline asm outside of any function. It will just take a string, like:

asmdecl ".global start_set_test_set"

Internally, it will be stored as an element of a asmDecls array of MapleString inside MIRModule:

MapleVector<MapleString> asmDecls;

We assume that the positions where these asmdecl's appear do not matter, because they are just global declarations.

For 2, the section attribute is more than an attribute, because it has a string associated with it to specify the section name. We'll add the following field to class MIRSymbol:

GStrIdx sectionAttr { 0 }; // if not 0, the string for the name in C's section attribute

In ascii Maple IR, when a variable has a section attribute, it will printed together with other attributes like:

var test_set_sym <* void> section("set_test_set") static const

PR769 submitted. This will break binary maple compatibility.

Thank you for your support.

Fred's PR 769 adds the necessary new features in the IR. Once that is merged, I will add the corresponding code to clang2mpl.

jinzhu 任务状态待办的 修改为已完成

登录 后才可以发表评论

状态
负责人
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
参与者(3)
C++
1
https://gitee.com/openarkcompiler/OpenArkCompiler.git
git@gitee.com:openarkcompiler/OpenArkCompiler.git
openarkcompiler
OpenArkCompiler
OpenArkCompiler

搜索帮助