llc给了我以下错误:LLVM ERROR: Cannot select: t20: i8,ch = load<LD1[%x], zext from i1> t0, FrameIndex:i16<0>, undef:i16 t1: i16 = FrameIndex<0> t3: i16 = undef In function: main
这是prg.ll文件的内容:
; ModuleID = 'new_module'
define i16 @main() {
entry:
%x = alloca i1
store i1 true, i1* %x
%0 = load i1, i1* %x
%relation_op = icmp eq i1 %0, true
br i1 %relation_op, label %then, label %else
then: ; preds = %entry
store i1 false, i1* %x
br label %ifcont3
else: ; preds = %entry
%1 = load i1, i1* %x
%relation_op1 = icmp eq i1 %1, false
br i1 %relation_op1, label %then2, label %ifcont
then2: ; preds = %else
store i1 true, i1* %x
br label %ifcont
ifcont: ; preds = %then2, %else
br label %ifcont3
ifcont3: ; preds = %ifcont, %then
ret i16 0
}我不明白llc是怎么说的。prg.ll输出来自我的avr自定义编译器。我在以下链接找到了avr的LLVM后端:avr-llvm后端。到目前为止,后端工作正常。有人看到什么问题了吗?
提前感谢!
发布于 2016-09-05 10:51:03
我将编译器中的bool类型宽度从i1更改为i8 (在本例中,x是bool)。解决了我的问题。avr后端可能不支持i1或其他什么。如果他们确切地回答了我的问题,我会把问题跟踪器的答案发出来。
问题追踪者的答案是:
一堆LLVM后端处理i1非常糟糕(这是相当可悲的)。这就是为什么几乎所有的前端都将bool定义为i8。 不过,我绝对想解决这个问题。从外观上看,它可能在i1操作的zext上失败了。所有需要做的就是在内部将i1提升到i8。
https://stackoverflow.com/questions/39320834
复制相似问题