[llvm] [LoongArch][GlobalISel] Adding initial GlobalISel infrastructure (PR #116005)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 24 18:47:36 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);
+ return true;
+}
+
+bool LoongArchCallLowering::lowerFormalArguments(
+ MachineIRBuilder &MIRBuilder, const Function &F,
+ ArrayRef<ArrayRef<Register>> VRegs, FunctionLoweringInfo &FLI) const {
+ if (F.arg_empty())
+ return true;
+
+ return false;
----------------
zhaoqi5 wrote:
Modified. Thanks.
https://github.com/llvm/llvm-project/pull/116005
More information about the llvm-commits
mailing list