1 /*
2  * Copyright 2011 Tom Stellard <tstellar@gmail.com>
3  * Copyright 2013 Advanced Micro Devices, Inc.
4  *
5  * All Rights Reserved.
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining
8  * a 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, sublicense, 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
17  * portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22  * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
23  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26  *
27  * Author: Tom Stellard <thomas.stellard@amd.com>
28  */
29 
30 #include "radeon_compiler.h"
31 
32 struct rc_test_file {
33 	unsigned num_input_lines;
34 	char **input;
35 	unsigned num_expected_lines;
36 	char **expected;
37 };
38 
39 int init_rc_normal_src(
40 	struct rc_instruction * inst,
41 	unsigned int src_index,
42 	const char * src_str);
43 
44 int init_rc_normal_dst(
45 	struct rc_instruction * inst,
46 	const char * dst_str);
47 
48 int parse_rc_normal_instruction(
49 	struct rc_instruction * inst,
50 	const char * inst_str);
51 
52 int parse_constant(unsigned *index, float *data, const char *const_str);
53 
54 int init_rc_normal_instruction(
55 	struct rc_instruction * inst,
56 	const char * inst_str);
57 
58 void add_instruction(struct radeon_compiler *c, const char * inst_string);
59 
60 int add_constant(struct radeon_compiler *c, const char *const_str);
61 
62 void init_compiler(
63 	struct radeon_compiler *c,
64 	enum rc_program_type program_type,
65 	unsigned is_r500,
66 	unsigned is_r400);
67 
68 unsigned load_program(
69 	struct radeon_compiler *c,
70 	struct rc_test_file *test,
71 	const char *filename);
72