Has anyone tried Cpu0 code with the recent llvm (llvm 14 or up)?


I tried to build the code that is based in Cpu0 book Table of Contents — Tutorial: Creating an LLVM Backend for the Cpu0 Architecture with llvm14.

I got a few compilation errors and I fixed them. But now I am unable to run even a small program like ch3.cpp (this test is part of the Cpu0 tests which is in lbdex/input directory , I untarred lbdex.tar.gz mentioned in the book to get the test file)

~/work/lbdex/input$ cat ch3.cpp
// clang -target mips-unknown-linux-gnu -c ch3.cpp -emit-llvm -o ch3.bc
// ~/llvm/test/build/bin/llc -march=cpu0 -relocation-model=pic -filetype=asm ch3.bc -o ch3.cpu0.s
// ~/llvm/test/build/bin/llc -march=cpu0 -relocation-model=pic -filetype=obj ch3.bc -o ch3.cpu0.o

/// start
int main()
  return 0;

I got the following error when I used llc on it.

:~/work/lbdex/input$llc  -march=cpu0 -relocation-model=pic -filetype=asm ch3.bc -o ch3.cpu0.s
!!!Error, TargetTriple.getArch() = 37CPU =

Do you know what this error means? I could not see this string in the source code of clang or codegen code.

Also what is the latest version with which Cpu0 code works? Any pointers with your experience compiling Cpu0 code mentioned in the book would greatly help.
Did you succeed in compilation when you build code chapter by chapter? I was trying to build Chap 2 and Chap 3 code.