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