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