This is an archive of the discontinued LLVM Phabricator instance.

[M68k][GloballSel] Lower outgoing return values in IRTranslator
ClosedPublic

Authored by sushmaunnibhavi on Jul 1 2021, 10:02 PM.

Details

Summary

Implementation of lowerReturn in the IRTranslator for the M68k backend.

Diff Detail

Event Timeline

sushmaunnibhavi requested review of this revision.Jul 1 2021, 10:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 1 2021, 10:02 PM
gandhi21299 added inline comments.Jul 2 2021, 9:41 AM
llvm/lib/Target/M68k/M68kISelLowering.h
177

Since there is the param bool Return, we could combine this function with the above one.

llvm/test/CodeGen/M68k/GlobalISel/irtranslator-ret.ll
185

The name of the register storing the return value, ie $bd0, could be turned into a regex. Please do the same for the tests below.

213

Floating point tests might be doable? In case its a hastle and Minh does not mind, perhaps add a TODO in the IRTranslator somewhere.

@myhsu x64 debian failure is likely because of the missing M68kISelLowering.h. Can we do something about this?

myhsu added a comment.Jul 2 2021, 3:08 PM

@myhsu x64 debian failure is likely because of the missing M68kISelLowering.h. Can we do something about this?

That's really interesting...clang-format always seems to have a hard time finding that file, I'll look into it

llvm/lib/Target/M68k/GlSel/M68kCallLowering.cpp
35

Missing override attribute here, which is a compilation error if you build LLVM using Clang.

42
  1. Missing override
  2. The method you should override is this one. More specifically, the third argument is mismatched.
  3. According to M68k's ABI, we don't use stack for returning, so I don't think we need to implement this method (Put a llvm_unreachable here should be sufficient).
50

ditto missing override

llvm/lib/Target/M68k/M68kISelLowering.h
177

Agree, currently we don't have complicate CC assignment functions so combining them into one is preferred.

llvm/test/CodeGen/M68k/GlobalISel/irtranslator-ret.ll
185

I don't think so...according to M68k ABI it only uses one (and two in some cases) for return values

213

I'm fine with either way. Floating point support is not our main focus now

myhsu added inline comments.Jul 2 2021, 3:10 PM
llvm/test/CodeGen/M68k/GlobalISel/irtranslator-ret.ll
185

*only uses one (or two) register(s)

myhsu added inline comments.Jul 2 2021, 3:14 PM
llvm/lib/Target/M68k/GlSel/M68kCallLowering.cpp
42

I just found that the function signature for this method was just changed recently (99c7e918b5ea2262635cc5f80b8887e487227638) so you might use an outdated LLVM tree. Please rebase to the current tip-of-tree.

Updated patch according to reviewers feedback.

sushmaunnibhavi marked 11 inline comments as done.Jul 2 2021, 10:57 PM
myhsu added inline comments.Jul 2 2021, 11:11 PM
llvm/lib/Target/M68k/GlSel/M68kCallLowering.cpp
35

still outstanding. By saying override I mean

void assignValueToReg(...) override {
  ...
}
42

ditto missing override

50

still outstanding

sushmaunnibhavi marked 3 inline comments as done.

@myhsu does the patch look good?

myhsu accepted this revision.Jul 5 2021, 11:38 AM

LGTM
Thank you!

This revision is now accepted and ready to land.Jul 5 2021, 11:38 AM
This revision was landed with ongoing or failed builds.Jul 5 2021, 11:40 AM
This revision was automatically updated to reflect the committed changes.