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