【发布时间】:2013-04-30 14:07:56
【问题描述】:
我认为这是一个非常简单的问题,但我无法解决。很伤心。 所以。当我这样做时
llc.exe -march=cpp test.bc
我通过这段代码得到了有趣的 test.cpp:
AttrListPtr func__Z2f1i_PAL;
{
SmallVector<AttributeWithIndex, 4> Attrs;
AttributeWithIndex PAWI;
PAWI.Index = 4294967295U; PAWI.Attrs = Attribute::None | Attribute::NoUnwind;
Attrs.push_back(PAWI);
func__Z2f1i_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
}
但是当我想写像PAWI.Attrs = Attribute::None | Attribute::NoUnwind;这样的字符串时
在我的项目中,我收到错误IntelliSense: no operator "=" matches these operands operand types are: llvm::Attributes = int 我需要做什么?
包括所有必要的标题。 [操作系统 - Windows 7 x64,LLVM - 3.2]
【问题讨论】:
-
我做了一些研究——这段代码在 LLVM 3.1 上编译得很好,但在 LLVM 3.2 上编译得不好。但是,我不明白为什么。
-
所以,我使用 LLVM 3.1 继续我的项目。如果有人知道,为什么这段代码是用 LLVM 3.2 中的 llc 编写的,但与操作数类型不匹配 - 请告诉我。谢谢。
-
您使用的是 LLVM 3.2,还是使用最新的(“主干顶部”)版本?
-
我在 2013 年 1 月 5 日从llvm.org/releases/download.html#3.2 下载了 LLVM 源代码
-
如果有人遇到同样的问题 - 我的解决方案(在 LLVM 3.2 中):
llvm::AttrBuilder *atbuild = new llvm::AttrBuilder();atbuild->addAttribute(llvm::Attributes::NoUnwind);llvm::Attributes atrbs = llvm::Attributes::get(context,*atbuild);function->addAttribute(0,atrbs);