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 "gallivm/lp_bld_sample.h" 44#include "gallivm/lp_bld_ir_common.h" 45#include "lp_bld_type.h" 46#include "pipe/p_compiler.h" 47#include "pipe/p_state.h" 48#include "tgsi/tgsi_exec.h" 49#include "tgsi/tgsi_scan.h" 50#include "tgsi/tgsi_info.h" 51 52#ifdef __cplusplus 53extern "C" { 54#endif 55 56#define LP_CHAN_ALL ~0u 57 58struct tgsi_full_declaration; 59struct tgsi_full_immediate; 60struct tgsi_full_instruction; 61struct tgsi_full_src_register; 62struct tgsi_full_dst_register; 63struct tgsi_opcode_info; 64struct tgsi_token; 65struct tgsi_shader_info; 66struct lp_build_mask_context; 67struct gallivm_state; 68struct lp_derivatives; 69struct lp_build_gs_iface; 70 71enum lp_build_tex_modifier { 72 LP_BLD_TEX_MODIFIER_NONE = 0, 73 LP_BLD_TEX_MODIFIER_PROJECTED, 74 LP_BLD_TEX_MODIFIER_LOD_BIAS, 75 LP_BLD_TEX_MODIFIER_EXPLICIT_LOD, 76 LP_BLD_TEX_MODIFIER_EXPLICIT_DERIV, 77 LP_BLD_TEX_MODIFIER_LOD_ZERO 78}; 79 80 81/** 82 * Describe a channel of a register. 83 * 84 * The value can be a: 85 * - immediate value (i.e. derived from a IMM register) 86 * - CONST[n].x/y/z/w 87 * - IN[n].x/y/z/w 88 * - undetermined (when .file == TGSI_FILE_NULL) 89 * 90 * This is one of the analysis results, and is used to described 91 * the output color in terms of inputs. 92 */ 93struct lp_tgsi_channel_info 94{ 95 unsigned file:4; /* TGSI_FILE_* */ 96 unsigned swizzle:3; /* PIPE_SWIZZLE_x */ 97 union { 98 uint32_t index; 99 float value; /* for TGSI_FILE_IMMEDIATE */ 100 } u; 101}; 102 103 104/** 105 * Describe a texture sampler interpolator. 106 * 107 * The interpolation is described in terms of regular inputs. 108 */ 109struct lp_tgsi_texture_info 110{ 111 struct lp_tgsi_channel_info coord[4]; 112 unsigned target:8; /* TGSI_TEXTURE_* */ 113 unsigned sampler_unit:8; /* Sampler unit */ 114 unsigned texture_unit:8; /* Texture unit */ 115 unsigned modifier:8; /* LP_BLD_TEX_MODIFIER_* */ 116}; 117 118 119struct lp_tgsi_info 120{ 121 struct tgsi_shader_info base; 122 123 /* 124 * Whether any of the texture opcodes access a register file other than 125 * TGSI_FILE_INPUT. 126 * 127 * We could also handle TGSI_FILE_CONST/IMMEDIATE here, but there is little 128 * benefit. 129 */ 130 unsigned indirect_textures:1; 131 132 /* 133 * Whether any of the texture (sample) ocpodes use different sampler 134 * and sampler view unit. 135 */ 136 unsigned sampler_texture_units_different:1; 137 138 /* 139 * Whether any immediate values are outside the range of 0 and 1 140 */ 141 unsigned unclamped_immediates:1; 142 143 /* 144 * Texture opcode description. Aimed at detecting and described direct 145 * texture opcodes. 146 */ 147 unsigned num_texs; 148 struct lp_tgsi_texture_info tex[PIPE_MAX_SAMPLERS]; 149 150 /* 151 * Output description. Aimed at detecting and describing simple blit 152 * shaders. 153 */ 154 struct lp_tgsi_channel_info output[PIPE_MAX_SHADER_OUTPUTS][4]; 155 156 /* 157 * Shortcut pointers into the above (for fragment shaders). 158 */ 159 const struct lp_tgsi_channel_info *cbuf[PIPE_MAX_COLOR_BUFS]; 160}; 161 162/** 163 * Reference to system values. 164 */ 165struct lp_bld_tgsi_system_values { 166 LLVMValueRef instance_id; 167 LLVMValueRef base_instance; 168 LLVMValueRef vertex_id; 169 LLVMValueRef vertex_id_nobase; 170 LLVMValueRef prim_id; 171 LLVMValueRef basevertex; 172 LLVMValueRef firstvertex; 173 LLVMValueRef invocation_id; 174 LLVMValueRef draw_id; 175 LLVMValueRef thread_id; 176 LLVMValueRef block_id; 177 LLVMValueRef grid_size; 178 LLVMValueRef front_facing; 179 LLVMValueRef work_dim; 180 LLVMValueRef block_size; 181 LLVMValueRef tess_coord; 182 LLVMValueRef tess_outer; 183 LLVMValueRef tess_inner; 184 LLVMValueRef vertices_in; 185 LLVMValueRef sample_id; 186 LLVMValueRef sample_pos; 187 LLVMValueRef sample_mask_in; 188 LLVMValueRef view_index; 189 LLVMValueRef subgroup_id; 190 LLVMValueRef num_subgroups; 191}; 192 193 194/** 195 * Sampler code generation interface. 196 * 197 * Although texture sampling is a requirement for TGSI translation, it is 198 * a very different problem with several different approaches to it. This 199 * structure establishes an interface for texture sampling code generation, so 200 * that we can easily use different texture sampling strategies. 201 */ 202struct lp_build_sampler_soa 203{ 204 void 205 (*destroy)(struct lp_build_sampler_soa *sampler); 206 207 void 208 (*emit_tex_sample)(const struct lp_build_sampler_soa *sampler, 209 struct gallivm_state *gallivm, 210 const struct lp_sampler_params *params); 211 212 void 213 (*emit_size_query)(const struct lp_build_sampler_soa *sampler, 214 struct gallivm_state *gallivm, 215 const struct lp_sampler_size_query_params *params); 216}; 217 218 219struct lp_build_sampler_aos 220{ 221 LLVMValueRef 222 (*emit_fetch_texel)(const struct lp_build_sampler_aos *sampler, 223 struct lp_build_context *bld, 224 enum tgsi_texture_type target, 225 unsigned unit, 226 LLVMValueRef coords, 227 const struct lp_derivatives derivs, 228 enum lp_build_tex_modifier modifier); 229}; 230 231struct lp_img_params; 232 233struct lp_build_image_soa 234{ 235 void 236 (*destroy)(struct lp_build_image_soa *image); 237 238 void 239 (*emit_op)(const struct lp_build_image_soa *image, 240 struct gallivm_state *gallivm, 241 const struct lp_img_params *params); 242 243 void 244 (*emit_size_query)(const struct lp_build_image_soa *sampler, 245 struct gallivm_state *gallivm, 246 const struct lp_sampler_size_query_params *params); 247}; 248 249struct lp_build_fs_iface; 250struct lp_build_fs_iface { 251 LLVMValueRef (*interp_fn)(const struct lp_build_fs_iface *iface, 252 struct lp_build_context *bld, 253 unsigned attrib, unsigned chan, 254 bool centroid, bool sample, 255 LLVMValueRef indir_index, LLVMValueRef offsets[2]); 256 257 void (*fb_fetch)(const struct lp_build_fs_iface *iface, 258 struct lp_build_context *bld, 259 int location, 260 LLVMValueRef result[4]); 261}; 262 263void 264lp_build_tgsi_info(const struct tgsi_token *tokens, 265 struct lp_tgsi_info *info); 266 267 268struct lp_build_tgsi_params { 269 struct lp_type type; 270 struct lp_build_mask_context *mask; 271 LLVMValueRef consts_ptr; 272 LLVMValueRef const_sizes_ptr; 273 const struct lp_bld_tgsi_system_values *system_values; 274 const LLVMValueRef (*inputs)[4]; 275 LLVMValueRef context_ptr; 276 LLVMValueRef thread_data_ptr; 277 const struct lp_build_sampler_soa *sampler; 278 const struct tgsi_shader_info *info; 279 const struct lp_build_gs_iface *gs_iface; 280 const struct lp_build_tcs_iface *tcs_iface; 281 const struct lp_build_tes_iface *tes_iface; 282 LLVMValueRef ssbo_ptr; 283 LLVMValueRef ssbo_sizes_ptr; 284 const struct lp_build_image_soa *image; 285 LLVMValueRef shared_ptr; 286 const struct lp_build_coro_suspend_info *coro; 287 LLVMValueRef kernel_args; 288 const struct lp_build_fs_iface *fs_iface; 289 unsigned gs_vertex_streams; 290 LLVMValueRef aniso_filter_table; 291}; 292 293void 294lp_build_tgsi_soa(struct gallivm_state *gallivm, 295 const struct tgsi_token *tokens, 296 const struct lp_build_tgsi_params *params, 297 LLVMValueRef (*outputs)[4]); 298 299void 300lp_build_tgsi_aos(struct gallivm_state *gallivm, 301 const struct tgsi_token *tokens, 302 struct lp_type type, 303 const unsigned char swizzles[4], 304 LLVMValueRef consts_ptr, 305 const LLVMValueRef *inputs, 306 LLVMValueRef *outputs, 307 const struct lp_build_sampler_aos *sampler, 308 const struct tgsi_shader_info *info); 309 310 311struct lp_build_tgsi_inst_list 312{ 313 struct tgsi_full_instruction *instructions; 314 uint max_instructions; 315 uint num_instructions; 316}; 317 318unsigned lp_bld_tgsi_list_init(struct lp_build_tgsi_context * bld_base); 319 320 321unsigned lp_bld_tgsi_add_instruction( 322 struct lp_build_tgsi_context * bld_base, 323 const struct tgsi_full_instruction *inst_to_add); 324 325 326struct lp_build_tgsi_context; 327 328 329typedef LLVMValueRef (*lp_build_emit_fetch_fn)(struct lp_build_tgsi_context *, 330 const struct tgsi_full_src_register *, 331 enum tgsi_opcode_type, 332 unsigned); 333 334typedef void (*lp_build_emit_store_reg_fn)(struct lp_build_tgsi_context *, 335 enum tgsi_opcode_type, 336 const struct tgsi_full_dst_register *, 337 unsigned, 338 unsigned, 339 LLVMValueRef, 340 LLVMValueRef); 341 342struct lp_build_tgsi_context 343{ 344 struct lp_build_context base; 345 346 struct lp_build_context uint_bld; 347 struct lp_build_context int_bld; 348 349 struct lp_build_context dbl_bld; 350 351 struct lp_build_context uint64_bld; 352 struct lp_build_context int64_bld; 353 354 /** This array stores functions that are used to transform TGSI opcodes to 355 * LLVM instructions. 356 */ 357 struct lp_build_tgsi_action op_actions[TGSI_OPCODE_LAST]; 358 359 /* TGSI_OPCODE_RSQ is defined as 1 / sqrt( abs(src0.x) ), rsq_action 360 * should compute 1 / sqrt (src0.x) */ 361 struct lp_build_tgsi_action rsq_action; 362 363 struct lp_build_tgsi_action sqrt_action; 364 365 struct lp_build_tgsi_action drsq_action; 366 367 struct lp_build_tgsi_action dsqrt_action; 368 const struct tgsi_shader_info *info; 369 370 lp_build_emit_fetch_fn emit_fetch_funcs[TGSI_FILE_COUNT]; 371 lp_build_emit_store_reg_fn emit_store_reg_funcs[TGSI_FILE_COUNT]; 372 373 LLVMValueRef (*emit_swizzle)(struct lp_build_tgsi_context *, 374 LLVMValueRef, unsigned, unsigned, unsigned, unsigned); 375 376 377 void (*emit_debug)(struct lp_build_tgsi_context *, 378 const struct tgsi_full_instruction *, 379 const struct tgsi_opcode_info *); 380 381 void (*emit_store)(struct lp_build_tgsi_context *, 382 const struct tgsi_full_instruction *, 383 const struct tgsi_opcode_info *, 384 unsigned index, 385 LLVMValueRef dst[4]); 386 387 void (*emit_declaration)(struct lp_build_tgsi_context *, 388 const struct tgsi_full_declaration *decl); 389 390 void (*emit_immediate)(struct lp_build_tgsi_context *, 391 const struct tgsi_full_immediate *imm); 392 393 394 /* Allow the user to store data in this structure rather than passing it 395 * to every function. */ 396 void * userdata; 397 398 boolean soa; 399 400 int pc; 401 402 struct tgsi_full_instruction *instructions; 403 uint max_instructions; 404 uint num_instructions; 405 406 /** This function allows the user to insert some instructions at the 407 * beginning of the program. It is optional and does not need to be 408 * implemented. 409 */ 410 void (*emit_prologue)(struct lp_build_tgsi_context*); 411 412 /** This function allows the user to insert some instructions after 413 * declarations section, but before any other code. 414 * It is optional and does not need to be implemented. 415 */ 416 void (*emit_prologue_post_decl)(struct lp_build_tgsi_context*); 417 418 /** This function allows the user to insert some instructions at the end of 419 * the program. This callback is intended to be used for emitting 420 * instructions to handle the export for the output registers, but it can 421 * be used for any purpose. Implementing this function is optiona, but 422 * recommended. 423 */ 424 void (*emit_epilogue)(struct lp_build_tgsi_context*); 425}; 426 427struct lp_build_gs_iface 428{ 429 LLVMValueRef (*fetch_input)(const struct lp_build_gs_iface *gs_iface, 430 struct lp_build_context * bld, 431 boolean is_vindex_indirect, 432 LLVMValueRef vertex_index, 433 boolean is_aindex_indirect, 434 LLVMValueRef attrib_index, 435 LLVMValueRef swizzle_index); 436 void (*emit_vertex)(const struct lp_build_gs_iface *gs_iface, 437 struct lp_build_context * bld, 438 LLVMValueRef (*outputs)[4], 439 LLVMValueRef emitted_vertices_vec, 440 LLVMValueRef mask_vec, LLVMValueRef stream_id); 441 void (*end_primitive)(const struct lp_build_gs_iface *gs_iface, 442 struct lp_build_context * bld, 443 LLVMValueRef total_emitted_vertices_vec, 444 LLVMValueRef verts_per_prim_vec, 445 LLVMValueRef emitted_prims_vec, 446 LLVMValueRef mask_vec, unsigned stream); 447 void (*gs_epilogue)(const struct lp_build_gs_iface *gs_iface, 448 LLVMValueRef total_emitted_vertices_vec, 449 LLVMValueRef emitted_prims_vec, unsigned stream); 450}; 451 452struct lp_build_tcs_iface 453{ 454 void (*emit_prologue)(struct lp_build_context * bld); 455 void (*emit_epilogue)(struct lp_build_context * bld); 456 void (*emit_barrier)(struct lp_build_context *bld_base); 457 458 void (*emit_store_output)(const struct lp_build_tcs_iface *tcs_iface, 459 struct lp_build_context * bld, 460 unsigned name, 461 boolean is_vindex_indirect, 462 LLVMValueRef vertex_index, 463 boolean is_aindex_indirect, 464 LLVMValueRef attrib_index, 465 boolean is_sindex_indirect, 466 LLVMValueRef swizzle_index, 467 LLVMValueRef value, 468 LLVMValueRef mask_vec); 469 470 LLVMValueRef (*emit_fetch_input)(const struct lp_build_tcs_iface *tcs_iface, 471 struct lp_build_context * bld, 472 boolean is_vindex_indirect, 473 LLVMValueRef vertex_index, 474 boolean is_aindex_indirect, 475 LLVMValueRef attrib_index, 476 boolean is_sindex_indirect, 477 LLVMValueRef swizzle_index); 478 479 LLVMValueRef (*emit_fetch_output)(const struct lp_build_tcs_iface *tcs_iface, 480 struct lp_build_context * bld, 481 boolean is_vindex_indirect, 482 LLVMValueRef vertex_index, 483 boolean is_aindex_indirect, 484 LLVMValueRef attrib_index, 485 boolean is_sindex_indirect, 486 LLVMValueRef swizzle_index, 487 uint32_t name); 488}; 489 490struct lp_build_tes_iface 491{ 492 LLVMValueRef (*fetch_vertex_input)(const struct lp_build_tes_iface *tes_iface, 493 struct lp_build_context * bld, 494 boolean is_vindex_indirect, 495 LLVMValueRef vertex_index, 496 boolean is_aindex_indirect, 497 LLVMValueRef attrib_index, 498 boolean is_sindex_indirect, 499 LLVMValueRef swizzle_index); 500 501 LLVMValueRef (*fetch_patch_input)(const struct lp_build_tes_iface *tes_iface, 502 struct lp_build_context * bld, 503 boolean is_aindex_indirect, 504 LLVMValueRef attrib_index, 505 LLVMValueRef swizzle_index); 506}; 507 508struct lp_build_tgsi_soa_context 509{ 510 struct lp_build_tgsi_context bld_base; 511 512 /* Builder for scalar elements of shader's data type (float) */ 513 struct lp_build_context elem_bld; 514 515 const struct lp_build_gs_iface *gs_iface; 516 const struct lp_build_tcs_iface *tcs_iface; 517 const struct lp_build_tes_iface *tes_iface; 518 519 LLVMValueRef emitted_prims_vec_ptr; 520 LLVMValueRef total_emitted_vertices_vec_ptr; 521 LLVMValueRef emitted_vertices_vec_ptr; 522 LLVMValueRef max_output_vertices_vec; 523 524 LLVMValueRef consts_ptr; 525 LLVMValueRef const_sizes_ptr; 526 LLVMValueRef consts[LP_MAX_TGSI_CONST_BUFFERS]; 527 LLVMValueRef consts_sizes[LP_MAX_TGSI_CONST_BUFFERS]; 528 const LLVMValueRef (*inputs)[TGSI_NUM_CHANNELS]; 529 LLVMValueRef (*outputs)[TGSI_NUM_CHANNELS]; 530 LLVMValueRef context_ptr; 531 LLVMValueRef thread_data_ptr; 532 533 LLVMValueRef ssbo_ptr; 534 LLVMValueRef ssbo_sizes_ptr; 535 LLVMValueRef ssbos[LP_MAX_TGSI_SHADER_BUFFERS]; 536 LLVMValueRef ssbo_sizes[LP_MAX_TGSI_SHADER_BUFFERS]; 537 538 LLVMValueRef shared_ptr; 539 540 const struct lp_build_coro_suspend_info *coro; 541 542 const struct lp_build_sampler_soa *sampler; 543 const struct lp_build_image_soa *image; 544 545 struct tgsi_declaration_sampler_view sv[PIPE_MAX_SHADER_SAMPLER_VIEWS]; 546 547 LLVMValueRef immediates[LP_MAX_INLINED_IMMEDIATES][TGSI_NUM_CHANNELS]; 548 LLVMValueRef temps[LP_MAX_INLINED_TEMPS][TGSI_NUM_CHANNELS]; 549 LLVMValueRef addr[LP_MAX_TGSI_ADDRS][TGSI_NUM_CHANNELS]; 550 551 /* We allocate/use this array of temps if (1 << TGSI_FILE_TEMPORARY) is 552 * set in the indirect_files field. 553 * The temps[] array above is unused then. 554 */ 555 LLVMValueRef temps_array; 556 557 /* We allocate/use this array of output if (1 << TGSI_FILE_OUTPUT) is 558 * set in the indirect_files field. 559 * The outputs[] array above is unused then. 560 */ 561 LLVMValueRef outputs_array; 562 563 /* We allocate/use this array of inputs if (1 << TGSI_FILE_INPUT) is 564 * set in the indirect_files field. 565 * The inputs[] array above is unused then. 566 */ 567 LLVMValueRef inputs_array; 568 569 /* We allocate/use this array of temps if (1 << TGSI_FILE_IMMEDIATE) is 570 * set in the indirect_files field. 571 */ 572 LLVMValueRef imms_array; 573 574 575 struct lp_bld_tgsi_system_values system_values; 576 577 /** bitmask indicating which register files are accessed indirectly */ 578 unsigned indirect_files; 579 580 struct lp_build_mask_context *mask; 581 struct lp_exec_mask exec_mask; 582 583 uint num_immediates; 584 boolean use_immediates_array; 585}; 586 587void 588lp_emit_declaration_soa( 589 struct lp_build_tgsi_context *bld, 590 const struct tgsi_full_declaration *decl); 591 592void lp_emit_immediate_soa( 593 struct lp_build_tgsi_context *bld_base, 594 const struct tgsi_full_immediate *imm); 595 596boolean 597lp_emit_instruction_soa( 598 struct lp_build_tgsi_soa_context *bld, 599 const struct tgsi_full_instruction *inst, 600 const struct tgsi_opcode_info *info); 601 602 603LLVMValueRef 604lp_get_temp_ptr_soa( 605 struct lp_build_tgsi_soa_context *bld, 606 unsigned index, 607 unsigned chan); 608 609LLVMValueRef 610lp_get_output_ptr( 611 struct lp_build_tgsi_soa_context *bld, 612 unsigned index, 613 unsigned chan); 614 615struct lp_build_tgsi_aos_context 616{ 617 struct lp_build_tgsi_context bld_base; 618 619 /* Builder for integer masks and indices */ 620 struct lp_build_context int_bld; 621 622 /* 623 * AoS swizzle used: 624 * - swizzles[0] = red index 625 * - swizzles[1] = green index 626 * - swizzles[2] = blue index 627 * - swizzles[3] = alpha index 628 */ 629 unsigned char swizzles[4]; 630 unsigned char inv_swizzles[4]; 631 632 LLVMValueRef consts_ptr; 633 const LLVMValueRef *inputs; 634 LLVMValueRef *outputs; 635 636 const struct lp_build_sampler_aos *sampler; 637 638 struct tgsi_declaration_sampler_view sv[PIPE_MAX_SHADER_SAMPLER_VIEWS]; 639 640 LLVMValueRef immediates[LP_MAX_INLINED_IMMEDIATES]; 641 LLVMValueRef temps[LP_MAX_INLINED_TEMPS]; 642 LLVMValueRef addr[LP_MAX_TGSI_ADDRS]; 643 644 /* We allocate/use this array of temps if (1 << TGSI_FILE_TEMPORARY) is 645 * set in the indirect_files field. 646 * The temps[] array above is unused then. 647 */ 648 LLVMValueRef temps_array; 649 650 /** bitmask indicating which register files are accessed indirectly */ 651 unsigned indirect_files; 652 653}; 654 655static inline struct lp_build_tgsi_soa_context * 656lp_soa_context(struct lp_build_tgsi_context *bld_base) 657{ 658 return (struct lp_build_tgsi_soa_context *)bld_base; 659} 660 661static inline struct lp_build_tgsi_aos_context * 662lp_aos_context(struct lp_build_tgsi_context *bld_base) 663{ 664 return (struct lp_build_tgsi_aos_context *)bld_base; 665} 666 667void 668lp_emit_declaration_aos( 669 struct lp_build_tgsi_aos_context *bld, 670 const struct tgsi_full_declaration *decl); 671 672 673boolean 674lp_emit_instruction_aos( 675 struct lp_build_tgsi_aos_context *bld, 676 const struct tgsi_full_instruction *inst, 677 const struct tgsi_opcode_info *info, 678 int *pc); 679 680void 681lp_emit_store_aos( 682 struct lp_build_tgsi_aos_context *bld, 683 const struct tgsi_full_instruction *inst, 684 unsigned index, 685 LLVMValueRef value); 686 687void lp_build_fetch_args( 688 struct lp_build_tgsi_context * bld_base, 689 struct lp_build_emit_data * emit_data); 690 691LLVMValueRef 692lp_build_tgsi_inst_llvm_aos( 693 struct lp_build_tgsi_context * bld_base, 694 const struct tgsi_full_instruction *inst); 695 696void 697lp_build_tgsi_intrinsic( 698 const struct lp_build_tgsi_action * action, 699 struct lp_build_tgsi_context * bld_base, 700 struct lp_build_emit_data * emit_data); 701 702LLVMValueRef 703lp_build_emit_llvm( 704 struct lp_build_tgsi_context *bld_base, 705 unsigned tgsi_opcode, 706 struct lp_build_emit_data * emit_data); 707 708LLVMValueRef 709lp_build_emit_llvm_unary( 710 struct lp_build_tgsi_context *bld_base, 711 unsigned tgsi_opcode, 712 LLVMValueRef arg0); 713 714LLVMValueRef 715lp_build_emit_llvm_binary( 716 struct lp_build_tgsi_context *bld_base, 717 unsigned tgsi_opcode, 718 LLVMValueRef arg0, 719 LLVMValueRef arg1); 720 721LLVMValueRef 722lp_build_emit_llvm_ternary( 723 struct lp_build_tgsi_context *bld_base, 724 unsigned tgsi_opcode, 725 LLVMValueRef arg0, 726 LLVMValueRef arg1, 727 LLVMValueRef arg2); 728 729boolean 730lp_build_tgsi_inst_llvm( 731 struct lp_build_tgsi_context * bld_base, 732 const struct tgsi_full_instruction *inst); 733 734LLVMValueRef 735lp_build_emit_fetch_src( 736 struct lp_build_tgsi_context *bld_base, 737 const struct tgsi_full_src_register *reg, 738 enum tgsi_opcode_type stype, 739 const unsigned chan_index); 740 741LLVMValueRef 742lp_build_emit_fetch( 743 struct lp_build_tgsi_context *bld_base, 744 const struct tgsi_full_instruction *inst, 745 unsigned src_op, 746 const unsigned chan_index); 747 748 749LLVMValueRef 750lp_build_emit_fetch_texoffset( 751 struct lp_build_tgsi_context *bld_base, 752 const struct tgsi_full_instruction *inst, 753 unsigned tex_off_op, 754 const unsigned chan_index); 755 756boolean 757lp_build_tgsi_llvm( 758 struct lp_build_tgsi_context * bld_base, 759 const struct tgsi_token *tokens); 760 761#ifdef __cplusplus 762} 763#endif 764 765#endif /* LP_BLD_TGSI_H */ 766