Skip to content

Conversation

@aykevl
Copy link
Member

@aykevl aykevl commented Aug 9, 2019

The first commit allows testdata/coroutines.go to be compiled for AVR. It fails during optimizing due what appears to be a LLVM error (see commit message for details).

While looking into this, I found some errors that have been fixed in the second commit.

aykevl added 2 commits August 9, 2019 20:07
Previously it would use a bitcast, which cannot directly be used on AVR
because functions live in a different address space on AVR. To fix this,
use a ptrtoint/inttoptr pair.

This allows testdata/coroutines.go to be compiled, but due to what
appears to be an LLVM bug cannot be optimized and codegen'ed:

    tinygo: /home/ayke/src/github.com/tinygo-org/tinygo/llvm-project/llvm/lib/IR/Constants.cpp:1776: static llvm::Constant *llvm::ConstantExpr::getBitCast(llvm::Constant *, llvm::Type *, bool): Assertion `CastInst::castIsValid(Instruction::BitCast, C, DstTy) && "Invalid constantexpr bitcast!"' failed.

This happens as one of the function passes after the TinyGo passes and
after the module has been verified so most likely it is a bug somewhere
in LLVM.
Compiling LLVM with assertions enabled revealed some bugs in TinyGo that
weren't caught by normal verifying of the LLVM module.
@deadprogram
Copy link
Member

The last big barrier on AVR from my POV was the go routine thing. Awesome!

Merging.

@deadprogram deadprogram merged commit b7cb105 into dev Aug 9, 2019
@deadprogram deadprogram deleted the make-makeGoroutine-avr-compatible branch August 9, 2019 19:27
@aykevl aykevl mentioned this pull request Aug 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants