[llvm] [LoongArch][GlobalISel] Adding initial GlobalISel infrastructure (PR #116005)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 22 10:46:58 PST 2024


================
@@ -0,0 +1,48 @@
+//===-- LoongArchCallLowering.cpp - Call lowering ---------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+/// \file
+/// This file implements the lowering of LLVM calls to machine code calls for
+/// GlobalISel.
+//
+//===----------------------------------------------------------------------===//
+
+#include "LoongArchCallLowering.h"
+#include "LoongArchISelLowering.h"
+#include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
+
+using namespace llvm;
+
+LoongArchCallLowering::LoongArchCallLowering(const LoongArchTargetLowering &TLI)
+    : CallLowering(&TLI) {}
+
+bool LoongArchCallLowering::lowerReturn(MachineIRBuilder &MIRBuilder,
+                                        const Value *Val,
+                                        ArrayRef<Register> VRegs,
+                                        FunctionLoweringInfo &FLI) const {
+  if (Val != nullptr)
+    return false;
+
+  MachineInstrBuilder Ret = MIRBuilder.buildInstrNoInsert(LoongArch::PseudoRET);
+  MIRBuilder.insertInstr(Ret);
----------------
arsenm wrote:

You might as well just use buildInstr instead of splitting the build and insert 

https://github.com/llvm/llvm-project/pull/116005


More information about the llvm-commits mailing list