[llvm] GlobalISel: Use LibcallLoweringInfo analysis in legalizer (PR #170328)

Saleem Abdulrasool via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 15 08:19:38 PST 2026


================
@@ -178,6 +184,37 @@ class LegalizerHelper {
   /// def by inserting a G_BITCAST from \p CastTy
   LLVM_ABI void bitcastDst(MachineInstr &MI, LLT CastTy, unsigned OpIdx);
 
+  // Useful for libcalls where all operands have the same type.
+  LLVM_ABI LegalizeResult
+  simpleLibcall(MachineInstr &MI, MachineIRBuilder &MIRBuilder, unsigned Size,
+                Type *OpType, LostDebugLocObserver &LocObserver) const;
+
+  LLVM_ABI LegalizeResult conversionLibcall(MachineInstr &MI, Type *ToType,
----------------
compnerd wrote:

I'm not a fan of this API. I wonder if we can generalise this into the `createLibcall` instead. Starting to create separate entry points for the libcalls feels like it invites the per-libcall constructor. We could have a utility to create these if that is helpful:

```
LegalizeResult createLibCall(const Libcall &LC, ArrayRef<MachineOperand> &Operands);
```

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


More information about the llvm-commits mailing list