Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter12 m88k.diff file broken and will not compile m88k target specific code #5

Open
doon386 opened this issue Aug 4, 2021 · 1 comment

Comments

@doon386
Copy link

doon386 commented Aug 4, 2021

Hi,

The m88k.diff file found in .../Target/M88k will not apply correctly to llvm-12 as it currently exists.

The output from the patch command is shown below.

patch -p1 < ../Learn-LLVM-12-master/Chapter12/m88k.diff
patching file llvm/CMakeLists.txt
Hunk #1 succeeded at 328 (offset 14 lines).
patching file llvm/include/llvm/ADT/Triple.h
Hunk #1 FAILED at 58.
Hunk #2 succeeded at 743 (offset 8 lines).
1 out of 2 hunks FAILED -- saving rejects to file llvm/include/llvm/ADT/Triple.h.rej
patching file llvm/include/llvm/BinaryFormat/ELF.h
Hunk #1 succeeded at 501 (offset 9 lines).
patching file llvm/include/llvm/BinaryFormat/ELFRelocs/M88k.def
patching file llvm/include/llvm/Object/ELFObjectFile.h
Hunk #1 succeeded at 1179 (offset 24 lines).
Hunk #2 succeeded at 1252 (offset 26 lines).
patching file llvm/lib/Object/ELF.cpp
Hunk #1 succeeded at 44 (offset 7 lines).
patching file llvm/lib/ObjectYAML/ELFYAML.cpp
Hunk #1 succeeded at 708 with fuzz 2 (offset 17 lines).
patching file llvm/lib/Support/Triple.cpp
Hunk #1 FAILED at 44.
Hunk #2 succeeded at 109 with fuzz 2 (offset 4 lines).
Hunk #3 FAILED at 284.
Hunk #4 FAILED at 422.
Hunk #5 succeeded at 1446 with fuzz 2 (offset 740 lines).
Hunk #6 FAILED at 1281.
Hunk #7 FAILED at 1365.
Hunk #8 FAILED at 1417.
Hunk #9 succeeded at 1533 (offset 13 lines).
Hunk #10 succeeded at 1566 (offset 14 lines).
Hunk #11 succeeded at 1596 (offset 14 lines).
6 out of 11 hunks FAILED -- saving rejects to file llvm/lib/Support/Triple.cpp.rej
patching file llvm/lib/Target/M88k/AsmParser/CMakeLists.txt
patching file llvm/lib/Target/M88k/AsmParser/LLVMBuild.txt
patching file llvm/lib/Target/M88k/AsmParser/M88kAsmParser.cpp
patching file llvm/lib/Target/M88k/CMakeLists.txt
patching file llvm/lib/Target/M88k/Disassembler/CMakeLists.txt
patching file llvm/lib/Target/M88k/Disassembler/M88kDisassembler.cpp
patching file llvm/lib/Target/M88k/M88k.h
patching file llvm/lib/Target/M88k/M88k.td
patching file llvm/lib/Target/M88k/M88kAsmPrinter.cpp
patching file llvm/lib/Target/M88k/M88kCallingConv.td
patching file llvm/lib/Target/M88k/M88kCondCode.h
patching file llvm/lib/Target/M88k/M88kFrameLowering.cpp
patching file llvm/lib/Target/M88k/M88kFrameLowering.h
patching file llvm/lib/Target/M88k/M88kISelDAGToDAG.cpp
patching file llvm/lib/Target/M88k/M88kISelLowering.cpp
patching file llvm/lib/Target/M88k/M88kISelLowering.h
patching file llvm/lib/Target/M88k/M88kInstrFormats.td
patching file llvm/lib/Target/M88k/M88kInstrInfo.cpp
patching file llvm/lib/Target/M88k/M88kInstrInfo.h
patching file llvm/lib/Target/M88k/M88kInstrInfo.td
patching file llvm/lib/Target/M88k/M88kMCInstLower.cpp
patching file llvm/lib/Target/M88k/M88kMCInstLower.h
patching file llvm/lib/Target/M88k/M88kRegisterInfo.cpp
patching file llvm/lib/Target/M88k/M88kRegisterInfo.h
patching file llvm/lib/Target/M88k/M88kRegisterInfo.td
patching file llvm/lib/Target/M88k/M88kSchedule.td
patching file llvm/lib/Target/M88k/M88kSubtarget.cpp
patching file llvm/lib/Target/M88k/M88kSubtarget.h
patching file llvm/lib/Target/M88k/M88kTargetMachine.cpp
patching file llvm/lib/Target/M88k/M88kTargetMachine.h
patching file llvm/lib/Target/M88k/MCTargetDesc/CMakeLists.txt
patching file llvm/lib/Target/M88k/MCTargetDesc/M88kInstPrinter.cpp
patching file llvm/lib/Target/M88k/MCTargetDesc/M88kInstPrinter.h
patching file llvm/lib/Target/M88k/MCTargetDesc/M88kMCAsmBackend.cpp
patching file llvm/lib/Target/M88k/MCTargetDesc/M88kMCAsmInfo.cpp
patching file llvm/lib/Target/M88k/MCTargetDesc/M88kMCAsmInfo.h
patching file llvm/lib/Target/M88k/MCTargetDesc/M88kMCCodeEmitter.cpp
patching file llvm/lib/Target/M88k/MCTargetDesc/M88kMCObjectWriter.cpp
patching file llvm/lib/Target/M88k/MCTargetDesc/M88kMCTargetDesc.cpp
patching file llvm/lib/Target/M88k/MCTargetDesc/M88kMCTargetDesc.h
patching file llvm/lib/Target/M88k/README.txt
patching file llvm/lib/Target/M88k/TargetInfo/CMakeLists.txt
patching file llvm/lib/Target/M88k/TargetInfo/M88kTargetInfo.cpp
patching file llvm/lib/Target/M88k/TargetInfo/M88kTargetInfo.h
patching file llvm/test/CodeGen/M88k/and.ll
patching file llvm/test/CodeGen/M88k/or.ll
patching file llvm/test/CodeGen/M88k/shift.ll
patching file llvm/test/CodeGen/M88k/xor.ll
patching file llvm/test/MC/M88k/valid.s

In addition after patching the files by hand the resulting code will not compile. Relevent error messages from the build are shown below.

[ 20%] Building M88kGenAsmMatcher.inc...
Included from /home/doon/Downloads/llvm-project/llvm/lib/Target/M88k/M88k.td:30:
/home/doon/Downloads/llvm-project/llvm/lib/Target/M88k/M88kInstrInfo.td:361:11: error: Value specified for template argument 'LoadStore::OpNode' (#2) is of type PatFrag; expected type SDNode: load
defm LD : LoadStore<0b0001, "ld", load>;
^
make[2]: *** [lib/Target/M88k/CMakeFiles/M88kCommonTableGen.dir/build.make:134: lib/Target/M88k/M88kGenAsmMatcher.inc] Error 1
make[1]: *** [CMakeFiles/Makefile2:29080: lib/Target/M88k/CMakeFiles/M88kCommonTableGen.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 20%] Building X86GenRegisterBank.inc...
[ 20%] Building X86GenRegisterInfo.inc...
[ 20%] Building X86GenSubtargetInfo.inc...
[ 20%] Built target X86CommonTableGen
make: *** [Makefile:171: all] Error 2

@redstar
Copy link
Collaborator

redstar commented Oct 20, 2021

Hi doon386!

What are your exact steps to checkout LLVM? The following works without problems:

kai@freebsd:~ $ mkdir tmp
kai@freebsd:~ $ cd tmp
kai@freebsd:~/tmp $ git clone https://github.com/PacktPublishing/Learn-LLVM-12.git
Cloning into 'Learn-LLVM-12'...
remote: Enumerating objects: 669, done.
remote: Counting objects: 100% (669/669), done.
remote: Compressing objects: 100% (460/460), done.
remote: Total 669 (delta 284), reused 502 (delta 138), pack-reused 0
Receiving objects: 100% (669/669), 626.48 KiB | 1.80 MiB/s, done.
Resolving deltas: 100% (284/284), done.
kai@freebsd:~/tmp $ git clone https://github.com/llvm/llvm-project
Cloning into 'llvm-project'...
remote: Enumerating objects: 4554496, done.
remote: Counting objects: 100% (1395/1395), done.
remote: Compressing objects: 100% (585/585), done.
remote: Total 4554496 (delta 831), reused 1211 (delta 802), pack-reused 4553101
Receiving objects: 100% (4554496/4554496), 1.74 GiB | 2.50 MiB/s, done.
Resolving deltas: 100% (3626895/3626895), done.
Updating files: 100% (109335/109335), done.
kai@freebsd:~/tmp $ cd llvm-project/
kai@freebsd:~/tmp/llvm-project $ git checkout -b release_12.x origin/release/12.x
Updating files: 100% (41448/41448), done.
Branch 'release_12.x' set up to track remote branch 'release/12.x' from 'origin'.
Switched to a new branch 'release_12.x'
kai@freebsd:~/tmp/llvm-project $ git apply ../Learn-LLVM-12/Chapter12/m88k.diff
../Learn-LLVM-12/Chapter12/m88k.diff:4327: trailing whitespace.
  %and = and i32 %a, 255
warning: 1 line adds whitespace errors.

Without the patch being cleanly applied, I am not surprised that there are compile errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants