M680x0-llvm
M680x0-llvm copied to clipboard
Convert to new LLVM git monorepo
LLVM upstream has recently switched from SVN to Git and created a new monorepo which includes all subprojects (llvm, clang etc) in a single repository.
To rebase M680x0-llvm to the new monorepo, the following steps have to be performed:
$ git clone https://github.com/jyknight/llvm-git-migration
$ mkdir llvm-migrate
$ cd llvm-migrate
$ git init
$ git remote add --no-tags new https://github.com/llvm/llvm-project
$ git remote add --no-tags old/llvm https://github.com/llvm-mirror/llvm
$ git remote add m680x0/llvm https://github.com/M680x0/M680x0-llvm.git
$ git fetch --all
$ ../llvm-git-migration/migrate-downstream-fork.py refs/remotes/m680x0 refs/tags
$ git checkout remotes/m680x0/llvm/M680x0
$ git rebase remotes/new/master
There is a small merge conflict that needs to be fixed manually during the rebase. After that, just run git rebase --continue and the rebase is complete.
After that, the following two patches were necessary to fix the build together with the changes from #56:
commit 37e99041b1b9e0786c7eac0ba1ed9cb22c5e386d
Author: John Paul Adrian Glaubitz <[email protected]>
Date: Thu Jun 27 16:18:49 2019 +0200
[M680x0] Accomodate for optForMinSize() being renamed to hasOptSize()
diff --git a/llvm/lib/Target/M680x0/M680x0ISelLowering.cpp b/llvm/lib/Target/M680x0/M680x0ISelLowering.cpp
index c7868c5ac0d..f932c6ad920 100644
--- a/llvm/lib/Target/M680x0/M680x0ISelLowering.cpp
+++ b/llvm/lib/Target/M680x0/M680x0ISelLowering.cpp
@@ -2051,7 +2051,7 @@ SDValue M680x0TargetLowering::EmitCmp(SDValue Op0, SDValue Op1,
// with an immediate. 16 bit immediates are to be avoided.
if ((Op0.getValueType() == MVT::i16 &&
(isa<ConstantSDNode>(Op0) || isa<ConstantSDNode>(Op1))) &&
- !DAG.getMachineFunction().getFunction().optForMinSize()) {
+ !DAG.getMachineFunction().getFunction().hasOptSize()) {
unsigned ExtendOp =
isM680x0CCUnsigned(M680x0CC) ? ISD::ZERO_EXTEND : ISD::SIGN_EXTEND;
Op0 = DAG.getNode(ExtendOp, DL, MVT::i32, Op0);
and
commit 2dc382f7c5babee3154077843dd7672b227e1bbd
Author: John Paul Adrian Glaubitz <[email protected]>
Date: Thu Jun 27 16:20:14 2019 +0200
[M680x0] getFrameRegister() returns Register instead of unsigned
diff --git a/llvm/lib/Target/M680x0/M680x0RegisterInfo.cpp b/llvm/lib/Target/M680x0/M680x0RegisterInfo.cpp
index 8bf1b110516..3d897044fc7 100644
--- a/llvm/lib/Target/M680x0/M680x0RegisterInfo.cpp
+++ b/llvm/lib/Target/M680x0/M680x0RegisterInfo.cpp
@@ -270,7 +270,7 @@ bool M680x0RegisterInfo::canRealignStack(const MachineFunction &MF) const {
return true;
}
-unsigned M680x0RegisterInfo::getFrameRegister(const MachineFunction &MF) const {
+Register M680x0RegisterInfo::getFrameRegister(const MachineFunction &MF) const {
const TargetFrameLowering *TFI = MF.getSubtarget().getFrameLowering();
return TFI->hasFP(MF) ? FramePtr : StackPtr;
}
diff --git a/llvm/lib/Target/M680x0/M680x0RegisterInfo.h b/llvm/lib/Target/M680x0/M680x0RegisterInfo.h
index e630f840166..c2c5ab4ded8 100644
--- a/llvm/lib/Target/M680x0/M680x0RegisterInfo.h
+++ b/llvm/lib/Target/M680x0/M680x0RegisterInfo.h
@@ -97,7 +97,7 @@ public:
/// True if the stack can be realigned for the target.
bool canRealignStack(const MachineFunction &MF) const override;
- unsigned getFrameRegister(const MachineFunction &MF) const override;
+ Register getFrameRegister(const MachineFunction &MF) const override;
unsigned getStackRegister() const { return StackPtr; }
unsigned getBaseRegister() const { return BasePtr; }
unsigned getGlobalBaseRegister() const { return GlobalBasePtr; }
Is development of this continuing in another repo, or stalled due to the lengthy review process? It would be a shame for this work not to come to fruition.
@glaubitz I tried running your instructions on my fork of LLVM-M680x0 but it fails on the migrate-downstream-fork.py line. What version of python does this script take?
Never mind. It worked with Python 2.7 but not 3.7.
@SamuraiCrow I need to update the instructions anyway as I forgot to incorporate clang as well.
@DestyNova This is the main development repository and development is indeed currently stalled but it's not going to be dropped. Also, if you want to discuss, please join #llvm-m68k on OFTC IRC network.
Thanks @glaubitz. I joined the chatroom a week or so ago and asked there, but haven't seen any responses since. Glad to hear this effort is still moving though!
I think getting the M680x0 changes atop the main LLVM monorepo will help a lot with momentum, because it’ll make it much easier to track LLVM. I was surprised to learn this hasn’t been rebased for LLVM 8 or 9 (since it started right before the release/8.x branch).
A simpler way to get this atop the monorepo is to:
- Create an M680x0 branch in your clone of the monorepo, starting with the same commit (which has a different hash, alas) as the one the current repo started from.
- Using the current repo, do a
git format-patch master..M680x0to generate a patch set. - Apply that patch set to the M680x0 branch of the monorepo:
for p in ../M680x0-patches/*.patch ; do
git am --directory=llvm "$p"
done
The entire patch set appears to apply cleanly for me. The resulting branch also easily rebases atop the LLVM monorepo’s release/8.x branch. (I suspect rebasing atop release/9.x will be more difficult just due to API changes…)
Just FYI, LLVM just branched for 10.0 and LLVM master is targeting 11.0 now. That means there’s a release/10.x that could be rebased atop without being such a moving target as mainline.