c code:
建议:
添加新primtype: PTY_inlineasm, 生成var $start_set_test_set inlineasm,通过判断primtype,生成对应的汇编
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.
Fred's PR 769 adds the necessary new features in the IR. Once that is merged, I will add the corresponding code to clang2mpl.
登录 后才可以发表评论