Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. /**************************************************************************
  2.  *
  3.  * Copyright 2011-2012 Advanced Micro Devices, Inc.
  4.  * Copyright 2009 VMware, Inc.
  5.  * All Rights Reserved.
  6.  *
  7.  * Permission is hereby granted, free of charge, to any person obtaining a
  8.  * copy of this software and associated documentation files (the
  9.  * "Software"), to deal in the Software without restriction, including
  10.  * without limitation the rights to use, copy, modify, merge, publish,
  11.  * distribute, sub license, and/or sell copies of the Software, and to
  12.  * permit persons to whom the Software is furnished to do so, subject to
  13.  * the following conditions:
  14.  *
  15.  * The above copyright notice and this permission notice (including the
  16.  * next paragraph) shall be included in all copies or substantial portions
  17.  * of the Software.
  18.  *
  19.  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  20.  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  21.  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
  22.  * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
  23.  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  24.  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  25.  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  26.  *
  27.  **************************************************************************/
  28.  
  29. /**
  30.  * @file
  31.  * TGSI to LLVM IR translation.
  32.  *
  33.  * @author Jose Fonseca <jfonseca@vmware.com>
  34.  * @author Tom Stellard <thomas.stellard@amd.com>
  35.  */
  36.  
  37. #ifndef LP_BLD_TGSI_H
  38. #define LP_BLD_TGSI_H
  39.  
  40. #include "gallivm/lp_bld.h"
  41. #include "gallivm/lp_bld_tgsi_action.h"
  42. #include "gallivm/lp_bld_limits.h"
  43. #include "lp_bld_type.h"
  44. #include "pipe/p_compiler.h"
  45. #include "pipe/p_state.h"
  46. #include "tgsi/tgsi_exec.h"
  47. #include "tgsi/tgsi_scan.h"
  48. #include "tgsi/tgsi_info.h"
  49.  
  50. #define LP_CHAN_ALL ~0
  51.  
  52. #define LP_MAX_INSTRUCTIONS 256
  53.  
  54. struct tgsi_full_declaration;
  55. struct tgsi_full_immediate;
  56. struct tgsi_full_instruction;
  57. struct tgsi_full_src_register;
  58. struct tgsi_opcode_info;
  59. struct tgsi_token;
  60. struct tgsi_shader_info;
  61. struct lp_build_mask_context;
  62. struct gallivm_state;
  63. struct lp_derivatives;
  64. struct lp_build_tgsi_gs_iface;
  65.  
  66.  
  67. enum lp_build_tex_modifier {
  68.    LP_BLD_TEX_MODIFIER_NONE = 0,
  69.    LP_BLD_TEX_MODIFIER_PROJECTED,
  70.    LP_BLD_TEX_MODIFIER_LOD_BIAS,
  71.    LP_BLD_TEX_MODIFIER_EXPLICIT_LOD,
  72.    LP_BLD_TEX_MODIFIER_EXPLICIT_DERIV,
  73.    LP_BLD_TEX_MODIFIER_LOD_ZERO
  74. };
  75.  
  76.  
  77. /**
  78.  * Describe a channel of a register.
  79.  *
  80.  * The value can be a:
  81.  * - immediate value (i.e. derived from a IMM register)
  82.  * - CONST[n].x/y/z/w
  83.  * - IN[n].x/y/z/w
  84.  * - undetermined (when .file == TGSI_FILE_NULL)
  85.  *
  86.  * This is one of the analysis results, and is used to described
  87.  * the output color in terms of inputs.
  88.  */
  89. struct lp_tgsi_channel_info
  90. {
  91.    unsigned file:4; /* TGSI_FILE_* */
  92.    unsigned swizzle:3; /* PIPE_SWIZZLE_x */
  93.    union {
  94.       uint32_t index;
  95.       float value; /* for TGSI_FILE_IMMEDIATE */
  96.    } u;
  97. };
  98.  
  99.  
  100. /**
  101.  * Describe a texture sampler interpolator.
  102.  *
  103.  * The interpolation is described in terms of regular inputs.
  104.  */
  105. struct lp_tgsi_texture_info
  106. {
  107.    struct lp_tgsi_channel_info coord[4];
  108.    unsigned target:8; /* TGSI_TEXTURE_* */
  109.    unsigned sampler_unit:8;  /* Sampler unit */
  110.    unsigned texture_unit:8;  /* Texture unit */
  111.    unsigned modifier:8; /* LP_BLD_TEX_MODIFIER_* */
  112. };
  113.  
  114.  
  115. struct lp_tgsi_info
  116. {
  117.    struct tgsi_shader_info base;
  118.  
  119.    /*
  120.     * Whether any of the texture opcodes access a register file other than
  121.     * TGSI_FILE_INPUT.
  122.     *
  123.     * We could also handle TGSI_FILE_CONST/IMMEDIATE here, but there is little
  124.     * benefit.
  125.     */
  126.    unsigned indirect_textures:1;
  127.  
  128.    /*
  129.     * Whether any immediate values are outside the range of 0 and 1
  130.     */
  131.    unsigned unclamped_immediates:1;
  132.  
  133.    /*
  134.     * Texture opcode description. Aimed at detecting and described direct
  135.     * texture opcodes.
  136.     */
  137.    unsigned num_texs;
  138.    struct lp_tgsi_texture_info tex[PIPE_MAX_SAMPLERS];
  139.  
  140.    /*
  141.     * Output description. Aimed at detecting and describing simple blit
  142.     * shaders.
  143.     */
  144.    struct lp_tgsi_channel_info output[PIPE_MAX_SHADER_OUTPUTS][4];
  145.  
  146.    /*
  147.     * Shortcut pointers into the above (for fragment shaders).
  148.     */
  149.    const struct lp_tgsi_channel_info *cbuf[PIPE_MAX_COLOR_BUFS];
  150. };
  151.  
  152. /**
  153.  * Reference to system values.
  154.  */
  155. struct lp_bld_tgsi_system_values {
  156.    LLVMValueRef instance_id;
  157.    LLVMValueRef vertex_id;
  158.    LLVMValueRef prim_id;
  159. };
  160.  
  161.  
  162. /**
  163.  * Sampler code generation interface.
  164.  *
  165.  * Although texture sampling is a requirement for TGSI translation, it is
  166.  * a very different problem with several different approaches to it. This
  167.  * structure establishes an interface for texture sampling code generation, so
  168.  * that we can easily use different texture sampling strategies.
  169.  */
  170. struct lp_build_sampler_soa
  171. {
  172.    void
  173.    (*destroy)( struct lp_build_sampler_soa *sampler );
  174.  
  175.    void
  176.    (*emit_fetch_texel)( const struct lp_build_sampler_soa *sampler,
  177.                         struct gallivm_state *gallivm,
  178.                         struct lp_type type,
  179.                         boolean is_fetch,
  180.                         unsigned texture_index,
  181.                         unsigned sampler_index,
  182.                         const LLVMValueRef *coords,
  183.                         const LLVMValueRef *offsets,
  184.                         const struct lp_derivatives *derivs,
  185.                         LLVMValueRef lod_bias, /* optional */
  186.                         LLVMValueRef explicit_lod, /* optional */
  187.                         boolean scalar_lod,
  188.                         LLVMValueRef *texel);
  189.  
  190.    void
  191.    (*emit_size_query)( const struct lp_build_sampler_soa *sampler,
  192.                        struct gallivm_state *gallivm,
  193.                        struct lp_type type,
  194.                        unsigned unit,
  195.                        boolean need_nr_mips,
  196.                        LLVMValueRef explicit_lod, /* optional */
  197.                        LLVMValueRef *sizes_out);
  198. };
  199.  
  200.  
  201. struct lp_build_sampler_aos
  202. {
  203.    LLVMValueRef
  204.    (*emit_fetch_texel)( struct lp_build_sampler_aos *sampler,
  205.                         struct lp_build_context *bld,
  206.                         unsigned target, /* TGSI_TEXTURE_* */
  207.                         unsigned unit,
  208.                         LLVMValueRef coords,
  209.                         const struct lp_derivatives derivs,
  210.                         enum lp_build_tex_modifier modifier);
  211. };
  212.  
  213.  
  214. void
  215. lp_build_tgsi_info(const struct tgsi_token *tokens,
  216.                    struct lp_tgsi_info *info);
  217.  
  218.  
  219. void
  220. lp_build_tgsi_soa(struct gallivm_state *gallivm,
  221.                   const struct tgsi_token *tokens,
  222.                   struct lp_type type,
  223.                   struct lp_build_mask_context *mask,
  224.                   LLVMValueRef consts_ptr,
  225.                   const struct lp_bld_tgsi_system_values *system_values,
  226.                   const LLVMValueRef (*inputs)[4],
  227.                   LLVMValueRef (*outputs)[4],
  228.                   struct lp_build_sampler_soa *sampler,
  229.                   const struct tgsi_shader_info *info,
  230.                   const struct lp_build_tgsi_gs_iface *gs_iface);
  231.  
  232.  
  233. void
  234. lp_build_tgsi_aos(struct gallivm_state *gallivm,
  235.                   const struct tgsi_token *tokens,
  236.                   struct lp_type type,
  237.                   const unsigned char swizzles[4],
  238.                   LLVMValueRef consts_ptr,
  239.                   const LLVMValueRef *inputs,
  240.                   LLVMValueRef *outputs,
  241.                   struct lp_build_sampler_aos *sampler,
  242.                   const struct tgsi_shader_info *info);
  243.  
  244.  
  245. enum lp_exec_mask_break_type {
  246.    LP_EXEC_MASK_BREAK_TYPE_LOOP,
  247.    LP_EXEC_MASK_BREAK_TYPE_SWITCH
  248. };
  249.  
  250.  
  251. struct lp_exec_mask {
  252.    struct lp_build_context *bld;
  253.  
  254.    boolean has_mask;
  255.    boolean ret_in_main;
  256.  
  257.    LLVMTypeRef int_vec_type;
  258.  
  259.    LLVMValueRef cond_stack[LP_MAX_TGSI_NESTING];
  260.    int cond_stack_size;
  261.    LLVMValueRef cond_mask;
  262.  
  263.    /* keep track if break belongs to switch or loop */
  264.    enum lp_exec_mask_break_type break_type_stack[LP_MAX_TGSI_NESTING];
  265.    enum lp_exec_mask_break_type break_type;
  266.  
  267.    struct {
  268.       LLVMValueRef switch_val;
  269.       LLVMValueRef switch_mask;
  270.       LLVMValueRef switch_mask_default;
  271.       boolean switch_in_default;
  272.       unsigned switch_pc;
  273.    } switch_stack[LP_MAX_TGSI_NESTING];
  274.    int switch_stack_size;
  275.    LLVMValueRef switch_val;
  276.    LLVMValueRef switch_mask;         /* current switch exec mask */
  277.    LLVMValueRef switch_mask_default; /* reverse of switch mask used for default */
  278.    boolean switch_in_default;        /* if switch exec is currently in default */
  279.    unsigned switch_pc;               /* when used points to default or endswitch-1 */
  280.  
  281.    LLVMBasicBlockRef loop_block;
  282.    LLVMValueRef cont_mask;
  283.    LLVMValueRef break_mask;
  284.    LLVMValueRef break_var;
  285.    struct {
  286.       LLVMBasicBlockRef loop_block;
  287.       LLVMValueRef cont_mask;
  288.       LLVMValueRef break_mask;
  289.       LLVMValueRef break_var;
  290.    } loop_stack[LP_MAX_TGSI_NESTING];
  291.    int loop_stack_size;
  292.  
  293.    LLVMValueRef ret_mask;
  294.    struct {
  295.       int pc;
  296.       LLVMValueRef ret_mask;
  297.    } call_stack[LP_MAX_TGSI_NESTING];
  298.    int call_stack_size;
  299.  
  300.    LLVMValueRef exec_mask;
  301.    LLVMValueRef loop_limiter;
  302. };
  303.  
  304. struct lp_build_tgsi_inst_list
  305. {
  306.    struct tgsi_full_instruction *instructions;
  307.    uint max_instructions;
  308.    uint num_instructions;
  309. };
  310.  
  311. unsigned lp_bld_tgsi_list_init(struct lp_build_tgsi_context * bld_base);
  312.  
  313.  
  314. unsigned lp_bld_tgsi_add_instruction(
  315.    struct lp_build_tgsi_context * bld_base,
  316.    struct tgsi_full_instruction *inst_to_add);
  317.  
  318.  
  319. struct lp_build_tgsi_context;
  320.  
  321.  
  322. typedef LLVMValueRef (*lp_build_emit_fetch_fn)(struct lp_build_tgsi_context *,
  323.                                         const struct tgsi_full_src_register *,
  324.                                         enum tgsi_opcode_type,
  325.                                         unsigned);
  326.  
  327. struct lp_build_tgsi_context
  328. {
  329.    struct lp_build_context base;
  330.  
  331.    struct lp_build_context uint_bld;
  332.    struct lp_build_context int_bld;
  333.  
  334.    /** This array stores functions that are used to transform TGSI opcodes to
  335.      * LLVM instructions.
  336.      */
  337.    struct lp_build_tgsi_action op_actions[TGSI_OPCODE_LAST];
  338.  
  339.    /* TGSI_OPCODE_RSQ is defined as 1 / sqrt( abs(src0.x) ), rsq_action
  340.     * should compute 1 / sqrt (src0.x) */
  341.    struct lp_build_tgsi_action rsq_action;
  342.  
  343.    struct lp_build_tgsi_action sqrt_action;
  344.  
  345.    const struct tgsi_shader_info *info;
  346.  
  347.    lp_build_emit_fetch_fn emit_fetch_funcs[TGSI_FILE_COUNT];
  348.  
  349.    LLVMValueRef (*emit_swizzle)(struct lp_build_tgsi_context *,
  350.                          LLVMValueRef, unsigned, unsigned, unsigned, unsigned);
  351.  
  352.    void (*emit_store)(struct lp_build_tgsi_context *,
  353.                       const struct tgsi_full_instruction *,
  354.                       const struct tgsi_opcode_info *,
  355.                       LLVMValueRef dst[4]);
  356.  
  357.    void (*emit_declaration)(struct lp_build_tgsi_context *,
  358.                              const struct tgsi_full_declaration *decl);
  359.  
  360.    void (*emit_immediate)(struct lp_build_tgsi_context *,
  361.                           const struct tgsi_full_immediate *imm);
  362.  
  363.  
  364.    /* Allow the user to store data in this structure rather than passing it
  365.     * to every function. */
  366.    void * userdata;
  367.  
  368.    boolean soa;
  369.  
  370.    int pc;
  371.  
  372.    struct tgsi_full_instruction *instructions;
  373.    uint max_instructions;
  374.    uint num_instructions;
  375.  
  376.    /** This function allows the user to insert some instructions at the
  377.      * beginning of the program.  It is optional and does not need to be
  378.      * implemented.
  379.      */
  380.    void (*emit_prologue)(struct lp_build_tgsi_context*);
  381.  
  382.    /** This function allows the user to insert some instructions at the end of
  383.      * the program.  This callback is intended to be used for emitting
  384.      * instructions to handle the export for the output registers, but it can
  385.      * be used for any purpose.  Implementing this function is optiona, but
  386.      * recommended.
  387.      */
  388.    void (*emit_epilogue)(struct lp_build_tgsi_context*);
  389. };
  390.  
  391. struct lp_build_tgsi_gs_iface
  392. {
  393.    LLVMValueRef (*fetch_input)(const struct lp_build_tgsi_gs_iface *gs_iface,
  394.                                struct lp_build_tgsi_context * bld_base,
  395.                                boolean is_indirect,
  396.                                LLVMValueRef vertex_index,
  397.                                LLVMValueRef attrib_index,
  398.                                LLVMValueRef swizzle_index);
  399.    void (*emit_vertex)(const struct lp_build_tgsi_gs_iface *gs_iface,
  400.                        struct lp_build_tgsi_context * bld_base,
  401.                        LLVMValueRef (*outputs)[4],
  402.                        LLVMValueRef emitted_vertices_vec);
  403.    void (*end_primitive)(const struct lp_build_tgsi_gs_iface *gs_iface,
  404.                          struct lp_build_tgsi_context * bld_base,
  405.                          LLVMValueRef verts_per_prim_vec,
  406.                          LLVMValueRef emitted_prims_vec);
  407.    void (*gs_epilogue)(const struct lp_build_tgsi_gs_iface *gs_iface,
  408.                        struct lp_build_tgsi_context * bld_base,
  409.                        LLVMValueRef total_emitted_vertices_vec,
  410.                        LLVMValueRef emitted_prims_vec);
  411. };
  412.  
  413. struct lp_build_tgsi_soa_context
  414. {
  415.    struct lp_build_tgsi_context bld_base;
  416.  
  417.    /* Builder for scalar elements of shader's data type (float) */
  418.    struct lp_build_context elem_bld;
  419.  
  420.    const struct lp_build_tgsi_gs_iface *gs_iface;
  421.    LLVMValueRef emitted_prims_vec_ptr;
  422.    LLVMValueRef total_emitted_vertices_vec_ptr;
  423.    LLVMValueRef emitted_vertices_vec_ptr;
  424.    LLVMValueRef max_output_vertices_vec;
  425.  
  426.    LLVMValueRef consts_ptr;
  427.    const LLVMValueRef (*inputs)[TGSI_NUM_CHANNELS];
  428.    LLVMValueRef (*outputs)[TGSI_NUM_CHANNELS];
  429.  
  430.    const struct lp_build_sampler_soa *sampler;
  431.  
  432.    struct tgsi_declaration_sampler_view sv[PIPE_MAX_SHADER_SAMPLER_VIEWS];
  433.  
  434.    LLVMValueRef immediates[LP_MAX_TGSI_IMMEDIATES][TGSI_NUM_CHANNELS];
  435.    LLVMValueRef temps[LP_MAX_TGSI_TEMPS][TGSI_NUM_CHANNELS];
  436.    LLVMValueRef addr[LP_MAX_TGSI_ADDRS][TGSI_NUM_CHANNELS];
  437.    LLVMValueRef preds[LP_MAX_TGSI_PREDS][TGSI_NUM_CHANNELS];
  438.  
  439.    /* We allocate/use this array of temps if (1 << TGSI_FILE_TEMPORARY) is
  440.     * set in the indirect_files field.
  441.     * The temps[] array above is unused then.
  442.     */
  443.    LLVMValueRef temps_array;
  444.  
  445.    /* We allocate/use this array of output if (1 << TGSI_FILE_OUTPUT) is
  446.     * set in the indirect_files field.
  447.     * The outputs[] array above is unused then.
  448.     */
  449.    LLVMValueRef outputs_array;
  450.  
  451.    /* We allocate/use this array of inputs if (1 << TGSI_FILE_INPUT) is
  452.     * set in the indirect_files field.
  453.     * The inputs[] array above is unused then.
  454.     */
  455.    LLVMValueRef inputs_array;
  456.  
  457.    /* We allocate/use this array of temps if (1 << TGSI_FILE_IMMEDIATE) is
  458.     * set in the indirect_files field.
  459.     */
  460.    LLVMValueRef imms_array;
  461.  
  462.  
  463.    struct lp_bld_tgsi_system_values system_values;
  464.  
  465.    /** bitmask indicating which register files are accessed indirectly */
  466.    unsigned indirect_files;
  467.  
  468.    struct lp_build_mask_context *mask;
  469.    struct lp_exec_mask exec_mask;
  470.  
  471.    uint num_immediates;
  472.  
  473. };
  474.  
  475. void
  476. lp_emit_declaration_soa(
  477.    struct lp_build_tgsi_context *bld,
  478.    const struct tgsi_full_declaration *decl);
  479.  
  480. void lp_emit_immediate_soa(
  481.    struct lp_build_tgsi_context *bld_base,
  482.    const struct tgsi_full_immediate *imm);
  483.  
  484. boolean
  485. lp_emit_instruction_soa(
  486.    struct lp_build_tgsi_soa_context *bld,
  487.    const struct tgsi_full_instruction *inst,
  488.    const struct tgsi_opcode_info *info);
  489.  
  490.  
  491. LLVMValueRef
  492. lp_get_temp_ptr_soa(
  493.    struct lp_build_tgsi_soa_context *bld,
  494.    unsigned index,
  495.    unsigned chan);
  496.  
  497. LLVMValueRef
  498. lp_get_output_ptr(
  499.    struct lp_build_tgsi_soa_context *bld,
  500.    unsigned index,
  501.    unsigned chan);
  502.  
  503. struct lp_build_tgsi_aos_context
  504. {
  505.    struct lp_build_tgsi_context bld_base;
  506.  
  507.    /* Builder for integer masks and indices */
  508.    struct lp_build_context int_bld;
  509.  
  510.    /*
  511.     * AoS swizzle used:
  512.     * - swizzles[0] = red index
  513.     * - swizzles[1] = green index
  514.     * - swizzles[2] = blue index
  515.     * - swizzles[3] = alpha index
  516.     */
  517.    unsigned char swizzles[4];
  518.    unsigned char inv_swizzles[4];
  519.  
  520.    LLVMValueRef consts_ptr;
  521.    const LLVMValueRef *inputs;
  522.    LLVMValueRef *outputs;
  523.  
  524.    struct lp_build_sampler_aos *sampler;
  525.  
  526.    LLVMValueRef immediates[LP_MAX_TGSI_IMMEDIATES];
  527.    LLVMValueRef temps[LP_MAX_TGSI_TEMPS];
  528.    LLVMValueRef addr[LP_MAX_TGSI_ADDRS];
  529.    LLVMValueRef preds[LP_MAX_TGSI_PREDS];
  530.  
  531.    /* We allocate/use this array of temps if (1 << TGSI_FILE_TEMPORARY) is
  532.     * set in the indirect_files field.
  533.     * The temps[] array above is unused then.
  534.     */
  535.    LLVMValueRef temps_array;
  536.  
  537.    /** bitmask indicating which register files are accessed indirectly */
  538.    unsigned indirect_files;
  539.  
  540. };
  541.  
  542. static INLINE struct lp_build_tgsi_soa_context *
  543. lp_soa_context(struct lp_build_tgsi_context *bld_base)
  544. {
  545.    return (struct lp_build_tgsi_soa_context *)bld_base;
  546. }
  547.  
  548. static INLINE struct lp_build_tgsi_aos_context *
  549. lp_aos_context(struct lp_build_tgsi_context *bld_base)
  550. {
  551.    return (struct lp_build_tgsi_aos_context *)bld_base;
  552. }
  553.  
  554. void
  555. lp_emit_declaration_aos(
  556.    struct lp_build_tgsi_aos_context *bld,
  557.    const struct tgsi_full_declaration *decl);
  558.  
  559.  
  560. boolean
  561. lp_emit_instruction_aos(
  562.    struct lp_build_tgsi_aos_context *bld,
  563.    const struct tgsi_full_instruction *inst,
  564.    const struct tgsi_opcode_info *info,
  565.    int *pc);
  566.  
  567. void
  568. lp_emit_store_aos(
  569.    struct lp_build_tgsi_aos_context *bld,
  570.    const struct tgsi_full_instruction *inst,
  571.    unsigned index,
  572.    LLVMValueRef value);
  573.  
  574. void lp_build_fetch_args(
  575.    struct lp_build_tgsi_context * bld_base,
  576.    struct lp_build_emit_data * emit_data);
  577.  
  578. LLVMValueRef
  579. lp_build_tgsi_inst_llvm_aos(
  580.    struct lp_build_tgsi_context * bld_base,
  581.    const struct tgsi_full_instruction *inst);
  582.  
  583. void
  584. lp_build_tgsi_intrinsic(
  585.  const struct lp_build_tgsi_action * action,
  586.  struct lp_build_tgsi_context * bld_base,
  587.  struct lp_build_emit_data * emit_data);
  588.  
  589. LLVMValueRef
  590. lp_build_emit_llvm(
  591.    struct lp_build_tgsi_context *bld_base,
  592.    unsigned tgsi_opcode,
  593.    struct lp_build_emit_data * emit_data);
  594.  
  595. LLVMValueRef
  596. lp_build_emit_llvm_unary(
  597.    struct lp_build_tgsi_context *bld_base,
  598.    unsigned tgsi_opcode,
  599.    LLVMValueRef arg0);
  600.  
  601. LLVMValueRef
  602. lp_build_emit_llvm_binary(
  603.    struct lp_build_tgsi_context *bld_base,
  604.    unsigned tgsi_opcode,
  605.    LLVMValueRef arg0,
  606.    LLVMValueRef arg1);
  607.  
  608. LLVMValueRef
  609. lp_build_emit_llvm_ternary(
  610.    struct lp_build_tgsi_context *bld_base,
  611.    unsigned tgsi_opcode,
  612.    LLVMValueRef arg0,
  613.    LLVMValueRef arg1,
  614.    LLVMValueRef arg2);
  615.  
  616. boolean
  617. lp_build_tgsi_inst_llvm(
  618.    struct lp_build_tgsi_context * bld_base,
  619.    const struct tgsi_full_instruction *inst);
  620.  
  621. LLVMValueRef
  622. lp_build_emit_fetch(
  623.    struct lp_build_tgsi_context *bld_base,
  624.    const struct tgsi_full_instruction *inst,
  625.    unsigned src_op,
  626.    const unsigned chan_index);
  627.  
  628.  
  629. LLVMValueRef
  630. lp_build_emit_fetch_texoffset(
  631.    struct lp_build_tgsi_context *bld_base,
  632.    const struct tgsi_full_instruction *inst,
  633.    unsigned tex_off_op,
  634.    const unsigned chan_index);
  635.  
  636. boolean
  637. lp_build_tgsi_llvm(
  638.    struct lp_build_tgsi_context * bld_base,
  639.    const struct tgsi_token *tokens);
  640.  
  641. #endif /* LP_BLD_TGSI_H */
  642.