- Add M68k as new Clang target
- Add new attribute to support M68k's ISR (Interrupt Service Routine)
Details
Diff Detail
Event Timeline
Fix the CPU name passing to the backend. Also removed M68060 for now, since backend hasn't fully implemented it yet.
Looking forward to see m68k support (and hopefully sega genesis toolchain support someday)!
clang/lib/Basic/Targets/M68k.cpp | ||
---|---|---|
74 | This doesn't seem to match the coding style, clang-format to the rescue. | |
90 | Can you make all the defineMacro inline within the cases? Clarity seems more useful here. | |
clang/lib/Basic/Targets/M68k.h | ||
36 | Can you remove the comment and add the enum back whenever you introduce CK_68060 support? |
- Addressed all the feedbacks
- Fixed minor issues that would retrieve the wrong TargetCodeGenInfo instance
clang/lib/Basic/Targets.cpp | ||
---|---|---|
314 | currently we don't have any plan for that | |
clang/lib/Basic/Targets/M68k.cpp | ||
124 | stack pointer is aliased to a7, but I'll add pc into the list. | |
clang/lib/CodeGen/TargetInfo.cpp | ||
8085 | Seems to work after I fixed a minor issue in getting the correct TargetCodeGenInfo. Will remove this comment. |
Thanks for the changes. This looks good to me but I'll let others check again and approve.
clang/lib/Basic/Targets/M68k.cpp | ||
---|---|---|
39–51 | If we're in SysV psABI land, then the stack is 32-bit aligned. If we're in actual ABI used by everyone out there, i.e. GCC's default, then it's only 16-bit aligned, and your integer types also have the wrong alignment, so you will get ABI incompatibility with GCC-built binaries as provided by distributions like Debian. | |
64 | GCC's -mcpu excludes any M prefix and is just the number. | |
78–80 | Where are these coming from? GCC only defines __m68k__. |
- Addressed feedbacks
- Now M68k tries to use ABI that is compatible with GCC
clang/lib/Basic/Targets/M68k.cpp | ||
---|---|---|
64 | we also support -mcpu with just number via m68k::getM68kTargetCPU | |
78–80 | I think GCC does: https://github.com/gcc-mirror/gcc/blob/b90d051ecbc1d8972ae1bf0cd7588fcc66df0722/gcc/config/m68k/m68k.h#L64 Also I found this page: https://sourceforge.net/p/predef/wiki/Architectures |
clang/lib/Basic/Targets/M68k.cpp | ||
---|---|---|
78–80 | Yes, and as you can see none of those three are defined by GCC. Defining M68k is particularly bad as it will collide with the C++ namespace used by this very backend so you won't be able to build Clang with Clang on m68k! And the others are just a waste of time. Defining fewer macros is best, that way people don't come to rely on non-standard ones and instead use the single option that exists everywhere (__m68k__). |
- Addressed feedback
- Remove redundant target macro definitions
clang/lib/Basic/Targets/M68k.cpp | ||
---|---|---|
78–80 |
good point :-)
fair enough |
clang/lib/Basic/Targets/M68k.cpp | ||
---|---|---|
143 | only part of the constraints are implements for now. I edit the FIXME comment and move to the end of switch statement |
Do you need to add M68kInterrupt to this list, including for all the other copies of it?