[llvm-dev] RFC: Pass for lowering "non-linear" arithmetics of illegal types
Paweł Bylica via llvm-dev
llvm-dev at lists.llvm.org
Tue Oct 6 12:31:09 PDT 2015
No more comments so far, but I have some questions about passes
Can the pass be implemented for the new pass manager? If yes, will it be
able to be used by the legacy pass manager?
I think the simplest starting point is basic block pass. Can a basic block
pass add new function declarations and/or definitions to the module it runs
If basic block is not an option should it be a module pass that trivially
iterates over all functions and blocks? From my little experience such
passes performed quite badly.
The third option I can think of is some combination of analysis and
On Tue, Oct 6, 2015 at 12:44 AM Paweł Bylica <chfast at gmail.com> wrote:
> On Tue, Oct 6, 2015 at 12:25 AM Tim Northover <t.p.northover at gmail.com>
>> 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
>> > and udivrem algorithms for integer types of sizes being powers of 2
>> > 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).
> You are probably right. It makes more sense in general case. I was too
> focused on mine. However, we can have both easily. The generator can return
> either function declaration or function definition.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev