Revision 88663a6815cb411b0c81e6c28e7f1c7643659c30 authored by Yong He on 06 October 2022, 22:16:45 UTC, committed by GitHub on 06 October 2022, 22:16:45 UTC
* Add syntax for multi-level break.

* Fix.

* Fix.

Co-authored-by: Yong He <yhe@nvidia.com>
1 parent 50a6906
Raw File
slang-ir-specialize-buffer-load-arg.h
// slang-ir-specialize-buffer-load-arg.h
#pragma once

namespace Slang
{
struct CodeGenContext;
struct IRModule;


    /// Specialize functions in `module` that are called with direct loads from buffers.
    ///
    /// For example:
    ///
    ///     struct Params { /* many fields */ }
    ///     int helper(Params p, int x) { return p.justOneField + x; }
    ///     ...
    ///     ConstantBuffer<Params> gParams;
    ///     ...
    ///     int z = helper(gParams, y);
    ///
    /// In this case, the function `helper` declares a very large structure type as
    /// a by-value argument. Depending on the final code-generation target, this could
    /// result in output code that loads the entire contents of `gParams` before passing
    /// it to `helper`, which then uses only a single field (rendering the rest of the load
    /// operations wasted).
    ///
    /// This pass is designed to specialize a callee function like `helper` based on call
    /// sites in this form, so that the output code is:
    ///
    ///     struct Params { /* as before */ }
    ///     ConstantBuffer<Params> gParams;
    ///     int helper_1(int x) { return gParams.justOneField + x; }
    ///     ...
    ///     int z = helper_1(y);
    ///
    /// Note how in the transformed code, there is no longer any attempt to load the rest
    /// of the contents of `gParams`.
    ///
void specializeFuncsForBufferLoadArgs(
    CodeGenContext* codeGenContext,
    IRModule*       module);
}
back to top