2024-10-06 05:29:02 +00:00
|
|
|
/*
|
|
|
|
target.h
|
|
|
|
|
|
|
|
Shared data stuctures for backend targets.
|
|
|
|
|
|
|
|
Copyright (C) 2024 Bill Currie <bill@taniwha.org>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
|
|
|
Boston, MA 02111-1307, USA
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __target_h
|
|
|
|
#define __target_h
|
|
|
|
|
2024-10-07 00:42:34 +00:00
|
|
|
typedef struct symbol_s symbol_t;
|
2024-11-03 09:03:31 +00:00
|
|
|
typedef struct symtab_s symtab_t;
|
2024-10-06 05:29:02 +00:00
|
|
|
typedef struct type_s type_t;
|
2024-10-26 14:30:37 +00:00
|
|
|
typedef struct function_s function_t;
|
|
|
|
typedef struct expr_s expr_t;
|
2024-11-03 09:03:31 +00:00
|
|
|
typedef struct specifier_s specifier_t;
|
2024-12-07 14:52:50 +00:00
|
|
|
typedef struct rua_ctx_s rua_ctx_t;
|
2024-10-06 05:29:02 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
bool (*value_too_large) (const type_t *val_type);
|
2024-10-07 00:42:34 +00:00
|
|
|
void (*build_scope) (symbol_t *fsym);
|
2024-10-27 11:58:23 +00:00
|
|
|
void (*build_code) (function_t *func, const expr_t *statements);
|
2024-11-03 09:03:31 +00:00
|
|
|
void (*declare_sym) (specifier_t spec, const expr_t *init,
|
2024-11-04 07:31:35 +00:00
|
|
|
symtab_t *symtab, expr_t *block);
|
2024-11-04 11:28:30 +00:00
|
|
|
void (*vararg_int) (const expr_t *e);
|
2024-11-16 14:13:46 +00:00
|
|
|
|
2024-11-17 07:17:50 +00:00
|
|
|
const expr_t *(*initialized_temp) (const type_t *type, const expr_t *src);
|
2024-11-18 05:55:32 +00:00
|
|
|
const expr_t *(*assign_vector) (const expr_t *dst, const expr_t *src);
|
2024-12-07 14:52:50 +00:00
|
|
|
const expr_t *(*proc_switch) (const expr_t *expr, rua_ctx_t *ctx);
|
|
|
|
const expr_t *(*proc_caselabel) (const expr_t *expr, rua_ctx_t *ctx);
|
|
|
|
const expr_t *(*proc_address) (const expr_t *expr, rua_ctx_t *ctx);
|
2025-01-18 05:05:09 +00:00
|
|
|
// for both vector and quaternion types
|
|
|
|
const expr_t *(*vector_compare)(int op, const expr_t *e1, const expr_t *e2);
|
2025-01-18 11:44:55 +00:00
|
|
|
const expr_t *(*shift_op)(int op, const expr_t *e1, const expr_t *e2);
|
2024-11-17 07:17:50 +00:00
|
|
|
|
2025-01-18 04:15:05 +00:00
|
|
|
bool (*setup_intrinsic_symtab) (symtab_t *symtab);
|
|
|
|
|
2024-11-16 14:13:46 +00:00
|
|
|
unsigned label_id;
|
2024-10-06 05:29:02 +00:00
|
|
|
} target_t;
|
|
|
|
|
|
|
|
extern target_t current_target;
|
|
|
|
extern target_t v6_target;
|
|
|
|
extern target_t v6p_target;
|
|
|
|
extern target_t ruamoko_target;
|
|
|
|
extern target_t spirv_target;
|
|
|
|
|
|
|
|
bool target_set_backend (const char *tgt);
|
|
|
|
|
2024-12-07 14:52:50 +00:00
|
|
|
const expr_t *ruamoko_proc_switch (const expr_t *expr, rua_ctx_t *ctx);
|
|
|
|
const expr_t *ruamoko_proc_caselabel (const expr_t *expr, rua_ctx_t *ctx);
|
2024-12-06 17:38:00 +00:00
|
|
|
const expr_t *ruamoko_field_array (const expr_t *e);
|
2024-12-07 14:52:50 +00:00
|
|
|
const expr_t *ruamoko_proc_address (const expr_t *expr, rua_ctx_t *ctx);
|
2024-12-06 17:38:00 +00:00
|
|
|
|
2024-10-06 05:29:02 +00:00
|
|
|
#endif//__target_h
|