📄 emit-rtl.c
字号:
NEXT_INSN (to) = NEXT_INSN (after); PREV_INSN (from) = after; NEXT_INSN (after) = from; if (after == last_insn) last_insn = to;}/* Return the line note insn preceding INSN. */static rtxfind_line_note (insn) rtx insn;{ if (no_line_numbers) return 0; for (; insn; insn = PREV_INSN (insn)) if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) >= 0) break; return insn;}/* Like reorder_insns, but inserts line notes to preserve the line numbers of the moved insns when debugging. This may insert a note between AFTER and FROM, and another one after TO. */voidreorder_insns_with_line_notes (from, to, after) rtx from, to, after;{ rtx from_line = find_line_note (from); rtx after_line = find_line_note (after); reorder_insns (from, to, after); if (from_line == after_line) return; if (from_line) emit_line_note_after (NOTE_SOURCE_FILE (from_line), NOTE_LINE_NUMBER (from_line), after); if (after_line) emit_line_note_after (NOTE_SOURCE_FILE (after_line), NOTE_LINE_NUMBER (after_line), to);}/* Emit an insn of given code and pattern at a specified place within the doubly-linked list. *//* Make an instruction with body PATTERN and output it before the instruction BEFORE. */rtxemit_insn_before (pattern, before) register rtx pattern, before;{ register rtx insn = before; if (GET_CODE (pattern) == SEQUENCE) { register int i; for (i = 0; i < XVECLEN (pattern, 0); i++) { insn = XVECEXP (pattern, 0, i); add_insn_after (insn, PREV_INSN (before)); } if (XVECLEN (pattern, 0) < SEQUENCE_RESULT_SIZE) sequence_result[XVECLEN (pattern, 0)] = pattern; } else { insn = make_insn_raw (pattern); add_insn_after (insn, PREV_INSN (before)); } return insn;}/* Make an instruction with body PATTERN and code JUMP_INSN and output it before the instruction BEFORE. */rtxemit_jump_insn_before (pattern, before) register rtx pattern, before;{ register rtx insn; if (GET_CODE (pattern) == SEQUENCE) insn = emit_insn_before (pattern, before); else { insn = make_jump_insn_raw (pattern, NULL_RTVEC); add_insn_after (insn, PREV_INSN (before)); } return insn;}/* Make an instruction with body PATTERN and code CALL_INSN and output it before the instruction BEFORE. */rtxemit_call_insn_before (pattern, before) register rtx pattern, before;{ rtx insn = emit_insn_before (pattern, before); PUT_CODE (insn, CALL_INSN); return insn;}/* Make an insn of code BARRIER and output it before the insn AFTER. */rtxemit_barrier_before (before) register rtx before;{ register rtx insn = rtx_alloc (BARRIER); INSN_UID (insn) = cur_insn_uid++; add_insn_after (insn, PREV_INSN (before)); return insn;}/* Emit a note of subtype SUBTYPE before the insn BEFORE. */rtxemit_note_before (subtype, before) int subtype; rtx before;{ register rtx note = rtx_alloc (NOTE); INSN_UID (note) = cur_insn_uid++; NOTE_SOURCE_FILE (note) = 0; NOTE_LINE_NUMBER (note) = subtype; add_insn_after (note, PREV_INSN (before)); return note;}/* Make an insn of code INSN with body PATTERN and output it after the insn AFTER. */rtxemit_insn_after (pattern, after) register rtx pattern, after;{ register rtx insn = after; if (GET_CODE (pattern) == SEQUENCE) { register int i; for (i = 0; i < XVECLEN (pattern, 0); i++) { insn = XVECEXP (pattern, 0, i); add_insn_after (insn, after); after = insn; } if (XVECLEN (pattern, 0) < SEQUENCE_RESULT_SIZE) sequence_result[XVECLEN (pattern, 0)] = pattern; } else { insn = make_insn_raw (pattern); add_insn_after (insn, after); } return insn;}/* Similar to emit_insn_after, except that line notes are to be inserted so as to act as if this insn were at FROM. */voidemit_insn_after_with_line_notes (pattern, after, from) rtx pattern, after, from;{ rtx from_line = find_line_note (from); rtx after_line = find_line_note (after); rtx insn = emit_insn_after (pattern, after); if (from_line) emit_line_note_after (NOTE_SOURCE_FILE (from_line), NOTE_LINE_NUMBER (from_line), after); if (after_line) emit_line_note_after (NOTE_SOURCE_FILE (after_line), NOTE_LINE_NUMBER (after_line), insn);}/* Make an insn of code JUMP_INSN with body PATTERN and output it after the insn AFTER. */rtxemit_jump_insn_after (pattern, after) register rtx pattern, after;{ register rtx insn; if (GET_CODE (pattern) == SEQUENCE) insn = emit_insn_after (pattern, after); else { insn = make_jump_insn_raw (pattern, NULL_RTVEC); add_insn_after (insn, after); } return insn;}/* Make an insn of code BARRIER and output it after the insn AFTER. */rtxemit_barrier_after (after) register rtx after;{ register rtx insn = rtx_alloc (BARRIER); INSN_UID (insn) = cur_insn_uid++; add_insn_after (insn, after); return insn;}/* Emit the label LABEL after the insn AFTER. */rtxemit_label_after (label, after) rtx label, after;{ /* This can be called twice for the same label as a result of the confusion that follows a syntax error! So make it harmless. */ if (INSN_UID (label) == 0) { INSN_UID (label) = cur_insn_uid++; add_insn_after (label, after); } return label;}/* Emit a note of subtype SUBTYPE after the insn AFTER. */rtxemit_note_after (subtype, after) int subtype; rtx after;{ register rtx note = rtx_alloc (NOTE); INSN_UID (note) = cur_insn_uid++; NOTE_SOURCE_FILE (note) = 0; NOTE_LINE_NUMBER (note) = subtype; add_insn_after (note, after); return note;}/* Emit a line note for FILE and LINE after the insn AFTER. */rtxemit_line_note_after (file, line, after) char *file; int line; rtx after;{ register rtx note; if (no_line_numbers && line > 0) { cur_insn_uid++; return 0; } note = rtx_alloc (NOTE); INSN_UID (note) = cur_insn_uid++; NOTE_SOURCE_FILE (note) = file; NOTE_LINE_NUMBER (note) = line; add_insn_after (note, after); return note;}/* Make an insn of code INSN with pattern PATTERN and add it to the end of the doubly-linked list. If PATTERN is a SEQUENCE, take the elements of it and emit an insn for each element. Returns the last insn emitted. */rtxemit_insn (pattern) rtx pattern;{ rtx insn = last_insn; if (GET_CODE (pattern) == SEQUENCE) { register int i; for (i = 0; i < XVECLEN (pattern, 0); i++) { insn = XVECEXP (pattern, 0, i); add_insn (insn); } if (XVECLEN (pattern, 0) < SEQUENCE_RESULT_SIZE) sequence_result[XVECLEN (pattern, 0)] = pattern; } else { insn = make_insn_raw (pattern); add_insn (insn); } return insn;}/* Emit the insns in a chain starting with INSN. Return the last insn emitted. */rtxemit_insns (insn) rtx insn;{ rtx last = 0; while (insn) { rtx next = NEXT_INSN (insn); add_insn (insn); last = insn; insn = next; } return last;}/* Emit the insns in a chain starting with INSN and place them in front of the insn BEFORE. Return the last insn emitted. */rtxemit_insns_before (insn, before) rtx insn; rtx before;{ rtx last = 0; while (insn) { rtx next = NEXT_INSN (insn); add_insn_after (insn, PREV_INSN (before)); last = insn; insn = next; } return last;}/* Emit the insns in a chain starting with FIRST and place them in back of the insn AFTER. Return the last insn emitted. */rtxemit_insns_after (first, after) register rtx first; register rtx after;{ register rtx last; register rtx after_after; if (!after) abort (); if (!first) return first; for (last = first; NEXT_INSN (last); last = NEXT_INSN (last)) continue; after_after = NEXT_INSN (after); NEXT_INSN (after) = first; PREV_INSN (first) = after; NEXT_INSN (last) = after_after; if (after_after) PREV_INSN (after_after) = last; if (after == last_insn) last_insn = last; return last;}/* Make an insn of code JUMP_INSN with pattern PATTERN and add it to the end of the doubly-linked list. */rtxemit_jump_insn (pattern) rtx pattern;{ if (GET_CODE (pattern) == SEQUENCE) return emit_insn (pattern); else { register rtx insn = make_jump_insn_raw (pattern, NULL_RTVEC); add_insn (insn); return insn; }}/* Make an insn of code CALL_INSN with pattern PATTERN and add it to the end of the doubly-linked list. */rtxemit_call_insn (pattern) rtx pattern;{ if (GET_CODE (pattern) == SEQUENCE) return emit_insn (pattern); else { register rtx insn = make_insn_raw (pattern); add_insn (insn); PUT_CODE (insn, CALL_INSN); return insn; }}/* Add the label LABEL to the end of the doubly-linked list. */rtxemit_label (label) rtx label;{ /* This can be called twice for the same label as a result of the confusion that follows a syntax error! So make it harmless. */ if (INSN_UID (label) == 0) { INSN_UID (label) = cur_insn_uid++; add_insn (label); } return label;}/* Make an insn of code BARRIER and add it to the end of the doubly-linked list. */rtxemit_barrier (){ register rtx barrier = rtx_alloc (BARRIER); INSN_UID (barrier) = cur_insn_uid++; add_insn (barrier); return barrier;}/* Make an insn of code NOTE with data-fields specified by FILE and LINE and add it to the end of the doubly-linked list, but only if line-numbers are desired for debugging info. */rtxemit_line_note (file, line) char *file; int line;{ emit_filename = file; emit_lineno = line;#if 0 if (no_line_numbers) return 0;#endif return emit_note (file, line);}/* Make an insn of code NOTE with data-fields specified by FILE and LINE and add i
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -