首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >llc: LLVM错误:无法选择:

llc: LLVM错误:无法选择:
EN

Stack Overflow用户
提问于 2016-09-04 19:44:14
回答 1查看 2.4K关注 0票数 4

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文件的内容:

代码语言:javascript
复制
; 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后端。到目前为止,后端工作正常。有人看到什么问题了吗?

提前感谢!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-09-05 10:51:03

我将编译器中的bool类型宽度从i1更改为i8 (在本例中,x是bool)。解决了我的问题。avr后端可能不支持i1或其他什么。如果他们确切地回答了我的问题,我会把问题跟踪器的答案发出来。

问题追踪者的答案是:

一堆LLVM后端处理i1非常糟糕(这是相当可悲的)。这就是为什么几乎所有的前端都将bool定义为i8。 不过,我绝对想解决这个问题。从外观上看,它可能在i1操作的zext上失败了。所有需要做的就是在内部将i1提升到i8。

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39320834

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档