remove the unused/strange concept of a pseudo-irg
[libfirm] / ir / be / sparc / bearch_sparc.c
1 /*
2  * Copyright (C) 1995-2010 University of Karlsruhe.  All right reserved.
3  *
4  * This file is part of libFirm.
5  *
6  * This file may be distributed and/or modified under the terms of the
7  * GNU General Public License version 2 as published by the Free Software
8  * Foundation and appearing in the file LICENSE.GPL included in the
9  * packaging of this file.
10  *
11  * Licensees holding valid libFirm Professional Edition licenses may use
12  * this file in accordance with the libFirm Commercial License.
13  * Agreement provided with the Software.
14  *
15  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17  * PURPOSE.
18  */
19
20 /**
21  * @file
22  * @brief    The main sparc backend driver file.
23  * @version  $Id$
24  */
25
26 #include "config.h"
27
28 #include "lc_opts.h"
29 #include "lc_opts_enum.h"
30
31 #include "irgwalk.h"
32 #include "irprog.h"
33 #include "irprintf.h"
34 #include "ircons.h"
35 #include "irgmod.h"
36 #include "irgopt.h"
37 #include "iroptimize.h"
38 #include "irtools.h"
39 #include "irdump.h"
40 #include "lowering.h"
41
42 #include "bitset.h"
43 #include "debug.h"
44 #include "array_t.h"
45 #include "error.h"
46
47 #include "../bearch.h"
48 #include "../benode.h"
49 #include "../belower.h"
50 #include "../besched.h"
51 #include "be.h"
52 #include "../beabi.h"
53 #include "../bemachine.h"
54 #include "../beilpsched.h"
55 #include "../bemodule.h"
56 #include "../beirg.h"
57 #include "../bespillslots.h"
58 #include "../begnuas.h"
59 #include "../belistsched.h"
60 #include "../beflags.h"
61
62 #include "bearch_sparc_t.h"
63 #include "bearch_sparc.h"
64
65 #include "sparc_new_nodes.h"
66 #include "gen_sparc_regalloc_if.h"
67 #include "sparc_transform.h"
68 #include "sparc_emitter.h"
69 #include "sparc_map_regs.h"
70
71 DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
72
73 static arch_irn_class_t sparc_classify(const ir_node *irn)
74 {
75         (void) irn;
76         return 0;
77 }
78
79 static ir_entity *sparc_get_frame_entity(const ir_node *irn)
80 {
81         const sparc_attr_t *attr = get_sparc_attr_const(irn);
82
83         if (is_sparc_FrameAddr(irn)) {
84                 const sparc_symconst_attr_t *attr = get_irn_generic_attr_const(irn);
85                 return attr->entity;
86         }
87
88         if (attr->is_load_store) {
89                 const sparc_load_store_attr_t *load_store_attr = get_sparc_load_store_attr_const(irn);
90                 if (load_store_attr->is_frame_entity) {
91                         return load_store_attr->entity;
92                 }
93         }
94
95         return NULL;
96 }
97
98 /**
99  * This function is called by the generic backend to correct offsets for
100  * nodes accessing the stack.
101  */
102 static void sparc_set_frame_offset(ir_node *irn, int offset)
103 {
104         if (is_sparc_FrameAddr(irn)) {
105                 sparc_symconst_attr_t *attr = get_irn_generic_attr(irn);
106                 attr->fp_offset += offset;
107         } else {
108                 sparc_load_store_attr_t *attr = get_sparc_load_store_attr(irn);
109                 assert(attr->base.is_load_store);
110                 attr->offset += offset;
111         }
112 }
113
114 static int sparc_get_sp_bias(const ir_node *irn)
115 {
116         (void) irn;
117         return SPARC_MIN_STACKSIZE;
118 }
119
120 /* fill register allocator interface */
121
122 static const arch_irn_ops_t sparc_irn_ops = {
123         get_sparc_in_req,
124         sparc_classify,
125         sparc_get_frame_entity,
126         sparc_set_frame_offset,
127         sparc_get_sp_bias,
128         NULL,    /* get_inverse             */
129         NULL,    /* get_op_estimated_cost   */
130         NULL,    /* possible_memory_operand */
131         NULL,    /* perform_memory_operand  */
132 };
133
134
135
136 /**
137  * Transforms the standard firm graph into
138  * a SPARC firm graph
139  */
140 static void sparc_prepare_graph(void *self)
141 {
142         sparc_code_gen_t *cg = self;
143
144         /* transform FIRM into SPARC asm nodes */
145         sparc_transform_graph(cg);
146
147         if (cg->dump)
148                 dump_ir_graph(cg->irg, "transformed");
149 }
150
151
152
153 static ir_node *sparc_flags_remat(ir_node *node, ir_node *after)
154 {
155         ir_node *block;
156         ir_node *copy;
157
158         if (is_Block(after)) {
159                 block = after;
160         } else {
161                 block = get_nodes_block(after);
162         }
163         copy = exact_copy(node);
164         set_nodes_block(copy, block);
165         sched_add_after(after, copy);
166         return copy;
167 }
168
169 static void sparc_before_ra(void *self)
170 {
171         sparc_code_gen_t *cg = self;
172         /* fixup flags register */
173         be_sched_fix_flags(cg->irg, &sparc_reg_classes[CLASS_sparc_flags], &sparc_flags_remat);
174 }
175
176 /**
177  * transform reload node => load
178  */
179 static void transform_Reload(ir_node *node)
180 {
181         ir_graph  *irg    = get_irn_irg(node);
182         ir_node   *block  = get_nodes_block(node);
183         dbg_info  *dbgi   = get_irn_dbg_info(node);
184         ir_node   *ptr    = get_irg_frame(irg);
185         ir_node   *mem    = get_irn_n(node, be_pos_Reload_mem);
186         ir_mode   *mode   = get_irn_mode(node);
187         ir_entity *entity = be_get_frame_entity(node);
188         const arch_register_t *reg;
189         ir_node   *proj;
190         ir_node   *load;
191
192         ir_node  *sched_point = sched_prev(node);
193
194         load = new_bd_sparc_Load(dbgi, block, ptr, mem, mode, entity, false, 0, true);
195         sched_add_after(sched_point, load);
196         sched_remove(node);
197
198         proj = new_rd_Proj(dbgi, load, mode, pn_sparc_Load_res);
199
200         reg = arch_get_irn_register(node);
201         arch_set_irn_register(proj, reg);
202
203         exchange(node, proj);
204 }
205
206 /**
207  * transform spill node => store
208  */
209 static void transform_Spill(ir_node *node)
210 {
211         ir_graph  *irg    = get_irn_irg(node);
212         ir_node   *block  = get_nodes_block(node);
213         dbg_info  *dbgi   = get_irn_dbg_info(node);
214         ir_node   *ptr    = get_irg_frame(irg);
215         ir_node   *mem    = new_NoMem();
216         ir_node   *val    = get_irn_n(node, be_pos_Spill_val);
217         ir_mode   *mode   = get_irn_mode(val);
218         ir_entity *entity = be_get_frame_entity(node);
219         ir_node   *sched_point;
220         ir_node   *store;
221
222         sched_point = sched_prev(node);
223         store = new_bd_sparc_Store(dbgi, block, ptr, val, mem, mode, entity, false, 0, true);
224         sched_remove(node);
225         sched_add_after(sched_point, store);
226
227         exchange(node, store);
228 }
229
230 /**
231  * walker to transform be_Spill and be_Reload nodes
232  */
233 static void sparc_after_ra_walker(ir_node *block, void *data)
234 {
235         ir_node *node, *prev;
236         (void) data;
237
238         for (node = sched_last(block); !sched_is_begin(node); node = prev) {
239                 prev = sched_prev(node);
240
241                 if (be_is_Reload(node)) {
242                         transform_Reload(node);
243                 } else if (be_is_Spill(node)) {
244                         transform_Spill(node);
245                 }
246         }
247 }
248
249
250 static void sparc_after_ra(void *self)
251 {
252         sparc_code_gen_t *cg = self;
253         be_coalesce_spillslots(cg->irg);
254
255         irg_block_walk_graph(cg->irg, NULL, sparc_after_ra_walker, NULL);
256 }
257
258
259
260 /**
261  * Emits the code, closes the output file and frees
262  * the code generator interface.
263  */
264 static void sparc_emit_and_done(void *self)
265 {
266         sparc_code_gen_t *cg = self;
267         ir_graph           *irg = cg->irg;
268
269         sparc_gen_routine(cg, irg);
270
271         /* de-allocate code generator */
272         free(cg);
273 }
274
275 static void *sparc_cg_init(ir_graph *irg);
276
277 static const arch_code_generator_if_t sparc_code_gen_if = {
278         sparc_cg_init,
279         NULL,                    /* get_pic_base hook */
280         NULL,                    /* before abi introduce hook */
281         sparc_prepare_graph,
282         NULL,                    /* spill hook */
283         sparc_before_ra,      /* before register allocation hook */
284         sparc_after_ra,       /* after register allocation hook */
285         NULL,
286         sparc_emit_and_done
287 };
288
289 /**
290  * Initializes the code generator.
291  */
292 static void *sparc_cg_init(ir_graph *irg)
293 {
294         static ir_type *int_tp = NULL;
295         sparc_isa_t      *isa = (sparc_isa_t *) be_get_irg_arch_env(irg);
296         sparc_code_gen_t *cg;
297
298         if (! int_tp) {
299                 /* create an integer type with machine size */
300                 int_tp = new_type_primitive(mode_Is);
301         }
302
303         cg                               = XMALLOC(sparc_code_gen_t);
304         cg->impl                                = &sparc_code_gen_if;
305         cg->irg                         = irg;
306         //cg->reg_set                           = new_set(arm_cmp_irn_reg_assoc, 1024);
307         cg->isa                         = isa;
308         //cg->int_tp                            = int_tp;
309         //cg->have_fp_insn      = 0;
310         //cg->unknown_gp                = NULL;
311         //cg->unknown_fpa               = NULL;
312         cg->dump                                = (be_get_irg_options(irg)->dump_flags & DUMP_BE) ? 1 : 0;
313
314         /* enter the current code generator */
315         isa->cg = cg;
316
317         return (arch_code_generator_t *)cg;
318 }
319
320
321
322 const arch_isa_if_t sparc_isa_if;
323 static sparc_isa_t sparc_isa_template = {
324         {
325                 &sparc_isa_if,             /* isa interface implementation */
326                 &sparc_gp_regs[REG_SP],  /* stack pointer register */
327                 &sparc_gp_regs[REG_FP],  /* base pointer register */
328                 &sparc_reg_classes[CLASS_sparc_gp],  /* link pointer register class */
329                 -1,                          /* stack direction */
330                 1,                           /* power of two stack alignment for calls, 2^2 == 4 */
331                 NULL,                        /* main environment */
332                 7,                           /* costs for a spill instruction */
333                 5,                           /* costs for a reload instruction */
334                 false,                       /* no custom abi handling */
335         },
336         NULL                                            /* current code generator */
337 };
338
339
340 static void sparc_handle_intrinsics(void)
341 {
342         ir_type *tp, *int_tp, *uint_tp;
343         i_record records[8];
344         int n_records = 0;
345
346         runtime_rt rt_iMod, rt_uMod;
347
348 #define ID(x) new_id_from_chars(x, sizeof(x)-1)
349
350         int_tp  = new_type_primitive(mode_Is);
351         uint_tp = new_type_primitive(mode_Iu);
352
353
354         /* SPARC has no signed mod instruction ... */
355         {
356                 i_instr_record *map_Mod = &records[n_records++].i_instr;
357
358                 tp = new_type_method(2, 1);
359                 set_method_param_type(tp, 0, int_tp);
360                 set_method_param_type(tp, 1, int_tp);
361                 set_method_res_type(tp, 0, int_tp);
362
363                 rt_iMod.ent             = new_entity(get_glob_type(), ID(".rem"), tp);
364                 set_entity_ld_ident(rt_iMod.ent, ID(".rem"));
365                 rt_iMod.mode            = mode_T;
366                 rt_iMod.res_mode        = mode_Is;
367                 rt_iMod.mem_proj_nr     = pn_Mod_M;
368                 rt_iMod.regular_proj_nr = pn_Mod_X_regular;
369                 rt_iMod.exc_proj_nr     = pn_Mod_X_except;
370                 rt_iMod.exc_mem_proj_nr = pn_Mod_M;
371                 rt_iMod.res_proj_nr     = pn_Mod_res;
372
373                 set_entity_visibility(rt_iMod.ent, ir_visibility_external);
374
375                 map_Mod->kind     = INTRINSIC_INSTR;
376                 map_Mod->op       = op_Mod;
377                 map_Mod->i_mapper = (i_mapper_func)i_mapper_RuntimeCall;
378                 map_Mod->ctx      = &rt_iMod;
379         }
380         /* ... nor an unsigned mod. */
381         {
382                 i_instr_record *map_Mod = &records[n_records++].i_instr;
383
384                 tp = new_type_method(2, 1);
385                 set_method_param_type(tp, 0, uint_tp);
386                 set_method_param_type(tp, 1, uint_tp);
387                 set_method_res_type(tp, 0, uint_tp);
388
389                 rt_uMod.ent             = new_entity(get_glob_type(), ID(".urem"), tp);
390                 set_entity_ld_ident(rt_uMod.ent, ID(".urem"));
391                 rt_uMod.mode            = mode_T;
392                 rt_uMod.res_mode        = mode_Iu;
393                 rt_uMod.mem_proj_nr     = pn_Mod_M;
394                 rt_uMod.regular_proj_nr = pn_Mod_X_regular;
395                 rt_uMod.exc_proj_nr     = pn_Mod_X_except;
396                 rt_uMod.exc_mem_proj_nr = pn_Mod_M;
397                 rt_uMod.res_proj_nr     = pn_Mod_res;
398
399                 set_entity_visibility(rt_uMod.ent, ir_visibility_external);
400
401                 map_Mod->kind     = INTRINSIC_INSTR;
402                 map_Mod->op       = op_Mod;
403                 map_Mod->i_mapper = (i_mapper_func)i_mapper_RuntimeCall;
404                 map_Mod->ctx      = &rt_uMod;
405         }
406
407         if (n_records > 0)
408                 lower_intrinsics(records, n_records, /*part_block_used=*/0);
409 }
410
411
412 /**
413  * Initializes the backend ISA
414  */
415 static arch_env_t *sparc_init(FILE *outfile)
416 {
417         static int run_once = 0;
418         sparc_isa_t *isa;
419
420         if (run_once)
421                 return NULL;
422         run_once = 1;
423
424         isa = XMALLOC(sparc_isa_t);
425         memcpy(isa, &sparc_isa_template, sizeof(*isa));
426
427         be_emit_init(outfile);
428
429         sparc_register_init();
430         sparc_create_opcodes(&sparc_irn_ops);
431         sparc_handle_intrinsics();
432
433         return &isa->arch_env;
434 }
435
436
437
438 /**
439  * Closes the output file and frees the ISA structure.
440  */
441 static void sparc_done(void *self)
442 {
443         sparc_isa_t *isa = self;
444
445         /* emit now all global declarations */
446         be_gas_emit_decls(isa->arch_env.main_env);
447
448         be_emit_exit();
449         free(self);
450 }
451
452
453 static unsigned sparc_get_n_reg_class(void)
454 {
455         return N_CLASSES;
456 }
457
458 static const arch_register_class_t *sparc_get_reg_class(unsigned i)
459 {
460         assert(i < N_CLASSES);
461         return &sparc_reg_classes[i];
462 }
463
464
465
466 /**
467  * Get the register class which shall be used to store a value of a given mode.
468  * @param self The this pointer.
469  * @param mode The mode in question.
470  * @return A register class which can hold values of the given mode.
471  */
472 static const arch_register_class_t *sparc_get_reg_class_for_mode(const ir_mode *mode)
473 {
474         if (mode_is_float(mode))
475                 return &sparc_reg_classes[CLASS_sparc_fp];
476         else
477                 return &sparc_reg_classes[CLASS_sparc_gp];
478 }
479
480
481
482 typedef struct {
483         be_abi_call_flags_bits_t flags;
484         const arch_env_t *arch_env;
485         ir_graph *irg;
486 } sparc_abi_env_t;
487
488 static void *sparc_abi_init(const be_abi_call_t *call, const arch_env_t *arch_env, ir_graph *irg)
489 {
490         sparc_abi_env_t *env = XMALLOC(sparc_abi_env_t);
491         be_abi_call_flags_t fl = be_abi_call_get_flags(call);
492         env->flags    = fl.bits;
493         env->irg      = irg;
494         env->arch_env = arch_env;
495         return env;
496 }
497
498 /**
499  * Get the between type for that call.
500  * @param self The callback object.
501  * @return The between type of for that call.
502  */
503 static ir_type *sparc_get_between_type(void *self)
504 {
505         static ir_type *between_type = NULL;
506         (void) self;
507
508         if (between_type == NULL) {
509                 between_type = new_type_class(new_id_from_str("sparc_between_type"));
510                 set_type_size_bytes(between_type, 0);
511         }
512
513         return between_type;
514 }
515
516
517 /**
518  * Build the prolog, return the BASE POINTER register
519  */
520 static const arch_register_t *sparc_abi_prologue(void *self, ir_node **mem,
521                                                     pmap *reg_map, int *stack_bias)
522 {
523         sparc_abi_env_t *env = self;
524         ir_node *block = get_irg_start_block(env->irg);
525         const arch_register_t *fp = &sparc_gp_regs[REG_FP];
526         const arch_register_t *sp = &sparc_gp_regs[REG_SP];
527
528         // sp
529         ir_node *sp_proj = be_abi_reg_map_get(reg_map, sp);
530
531
532         //ir_type *frame_type = get_irg_frame_type(env->irg);
533         //frame_alloc_area(frame_type, reserved_stack_size, 1, 1);
534
535         // alloc min required stack space
536         // TODO: the min stacksize depends on wether this is a leaf procedure or not
537         ir_node *save = new_bd_sparc_Save(NULL, block, sp_proj, *mem, SPARC_MIN_STACKSIZE);
538
539         (void) reg_map;
540         (void) mem;
541         (void) stack_bias;
542
543         *stack_bias -= SPARC_MIN_STACKSIZE;
544         sp_proj = new_r_Proj(save, sp->reg_class->mode, pn_sparc_Save_stack);
545         *mem    = new_r_Proj(save, mode_M, pn_sparc_Save_mem);
546
547         arch_set_irn_register(sp_proj, sp);
548         be_abi_reg_map_set(reg_map, sp, sp_proj);
549
550         // we always have a framepointer
551         return fp;
552 }
553
554 /* Build the epilog */
555 static void sparc_abi_epilogue(void *self, ir_node *bl, ir_node **mem,
556                                   pmap *reg_map)
557 {
558         (void) self;
559         (void) bl;
560         (void) mem;
561         (void) reg_map;
562 }
563
564 static const be_abi_callbacks_t sparc_abi_callbacks = {
565         sparc_abi_init,
566         free,
567         sparc_get_between_type,
568         sparc_abi_prologue,
569         sparc_abi_epilogue,
570 };
571
572 /**
573  * Get the ABI restrictions for procedure calls.
574  * @param self        The this pointer.
575  * @param method_type The type of the method (procedure) in question.
576  * @param abi         The abi object to be modified
577  */
578 static void sparc_get_call_abi(const void *self, ir_type *method_type,
579                                be_abi_call_t *abi)
580 {
581         ir_type  *tp;
582         ir_mode  *mode;
583         int       i, n = get_method_n_params(method_type);
584         be_abi_call_flags_t call_flags;
585         (void) self;
586
587         /* set abi flags for calls */
588         call_flags.bits.left_to_right         = 0;
589         call_flags.bits.store_args_sequential = 1;
590         /* */
591         call_flags.bits.try_omit_fp           = 0;
592         call_flags.bits.fp_free               = 0;
593         call_flags.bits.call_has_imm          = 1;
594
595         /* set stack parameter passing style */
596         be_abi_call_set_flags(abi, call_flags, &sparc_abi_callbacks);
597
598         for (i = 0; i < n; i++) {
599                 /* reg = get reg for param i;          */
600                 /* be_abi_call_param_reg(abi, i, reg); */
601
602                 /* pass outgoing params 0-5 via registers, remaining via stack */
603                 /* on sparc we need to set the ABI context since register names of parameters change to i0-i5 if we are the callee */
604                 if (i < 6) {
605                         be_abi_call_param_reg(abi, i, sparc_get_RegParamOut_reg(i), ABI_CONTEXT_CALLER);
606                         be_abi_call_param_reg(abi, i, sparc_get_RegParamIn_reg(i), ABI_CONTEXT_CALLEE);
607                 } else {
608                         tp   = get_method_param_type(method_type, i);
609                         mode = get_type_mode(tp);
610                         be_abi_call_param_stack(abi, i, mode, 4, 0, 0, ABI_CONTEXT_BOTH); /*< stack args have no special context >*/
611                 }
612         }
613
614         /* set return value register: return value is in i0 resp. f0 */
615         if (get_method_n_ress(method_type) > 0) {
616                 tp   = get_method_res_type(method_type, 0);
617                 mode = get_type_mode(tp);
618
619                 be_abi_call_res_reg(abi, 0,
620                         mode_is_float(mode) ? &sparc_fp_regs[REG_F0] : &sparc_gp_regs[REG_I0], ABI_CONTEXT_CALLEE); /*< return has no special context >*/
621
622                 be_abi_call_res_reg(abi, 0,
623                                         mode_is_float(mode) ? &sparc_fp_regs[REG_F0] : &sparc_gp_regs[REG_O0], ABI_CONTEXT_CALLER); /*< return has no special context >*/
624         }
625 }
626
627 static int sparc_to_appear_in_schedule(void *block_env, const ir_node *irn)
628 {
629         (void) block_env;
630
631         if (!is_sparc_irn(irn))
632                 return -1;
633
634         return 1;
635 }
636
637 /**
638  * Initializes the code generator interface.
639  */
640 static const arch_code_generator_if_t *sparc_get_code_generator_if(
641                 void *self)
642 {
643         (void) self;
644         return &sparc_code_gen_if;
645 }
646
647 list_sched_selector_t sparc_sched_selector;
648
649 /**
650  * Returns the reg_pressure scheduler with to_appear_in_schedule() overloaded
651  */
652 static const list_sched_selector_t *sparc_get_list_sched_selector(
653                 const void *self, list_sched_selector_t *selector)
654 {
655         (void) self;
656         (void) selector;
657
658         sparc_sched_selector = trivial_selector;
659         sparc_sched_selector.to_appear_in_schedule = sparc_to_appear_in_schedule;
660         return &sparc_sched_selector;
661 }
662
663 static const ilp_sched_selector_t *sparc_get_ilp_sched_selector(
664                 const void *self)
665 {
666         (void) self;
667         return NULL;
668 }
669
670 /**
671  * Returns the necessary byte alignment for storing a register of given class.
672  */
673 static int sparc_get_reg_class_alignment(const arch_register_class_t *cls)
674 {
675         ir_mode *mode = arch_register_class_mode(cls);
676         return get_mode_size_bytes(mode);
677 }
678
679 /**
680  * Returns the libFirm configuration parameter for this backend.
681  */
682 static const backend_params *sparc_get_backend_params(void)
683 {
684         static backend_params p = {
685                 0,     /* no dword lowering */
686                 0,     /* no inline assembly */
687                 NULL,  /* will be set later */
688                 NULL,  /* no creator function */
689                 NULL,  /* context for create_intrinsic_fkt */
690                 NULL,  /* parameter for if conversion */
691                 NULL,  /* float arithmetic mode */
692                 0,     /* no trampoline support: size 0 */
693                 0,     /* no trampoline support: align 0 */
694                 NULL,  /* no trampoline support: no trampoline builder */
695                 4      /* alignment of stack parameter: typically 4 (32bit) or 8 (64bit) */
696         };
697         return &p;
698 }
699
700 static const be_execution_unit_t ***sparc_get_allowed_execution_units(
701                 const ir_node *irn)
702 {
703         (void) irn;
704         /* TODO */
705         panic("sparc_get_allowed_execution_units not implemented yet");
706 }
707
708 static const be_machine_t *sparc_get_machine(const void *self)
709 {
710         (void) self;
711         /* TODO */
712         panic("sparc_get_machine not implemented yet");
713 }
714
715 static ir_graph **sparc_get_backend_irg_list(const void *self,
716                                                 ir_graph ***irgs)
717 {
718         (void) self;
719         (void) irgs;
720         return NULL;
721 }
722
723 static asm_constraint_flags_t sparc_parse_asm_constraint(const char **c)
724 {
725         (void) c;
726         return ASM_CONSTRAINT_FLAG_INVALID;
727 }
728
729 static int sparc_is_valid_clobber(const char *clobber)
730 {
731         (void) clobber;
732         return 0;
733 }
734
735 const arch_isa_if_t sparc_isa_if = {
736         sparc_init,
737         sparc_done,
738         NULL,                /* handle intrinsics */
739         sparc_get_n_reg_class,
740         sparc_get_reg_class,
741         sparc_get_reg_class_for_mode,
742         sparc_get_call_abi,
743         sparc_get_code_generator_if,
744         sparc_get_list_sched_selector,
745         sparc_get_ilp_sched_selector,
746         sparc_get_reg_class_alignment,
747     sparc_get_backend_params,
748         sparc_get_allowed_execution_units,
749         sparc_get_machine,
750         sparc_get_backend_irg_list,
751         NULL,                    /* mark remat */
752         sparc_parse_asm_constraint,
753         sparc_is_valid_clobber
754 };
755
756 BE_REGISTER_MODULE_CONSTRUCTOR(be_init_arch_sparc);
757 void be_init_arch_sparc(void)
758 {
759         be_register_isa_if("sparc", &sparc_isa_if);
760         FIRM_DBG_REGISTER(dbg, "firm.be.sparc.cg");
761         sparc_init_transform();
762         sparc_init_emitter();
763 }