1 /* Register renaming for the GNU compiler.
2 Copyright (C) 2000 Free Software Foundation, Inc.
4 This file is part of GNU CC.
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
27 #include "insn-config.h"
29 #include "hard-reg-set.h"
30 #include "basic-block.h"
38 #define obstack_chunk_alloc xmalloc
39 #define obstack_chunk_free free
41 #ifndef REGNO_MODE_OK_FOR_BASE_P
42 #define REGNO_MODE_OK_FOR_BASE_P(REGNO, MODE) REGNO_OK_FOR_BASE_P (REGNO)
45 #ifndef REG_MODE_OK_FOR_BASE_P
46 #define REG_MODE_OK_FOR_BASE_P(REGNO, MODE) REG_OK_FOR_BASE_P (REGNO)
49 static const char *const reg_class_names[] = REG_CLASS_NAMES;
53 struct du_chain *next_chain;
54 struct du_chain *next_use;
59 unsigned int need_caller_save_reg:1;
60 unsigned int earlyclobber:1;
66 terminate_overlapping_read,
73 static const char * const scan_actions_name[] =
76 "terminate_overlapping_read",
83 static struct obstack rename_obstack;
85 static void do_replace PARAMS ((struct du_chain *, int));
86 static void scan_rtx_reg PARAMS ((rtx, rtx *, enum reg_class,
87 enum scan_actions, enum op_type, int));
88 static void scan_rtx_address PARAMS ((rtx, rtx *, enum reg_class,
89 enum scan_actions, enum machine_mode));
90 static void scan_rtx PARAMS ((rtx, rtx *, enum reg_class,
91 enum scan_actions, enum op_type, int));
92 static struct du_chain *build_def_use PARAMS ((basic_block));
93 static void dump_def_use_chain PARAMS ((struct du_chain *));
94 static void note_sets PARAMS ((rtx, rtx, void *));
95 static void clear_dead_regs PARAMS ((HARD_REG_SET *, enum machine_mode, rtx));
96 static void merge_overlapping_regs PARAMS ((basic_block, HARD_REG_SET *,
99 /* Called through note_stores from update_life. Find sets of registers, and
100 record them in *DATA (which is actually a HARD_REG_SET *). */
103 note_sets (x, set, data)
105 rtx set ATTRIBUTE_UNUSED;
108 HARD_REG_SET *pset = (HARD_REG_SET *) data;
111 if (GET_CODE (x) != REG)
114 nregs = HARD_REGNO_NREGS (regno, GET_MODE (x));
116 SET_HARD_REG_BIT (*pset, regno + nregs);
119 /* Clear all registers from *PSET for which a note of kind KIND can be found
120 in the list NOTES. */
123 clear_dead_regs (pset, kind, notes)
125 enum machine_mode kind;
129 for (note = notes; note; note = XEXP (note, 1))
130 if (REG_NOTE_KIND (note) == kind && REG_P (XEXP (note, 0)))
132 rtx reg = XEXP (note, 0);
133 unsigned int regno = REGNO (reg);
134 int nregs = HARD_REGNO_NREGS (regno, GET_MODE (reg));
136 CLEAR_HARD_REG_BIT (*pset, regno + nregs);
140 /* For a def-use chain CHAIN in basic block B, find which registers overlap
141 its lifetime and set the corresponding bits in *PSET. */
144 merge_overlapping_regs (b, pset, chain)
147 struct du_chain *chain;
149 struct du_chain *t = chain;
153 REG_SET_TO_HARD_REG_SET (live, b->global_live_at_start);
157 /* Search forward until the next reference to the register to be
159 while (insn != t->insn)
163 clear_dead_regs (&live, REG_DEAD, REG_NOTES (insn));
164 note_stores (PATTERN (insn), note_sets, (void *) &live);
165 /* Only record currently live regs if we are inside the
168 IOR_HARD_REG_SET (*pset, live);
169 clear_dead_regs (&live, REG_UNUSED, REG_NOTES (insn));
171 insn = NEXT_INSN (insn);
174 IOR_HARD_REG_SET (*pset, live);
176 /* For the last reference, also merge in all registers set in the
178 @@@ We only have take earlyclobbered sets into account. */
180 note_stores (PATTERN (insn), note_sets, (void *) pset);
186 /* Perform register renaming on the current function. */
189 regrename_optimize ()
191 int tick[FIRST_PSEUDO_REGISTER];
196 memset (tick, 0, sizeof tick);
198 gcc_obstack_init (&rename_obstack);
199 first_obj = (char *) obstack_alloc (&rename_obstack, 0);
201 for (b = 0; b < n_basic_blocks; b++)
203 basic_block bb = BASIC_BLOCK (b);
204 struct du_chain *all_chains = 0;
205 HARD_REG_SET unavailable;
206 HARD_REG_SET regs_seen;
208 CLEAR_HARD_REG_SET (unavailable);
211 fprintf (rtl_dump_file, "\nBasic block %d:\n", b);
213 all_chains = build_def_use (bb);
216 dump_def_use_chain (all_chains);
218 CLEAR_HARD_REG_SET (unavailable);
219 /* Don't clobber traceback for noreturn functions. */
220 if (frame_pointer_needed)
222 SET_HARD_REG_BIT (unavailable, FRAME_POINTER_REGNUM);
223 #if FRAME_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
224 SET_HARD_REG_BIT (unavailable, HARD_FRAME_POINTER_REGNUM);
228 CLEAR_HARD_REG_SET (regs_seen);
231 int new_reg, best_new_reg = -1;
233 struct du_chain *this = all_chains;
234 struct du_chain *tmp, *last;
235 HARD_REG_SET this_unavailable;
236 int reg = REGNO (*this->loc), treg;
237 int nregs = HARD_REGNO_NREGS (reg, GET_MODE (*this->loc));
240 all_chains = this->next_chain;
242 #if 0 /* This just disables optimization opportunities. */
243 /* Only rename once we've seen the reg more than once. */
244 if (! TEST_HARD_REG_BIT (regs_seen, reg))
246 SET_HARD_REG_BIT (regs_seen, reg);
251 if (fixed_regs[reg] || global_regs[reg])
254 COPY_HARD_REG_SET (this_unavailable, unavailable);
256 /* Find last entry on chain (which has the need_caller_save bit),
257 count number of uses, and narrow the set of registers we can
260 for (last = this; last->next_use; last = last->next_use)
263 IOR_COMPL_HARD_REG_SET (this_unavailable,
264 reg_class_contents[last->class]);
269 IOR_COMPL_HARD_REG_SET (this_unavailable,
270 reg_class_contents[last->class]);
272 if (this->need_caller_save_reg)
273 IOR_HARD_REG_SET (this_unavailable, call_used_reg_set);
275 merge_overlapping_regs (bb, &this_unavailable, this);
277 /* Now potential_regs is a reasonable approximation, let's
278 have a closer look at each register still in there. */
279 for (treg = 0; treg < FIRST_PSEUDO_REGISTER; treg++)
282 for (i = nregs - 1; i >= 0; --i)
283 if (TEST_HARD_REG_BIT (this_unavailable, new_reg + i)
284 || fixed_regs[new_reg + i]
285 || global_regs[new_reg + i]
286 /* Can't use regs which aren't saved by the prologue. */
287 || (! regs_ever_live[new_reg + i]
288 && ! call_used_regs[new_reg + i])
289 #ifdef HARD_REGNO_RENAME_OK
290 || ! HARD_REGNO_RENAME_OK (reg + i, new_reg + i)
297 /* See whether it accepts all modes that occur in
298 definition and uses. */
299 for (tmp = this; tmp; tmp = tmp->next_use)
300 if (! HARD_REGNO_MODE_OK (new_reg, GET_MODE (*tmp->loc)))
304 if (best_new_reg == -1
305 || tick[best_new_reg] > tick[new_reg])
306 best_new_reg = new_reg;
312 fprintf (rtl_dump_file, "Register %s in insn %d",
313 reg_names[reg], INSN_UID (last->insn));
314 if (last->need_caller_save_reg)
315 fprintf (rtl_dump_file, " crosses a call");
318 if (best_new_reg == -1)
321 fprintf (rtl_dump_file, "; no available registers\n");
325 do_replace (this, best_new_reg);
326 tick[best_new_reg] = this_tick++;
329 fprintf (rtl_dump_file, ", renamed as %s\n", reg_names[best_new_reg]);
332 obstack_free (&rename_obstack, first_obj);
335 obstack_free (&rename_obstack, NULL);
338 fputc ('\n', rtl_dump_file);
340 count_or_remove_death_notes (NULL, 1);
341 update_life_info (NULL, UPDATE_LIFE_LOCAL,
342 PROP_REG_INFO | PROP_DEATH_NOTES);
346 do_replace (chain, reg)
347 struct du_chain *chain;
352 *chain->loc = gen_rtx_REG (GET_MODE (*chain->loc), reg);
353 chain = chain->next_use;
358 static struct du_chain *open_chains;
359 static struct du_chain *closed_chains;
362 scan_rtx_reg (insn, loc, class, action, type, earlyclobber)
365 enum reg_class class;
366 enum scan_actions action;
372 enum machine_mode mode = GET_MODE (x);
373 int this_regno = REGNO (x);
374 int this_nregs = HARD_REGNO_NREGS (this_regno, mode);
376 if (action == mark_write)
380 struct du_chain *this = (struct du_chain *)
381 obstack_alloc (&rename_obstack, sizeof (struct du_chain));
383 this->next_chain = open_chains;
387 this->need_caller_save_reg = 0;
388 this->earlyclobber = earlyclobber;
394 if ((type == OP_OUT && action != terminate_write)
395 || (type != OP_OUT && action == terminate_write))
398 for (p = &open_chains; *p;)
400 struct du_chain *this = *p;
402 /* Check if the chain has been terminated if it has then skip to
405 This can happen when we've already appended the location to
406 the chain in Step 3, but are trying to hide in-out operands
407 from terminate_write in Step 5. */
409 if (*this->loc == cc0_rtx)
410 p = &this->next_chain;
413 int regno = REGNO (*this->loc);
414 int nregs = HARD_REGNO_NREGS (regno, GET_MODE (*this->loc));
415 int exact_match = (regno == this_regno && nregs == this_nregs);
417 if (regno + nregs <= this_regno
418 || this_regno + this_nregs <= regno)
420 p = &this->next_chain;
424 if (action == mark_read)
429 /* ??? Class NO_REGS can happen if the md file makes use of
430 EXTRA_CONSTRAINTS to match registers. Which is arguably
431 wrong, but there we are. Since we know not what this may
432 be replaced with, terminate the chain. */
433 if (class != NO_REGS)
435 this = (struct du_chain *)
436 obstack_alloc (&rename_obstack, sizeof (struct du_chain));
438 this->next_chain = (*p)->next_chain;
442 this->need_caller_save_reg = 0;
450 if (action != terminate_overlapping_read || ! exact_match)
452 struct du_chain *next = this->next_chain;
454 /* Whether the terminated chain can be used for renaming
455 depends on the action and this being an exact match.
456 In either case, we remove this element from open_chains. */
458 if ((action == terminate_dead || action == terminate_write)
461 this->next_chain = closed_chains;
462 closed_chains = this;
464 fprintf (rtl_dump_file,
465 "Closing chain %s at insn %d (%s)\n",
466 reg_names[REGNO (*this->loc)], INSN_UID (insn),
467 scan_actions_name[(int) action]);
472 fprintf (rtl_dump_file,
473 "Discarding chain %s at insn %d (%s)\n",
474 reg_names[REGNO (*this->loc)], INSN_UID (insn),
475 scan_actions_name[(int) action]);
480 p = &this->next_chain;
485 /* Adapted from find_reloads_address_1. CLASS is INDEX_REG_CLASS or
486 BASE_REG_CLASS depending on how the register is being considered. */
489 scan_rtx_address (insn, loc, class, action, mode)
492 enum reg_class class;
493 enum scan_actions action;
494 enum machine_mode mode;
497 RTX_CODE code = GET_CODE (x);
501 if (action == mark_write)
508 rtx orig_op0 = XEXP (x, 0);
509 rtx orig_op1 = XEXP (x, 1);
510 RTX_CODE code0 = GET_CODE (orig_op0);
511 RTX_CODE code1 = GET_CODE (orig_op1);
517 if (GET_CODE (op0) == SUBREG)
519 op0 = SUBREG_REG (op0);
520 code0 = GET_CODE (op0);
523 if (GET_CODE (op1) == SUBREG)
525 op1 = SUBREG_REG (op1);
526 code1 = GET_CODE (op1);
529 if (code0 == MULT || code0 == SIGN_EXTEND || code0 == TRUNCATE
530 || code0 == ZERO_EXTEND || code1 == MEM)
535 else if (code1 == MULT || code1 == SIGN_EXTEND || code1 == TRUNCATE
536 || code1 == ZERO_EXTEND || code0 == MEM)
541 else if (code0 == CONST_INT || code0 == CONST
542 || code0 == SYMBOL_REF || code0 == LABEL_REF)
544 else if (code1 == CONST_INT || code1 == CONST
545 || code1 == SYMBOL_REF || code1 == LABEL_REF)
547 else if (code0 == REG && code1 == REG)
551 if (REG_OK_FOR_INDEX_P (op0)
552 && REG_MODE_OK_FOR_BASE_P (op1, mode))
554 else if (REG_OK_FOR_INDEX_P (op1)
555 && REG_MODE_OK_FOR_BASE_P (op0, mode))
557 else if (REG_MODE_OK_FOR_BASE_P (op1, mode))
559 else if (REG_MODE_OK_FOR_BASE_P (op0, mode))
561 else if (REG_OK_FOR_INDEX_P (op1))
566 locI = &XEXP (x, index_op);
567 locB = &XEXP (x, !index_op);
569 else if (code0 == REG)
574 else if (code1 == REG)
581 scan_rtx_address (insn, locI, INDEX_REG_CLASS, action, mode);
583 scan_rtx_address (insn, locB, BASE_REG_CLASS, action, mode);
594 /* If the target doesn't claim to handle autoinc, this must be
595 something special, like a stack push. Kill this chain. */
596 action = terminate_all_read;
601 scan_rtx_address (insn, &XEXP (x, 0), BASE_REG_CLASS, action,
606 scan_rtx_reg (insn, loc, class, action, OP_IN, 0);
613 fmt = GET_RTX_FORMAT (code);
614 for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
617 scan_rtx_address (insn, &XEXP (x, i), class, action, mode);
618 else if (fmt[i] == 'E')
619 for (j = XVECLEN (x, i) - 1; j >= 0; j--)
620 scan_rtx_address (insn, &XVECEXP (x, i, j), class, action, mode);
625 scan_rtx (insn, loc, class, action, type, earlyclobber)
628 enum reg_class class;
629 enum scan_actions action;
635 enum rtx_code code = GET_CODE (x);
651 scan_rtx_reg (insn, loc, class, action, type, earlyclobber);
655 scan_rtx_address (insn, &XEXP (x, 0), BASE_REG_CLASS, action,
660 scan_rtx (insn, &SET_SRC (x), class, action, OP_IN, 0);
661 scan_rtx (insn, &SET_DEST (x), class, action, OP_OUT, 0);
664 case STRICT_LOW_PART:
665 scan_rtx (insn, &XEXP (x, 0), class, action, OP_INOUT, earlyclobber);
670 scan_rtx (insn, &XEXP (x, 0), class, action,
671 type == OP_IN ? OP_IN : OP_INOUT, earlyclobber);
672 scan_rtx (insn, &XEXP (x, 1), class, action, OP_IN, 0);
673 scan_rtx (insn, &XEXP (x, 2), class, action, OP_IN, 0);
682 /* Should only happen inside MEM. */
686 scan_rtx (insn, &SET_DEST (x), class, action, OP_OUT, 1);
690 scan_rtx (insn, &XEXP (x, 0), class, action, type, 0);
692 scan_rtx (insn, &XEXP (x, 1), class, action, type, 0);
699 fmt = GET_RTX_FORMAT (code);
700 for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
703 scan_rtx (insn, &XEXP (x, i), class, action, type, 0);
704 else if (fmt[i] == 'E')
705 for (j = XVECLEN (x, i) - 1; j >= 0; j--)
706 scan_rtx (insn, &XVECEXP (x, i, j), class, action, type, 0);
710 /* Build def/use chain */
712 static struct du_chain *
718 open_chains = closed_chains = NULL;
720 for (insn = bb->head; ; insn = NEXT_INSN (insn))
726 rtx old_operands[MAX_RECOG_OPERANDS];
727 rtx old_dups[MAX_DUP_OPERANDS];
732 /* Process the insn, determining its effect on the def-use
733 chains. We perform the following steps with the register
734 references in the insn:
735 (1) Any read that overlaps an open chain, but doesn't exactly
736 match, causes that chain to be closed. We can't deal
738 (2) Any read outside an operand causes any chain it overlaps
739 with to be closed, since we can't replace it.
740 (3) Any read inside an operand is added if there's already
741 an open chain for it.
742 (4) For any REG_DEAD note we find, close open chains that
744 (5) For any write we find, close open chains that overlap it.
745 (6) For any write we find in an operand, make a new chain.
746 (7) For any REG_UNUSED, close any chains we just opened. */
749 constrain_operands (1);
750 preprocess_constraints ();
751 alt = which_alternative;
752 n_ops = recog_data.n_operands;
754 /* Simplify the code below by rewriting things to reflect
755 matching constraints. Also promote OP_OUT to OP_INOUT
756 in predicated instructions. */
758 predicated = GET_CODE (PATTERN (insn)) == COND_EXEC;
759 for (i = 0; i < n_ops; ++i)
761 int matches = recog_op_alt[i][alt].matches;
763 recog_op_alt[i][alt].class = recog_op_alt[matches][alt].class;
764 if (matches >= 0 || recog_op_alt[i][alt].matched >= 0
765 || (predicated && recog_data.operand_type[i] == OP_OUT))
766 recog_data.operand_type[i] = OP_INOUT;
769 /* Step 1: Close chains for which we have overlapping reads. */
770 for (i = 0; i < n_ops; i++)
771 scan_rtx (insn, recog_data.operand_loc[i],
772 NO_REGS, terminate_overlapping_read,
773 recog_data.operand_type[i], 0);
775 /* Step 2: Close chains for which we have reads outside operands.
776 We do this by munging all operands into CC0, and closing
777 everything remaining. */
779 for (i = 0; i < n_ops; i++)
781 old_operands[i] = recog_data.operand[i];
782 /* Don't squash match_operator or match_parallel here, since
783 we don't know that all of the contained registers are
784 reachable by proper operands. */
785 if (recog_data.constraints[i][0] == '\0')
787 *recog_data.operand_loc[i] = cc0_rtx;
789 for (i = 0; i < recog_data.n_dups; i++)
791 old_dups[i] = *recog_data.dup_loc[i];
792 *recog_data.dup_loc[i] = cc0_rtx;
795 scan_rtx (insn, &PATTERN (insn), NO_REGS, terminate_all_read,
798 for (i = 0; i < recog_data.n_dups; i++)
799 *recog_data.dup_loc[i] = old_dups[i];
800 for (i = 0; i < n_ops; i++)
801 *recog_data.operand_loc[i] = old_operands[i];
803 /* Step 2B: Can't rename function call argument registers. */
804 if (GET_CODE (insn) == CALL_INSN && CALL_INSN_FUNCTION_USAGE (insn))
805 scan_rtx (insn, &CALL_INSN_FUNCTION_USAGE (insn),
806 NO_REGS, terminate_all_read, OP_IN, 0);
808 /* Step 3: Append to chains for reads inside operands. */
809 for (i = 0; i < n_ops + recog_data.n_dups; i++)
811 int opn = i < n_ops ? i : recog_data.dup_num[i - n_ops];
812 rtx *loc = (i < n_ops
813 ? recog_data.operand_loc[opn]
814 : recog_data.dup_loc[i - n_ops]);
815 enum reg_class class = recog_op_alt[opn][alt].class;
816 enum op_type type = recog_data.operand_type[opn];
818 /* Don't scan match_operand here, since we've no reg class
819 information to pass down. Any operands that we could
820 substitute in will be represented elsewhere. */
821 if (recog_data.constraints[opn][0] == '\0')
824 if (recog_op_alt[opn][alt].is_address)
825 scan_rtx_address (insn, loc, class, mark_read, VOIDmode);
827 scan_rtx (insn, loc, class, mark_read, type, 0);
830 /* Step 4: Close chains for registers that die here.
831 Also record updates for REG_INC notes. */
832 for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
834 if (REG_NOTE_KIND (note) == REG_DEAD)
835 scan_rtx (insn, &XEXP (note, 0), NO_REGS, terminate_dead,
837 else if (REG_NOTE_KIND (note) == REG_INC)
838 scan_rtx (insn, &XEXP (note, 0), ALL_REGS, mark_read,
842 /* Step 4B: If this is a call, any chain live at this point
843 requires a caller-saved reg. */
844 if (GET_CODE (insn) == CALL_INSN)
847 for (p = open_chains; p; p = p->next_chain)
848 p->need_caller_save_reg = 1;
851 /* Step 5: Close open chains that overlap writes. Similar to
852 step 2, we hide in-out operands, since we do not want to
853 close these chains. */
855 for (i = 0; i < n_ops; i++)
857 old_operands[i] = recog_data.operand[i];
858 if (recog_data.operand_type[i] == OP_INOUT)
859 *recog_data.operand_loc[i] = cc0_rtx;
861 for (i = 0; i < recog_data.n_dups; i++)
863 int opn = recog_data.dup_num[i];
864 old_dups[i] = *recog_data.dup_loc[i];
865 if (recog_data.operand_type[opn] == OP_INOUT)
866 *recog_data.dup_loc[i] = cc0_rtx;
869 scan_rtx (insn, &PATTERN (insn), NO_REGS, terminate_write, OP_IN, 0);
871 for (i = 0; i < recog_data.n_dups; i++)
872 *recog_data.dup_loc[i] = old_dups[i];
873 for (i = 0; i < n_ops; i++)
874 *recog_data.operand_loc[i] = old_operands[i];
876 /* Step 6: Begin new chains for writes inside operands. */
877 /* ??? Many targets have output constraints on the SET_DEST
878 of a call insn, which is stupid, since these are certainly
879 ABI defined hard registers. Don't change calls at all. */
880 if (GET_CODE (insn) != CALL_INSN)
881 for (i = 0; i < n_ops + recog_data.n_dups; i++)
883 int opn = i < n_ops ? i : recog_data.dup_num[i - n_ops];
884 rtx *loc = (i < n_ops
885 ? recog_data.operand_loc[opn]
886 : recog_data.dup_loc[i - n_ops]);
887 enum reg_class class = recog_op_alt[opn][alt].class;
889 if (recog_data.operand_type[opn] == OP_OUT)
890 scan_rtx (insn, loc, class, mark_write, OP_OUT,
891 recog_op_alt[opn][alt].earlyclobber);
894 /* Step 7: Close chains for registers that were never
896 for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
897 if (REG_NOTE_KIND (note) == REG_UNUSED)
898 scan_rtx (insn, &XEXP (note, 0), NO_REGS, terminate_dead,
905 /* Since we close every chain when we find a REG_DEAD note, anything that
906 is still open lives past the basic block, so it can't be renamed. */
907 return closed_chains;
910 /* Dump all def/use chains in CHAINS to RTL_DUMP_FILE. They are
911 printed in reverse order as that's how we build them. */
914 dump_def_use_chain (chains)
915 struct du_chain *chains;
919 struct du_chain *this = chains;
920 int r = REGNO (*this->loc);
921 int nregs = HARD_REGNO_NREGS (r, GET_MODE (*this->loc));
922 fprintf (rtl_dump_file, "Register %s (%d):", reg_names[r], nregs);
925 fprintf (rtl_dump_file, " %d [%s]", INSN_UID (this->insn),
926 reg_class_names[this->class]);
927 this = this->next_use;
929 fprintf (rtl_dump_file, "\n");
930 chains = chains->next_chain;