Commit Graph

15 Commits

Author SHA1 Message Date
Jeff Law
d116300be8 mn10300.c (notice_update_cc): Use CC_SET_ZN and CC_SET_ZNV.
* mn10300.c (notice_update_cc): Use CC_SET_ZN and CC_SET_ZNV.
        * mn10300.h (CC_NO_CARRY): Define.
        * mn10300.md: Use "set_zn" and "set_znv" to more accurately
        describe cc0 status.

From-SVN: r14019
1997-05-05 19:15:09 -06:00
Jeff Law
4c7428133b mn10300.c (secondary_reload_class): Handle more cases where we need secondary reloads.
* mn10300.c (secondary_reload_class): Handle more cases where we
        need secondary reloads.
        (impossible_plus_operand): Accept anything that involves addition
        of the stack pointer.
        * mn10300.md (reload_insi): Always load the stack pointer into
        the destination (which is always an address register).
        * mn10300.h (STORE_FLAG_VALUE): Remove definition.
        * xm-mn10300.h: Declare malloc, realloc, calloc and free.

From-SVN: r13973
1997-04-23 17:54:59 -06:00
Jeff Law
6c0870b896 mn10300.c (expand_prologue): End the current sequence before counting the tst insns in the current function.
* mn10300.c (expand_prologue): End the current sequence before
        counting the tst insns in the current function.  Start a new
        one before emitting any prologue instructions.

        * mn10300.h (REGISTER_MOVE_COST): Bump up cost of moves in the
        same class.

        * mn10300.md (untyped_call): New expander.

From-SVN: r13955
1997-04-22 10:29:04 -06:00
Jeff Law
460f4b9ddd mn10300.c (can_use_return_insn): Include outgoing argument area in size computation.
* mn10300.c (can_use_return_insn): Include outgoing argument
        area in size computation.
        (expand_prologue): Likewise.  No longer diddle with sequences.
        Put register saves just before outgoing argument area.
        (expand_epilogue): Similarly.
        (impossible_plus_operand): New function.
        * mn10300.h (FRAME_POINTER_REQUIRED): Never require a frame pointer.
        (ACCUMULATE_OUTGOING_ARGS, OUTGOING_REG_PARM_STACK_SPACE): Define.
        (impossible_plus_operand): Declare.
        * mn10300.md (reload_insi): New expander to handle pathological
        reload cases.
        (addsi3): Fix CC status.

        * mn10300.h (FUNCTION_VALUE): Return addresses in $a0.
        (FUNCTION_VALUE_REGNO_P): Corresponding changes.
        * mn10300.md (call_value_internal): Allow output to be in an
        address register.

From-SVN: r13903
1997-04-14 14:59:44 -06:00
Jeff Law
74452ac323 mn10300.h (RETURN_ADDR_RTX): Define.
* mn10300.h (RETURN_ADDR_RTX): Define.

        * mn10300.c (count_tst_insns): New function.
        (expand_prologue): Load zero into data and/or address registers
        if any are free and the function has optimizable tst insns.
        (output_tst): If a suitable register is known to have the
        value zero, use it instead of searching for a suitable register.
        * mn10300.h (zero_dreg, zero_areg): Declare.
        (FRAME_POINTER_NEEDED): Frame pointers are not needed if the
        outgoing argument size is zero.
        * mn10300.md (movXX): Optimize loading zero i        register if possible.  Optimize loading a DF/DI mode value
        into an address register from a constant memory address.
        (addsi3): Provide alternative which doesn't require a matching
        inout operand.
        (return): Optimize consecutive return instructions.

From-SVN: r13845
1997-04-08 12:41:49 -06:00
Jeff Law
3dbc43d13a mn10300.c (can_use_return_insn): Add size of fixed stack space for function calls into the size of the frame.
* mn10300.c (can_use_return_insn): Add size of fixed stack space
        for function calls into the size of the frame.  */
        (expand_prologue, expand_epilogue): Likewise.
        (initial_offset): Corresponding changes..
        * mn10300.h (OUTGOING_REG_PARM_STACK_SPACE): No longer define.
        (STACK_POINTER_OFFSET): Define.
        * mn10300.md (call, call_value expanders): Don't adjust the stack
        pointer here anymore.

        * mn10300.md (ashlsi3): Remove some alternatives which are no longer
        needed or desired.

From-SVN: r13837
1997-04-03 15:20:18 -07:00
Jeff Law
22ef4e9b59 stdarg.h: Include va-mn10300.h.
* ginclude/stdarg.h: Include va-mn10300.h.
        * ginclude/varargs.h: Likewise.
        * ginclude/va-mn10300.h: New file.
        * mn10300/mn10300.c (expand_prologue): If current_function_varargs is
        nonzero, then flush d0/d1 back into the stack.
        (mn10300_builtin_saveregs): New function.
        (function_arg, function_arg_partial_nregs): New functions.
        (initial_offset): Tweak now that the RP save area is allocated
        and deallocated around each call again.
        * mn10300/mn10300.h (FIRST_PARM_OFFSET): Now 4.
        (FRAME_POINTER_REQUIRED): Require a frame pointer for all non-leaf
        functions.
        (REG_PARM_STACK_SPACE): Now 8 bytes.
        (FUNCTION_ARG_REGNO_P): Update for new parameter passing conventions.
        (CUMULATIVE_ARGS, INIT_CUMULATIVE_ARGS): Likewise.
        (FUNCTION_ARG_ADVANCE, FUNCTION_ARG): Likewise.
        (FUNCTION_ARG_PARTIAL_NREGS): Likewise.
        (TRAMPOLINE_TEMPLATE): Don't clobber d0 anymore.
        (TRAMPOLINE_SIZE, INITIALIZE_TRAMPOLINE): Corresponding changes.
        (EXPAND_BUILTIN_SAVEREGS): Define.
        * mn10300/mn10300.md (call, call_value patterns): Allocate and
        deallocate a stack slot for the return pointer around each call.

        * mn10300/mn10300.h (RTX_COSTS): Refine.
        (CASE_VALUES_THRESHHOLD, NO_FUNCTION_CSE): Likewise.
        * mn10300/mn10300.c (output_tst): New function.
        * mn10300/mn10300.md (movdi, movdf): Improve code to load constants
        into registers.
        (tst insns): Use output_tst to optimize some cases.  Add versions to
        encourage more zero extensions instead of sign extensions of HImode
        and QImode values.
        (divsi3, udivsi3): Remove patterns.  Replaced by...
        (divmodsi4, udivmodsi4): New expanders/patterns.
        (andsi3): Optimize "and" operations with certain constants.

From-SVN: r13827
1997-04-01 18:33:45 -07:00
Jeff Law
6fafc52384 * mn10300/mn10300.c (print_operand): Handle 'N'.
From-SVN: r13758
1997-03-21 10:24:18 -07:00
Jeff Law
3b800f71d3 mn10300.md (cmpsi): Handle comparing a register with itself by adding zero to the reg.
* mn10300/mn10300.md (cmpsi): Handle comparing a register with
        itself by adding zero to the reg.  Z bit for such an insn is
        inverted.
        * mn10300/mn10300.c (notice_update_cc): Handle CC_INVERT.

From-SVN: r13755
1997-03-20 12:25:46 -07:00
Jeff Law
38c37a0ef0 mn10300.c (const_costs): Remove unused function.
* mn10300/mn10300.c (const_costs): Remove unused function.
        * mn10300/mn10300.h (CONST_COSTS): Rework to generate better code.

        * mn10300/mn10300.c (print_operand): Handle 'H' and 'L' output
        modifers for high/low part of a 64bit value.
        * mn10300/mn10300.h (CONST_DOUBLE_OK_FOR_LETTER_P): Handle 'G'
        (LEGITIMATE_CONSTANT_P): Allow any constant.
        * mn10300/mn10300.md (movdi, movdf): Implement.
        (adddi3, subdi3): New expanders and patterns.

        * mn10300/mn10300.c (print_operand): Handle 'A' modifier for an
        address which can't be simple register indirect.
        * mn10300/mn10300.h (EXTRA_CONSTRAINT): Handle 'R' for bit ops.
        * mn10300/mn10300.md: Add several patterns to test, set and clear
        bitfields.

        * mn10300/mn10300.c (can_use_return_insn): New function.
        (expand_epilogue): Emit a RETURN insn if possible.
        * mn10300/mn10300.md (return): New pattern.

        * mn10300/mn10300.h (CONST_OK_FOR_LETTER_P): Handle 'N'.
        * mn10300/mn10300.md (andsi3): Catch "and 255,dn" and "and 65535,dn"
        which were not turned into zero_extend patterns.

        * mn10300/mn10300.h (GO_IF_LEGITIMATE_ADDRESS): Handle symbolic
        constant as an index/base too.

        * mn10300/mn10300.md (movsi): Allow SP to be loaded/saved with
        reg+d8 addresses.

        * mn10300/mn10300.md (cmpsi): Allow second operand to be a constant.
        (subsi3): Likewise.

        * mn10300/mn10300.md (sign extension patterns): Fix thinko when
        extending from memory.

        * mn10300/mn10300.md (tst peepholes): Add peepholes for test/branch
        based on N bit being set/clear and the data value being tested dies.

From-SVN: r13701
1997-03-14 10:32:36 -07:00
Jeff Law
777fbf098d mn10300.c (expand_prologue): Rework so that eliminating the frame pointer produces faster/smaller code.
* mn10300/mn10300.c (expand_prologue): Rework so that eliminating
        the frame pointer produces faster/smaller code.
        (expand_epilogue): Likewise.
        (initial_offset): New function for argument pointer and frame pointer
        elimination.
        * mn10300/mn10300.h (FIRST_PSEUDO_REGISTER): Bump to 10.
        (FIXED_REGISTERS): Add argument pointer register, it's a fake fixed
        register.
        (CALL_USED_REGISTERS, REG_ALLOC_ORDER): Corresponding changes.
        (REGNO_REG_CLASS, REG_CLASS_CONTENTS): Likewise.
        (REG_OK_FOR_BASE_P, REGISTER_NAMES): Likewise.
        (reg_class, REG_CLASS_NAMES): Delete unwanted DATA_OR_SP_REGS class.
        (PREFERRED_OUTPUT_RELOAD_CLASS): Define.
        (FIRST_PARM_OFFSET): No longer include register save area in
        computation.
        (STACK_POINTER_REGNUM): Is now register 9.
        (ARG_POINTER_REGNUM): Is now register 8.
        (FRAME_POINTER_REQUIRED): Refine.
        (ELIMINABLE_REGS, INITIAL_ELIMINATION_OFFSET): Define.
        (CAN_DEUG_WITHOUT_FP): Define.
        * mn10300/mn10300.md (return_internal): Break into two patterns.

        * mn10300/mn10300.h (CONST_OK_FOR_LETTER_P): Handle 'M' too.
        (REGISTER_MOVE_COST): Fix errors and refine.

        * mn10300/mn10300.c (notice_update_cc): SET_ZN_C0 insns leave the
        overflow bit in an unuseable state.  Rename CC_SET to CC_TST.
        * mn10300/mn10300.md (cc attributes): "set" is gone, replaced by
        "tst".  Update attributes on various insns.

        * mn10300/mn10300.md: Improve sign and zero extension instructions.
        (ashlsi3): Improve.  Handle address registers too.
        (add peephole): Combine two consecutive adjustments of a register
        into a single adjustment.

From-SVN: r13700
1997-03-11 17:25:59 -07:00
Jeff Law
6e86170d98 mn10300.c (expand_prologue): Rework to avoid unnecessary "add" operations.
* mn10300/mn10300.c (expand_prologue): Rework to avoid unnecessary
        "add" operations.
        (expand_epilogue): Likewise.
        * mn10300/mn10300.h (STARTING_FRAME_OFFSET): Is zero after the last
        round of prologue/epilogue changes.
        (FIRST_PARM_OFFSET): Is now 16 (-4 for REG_PARM_STACK_SPACE + 20 for
        register save area).
        (REG_PARM_STACK_SPACE): Define as 4 bytes.
        (OUTGOING_REG_PARM_STACK_SPACE): Define so caller allocates it.
        * mn10300/mn10300.md (call expander): Don't emit insns to adjust the
        stack here anymore.
        (call_value expander): Likewise.

        * mn10300/mn10300.md (bCC patterns): Just use "bCC target" now that
        the assembler handles relaxing.

From-SVN: r13696
1997-03-07 09:42:33 -07:00
Jeff Law
82c6faa8ba mn10300.c (notice_update_cc): Enable this code.
* mn10300/mn10300.c (notice_update_cc): Enable this code.
        * mn10300/mn10300.h (CC_OVERFLOW_UNUSABLE): Define.
        * mn10300/mn10300.md (tstsi): Use "set_zn_c0" instead of "set"
        for cc status.
        (addsi3 pattern): Break "inc" into two different alternatives
        since "inc dn" sets cc0, but "inc an" does not.
        (multiply and divide patterns): Fix cc status.
        (bCC, inverted bCC): Restore any comparison which needs the
        overflow bits when CC_OVERFLOW_UNUSABLE is set.
        (zero and sign extensions): Fix cc status.
        (movm_store): Likewise.

From-SVN: r13337
1996-12-18 10:32:12 -07:00
Jeff Law
4246e0c55b mn10300.c (expand_epilogue): Restore registers in the "ret" instruction instead of a separate movm instruction.
* mn10300/mn10300.c (expand_epilogue): Restore registers in the
        "ret" instruction instead of a separate movm instruction.
        Support possible stack deallocation in "ret" instruction too.
        * mn10300.md (return_internal): Use "ret" instead of "rets";
        restore registers and deallocate stack as needed.
        (load_movm): Delete unused pattern.

        * mn10300/mn10300.h (SMALL_REGISTER_CLASSES): Define.

From-SVN: r13311
1996-12-16 10:18:18 -07:00
Jeff Law
11bb1f11d0 Initial revision
From-SVN: r13280
1996-12-11 14:22:57 -07:00