[llvm-dev] RFC: Pass for lowering "non-linear" arithmetics of illegal types

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Mon Oct 5 15:25:06 PDT 2015


On 5 October 2015 at 15:09, Paweł Bylica <llvm-dev at lists.llvm.org> wrote:
> The pass replaces instructions mul, udiv, urem, sdiv, srem that are know to
> be not supported by target's type legalization with a call to a function
> that implements given arithmetic operation.

This seems quite sensible, those functions can get bigger than you'd
want to inline.

> The pass also injects these functions to the module with a weak linkage.
> The pass requires a function generator (interface implementation) for mul
> and udivrem algorithms for integer types of sizes being powers of 2 (i.e.
> i128, i256, ...). Replacements for other instructions are created using
> these 2 algorithms.

This sounds a bit weird though. It seems more natural to make these
part of a runtime support library for your language (like compiler-rt
is for C).

Cheers.

Tim.


More information about the llvm-dev mailing list