--- /dev/null
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## gcc-4.4.3.dpatch by R. Steve McKown <rsmckown@gmail.com>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: dpatch-ized version of gcc-4.4.3.patch from mspgcc4.
+
+@DPATCH@
+diff -urNad msp430-gcc~/configure msp430-gcc/configure
+--- msp430-gcc~/configure 2010-05-20 16:18:52.000000000 -0600
++++ msp430-gcc/configure 2010-05-20 16:20:02.000000000 -0600
+@@ -2360,6 +2360,9 @@
+ avr-*-*)
+ noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 ${libgcj} target-libssp"
+ ;;
++ msp430-*-*)
++ noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 ${libgcj} target-libssp"
++ ;;
+ bfin-*-*)
+ noconfigdirs="$noconfigdirs gdb"
+ if test x${is_cross_compiler} != xno ; then
+diff -urNad msp430-gcc~/gcc/config.gcc msp430-gcc/gcc/config.gcc
+--- msp430-gcc~/gcc/config.gcc 2010-05-20 16:18:52.000000000 -0600
++++ msp430-gcc/gcc/config.gcc 2010-05-20 16:20:02.000000000 -0600
+@@ -804,6 +804,12 @@
+ avr-*-*)
+ tm_file="avr/avr.h dbxelf.h"
+ ;;
++msp430-*-*)
++ tm_file="msp430/msp430.h dbxelf.h"
++ c_target_objs=`cat ${srcdir}/config/msp430/objs-extra`
++ cxx_target_objs=`cat ${srcdir}/config/msp430/objs-extra`
++ use_fixproto=yes
++ ;;
+ bfin*-elf*)
+ tm_file="${tm_file} dbxelf.h elfos.h bfin/elf.h"
+ tmake_file=bfin/t-bfin-elf
+diff -urNad msp430-gcc~/gcc/configure msp430-gcc/gcc/configure
+--- msp430-gcc~/gcc/configure 2010-05-20 16:18:52.000000000 -0600
++++ msp430-gcc/gcc/configure 2010-05-20 16:20:02.000000000 -0600
+@@ -1595,6 +1595,7 @@
+
+
+ gcc_version=`cat $srcdir/BASE-VER`
++echo $gcc_version | sed s/\\\([0-9]\\\)\.\\\([0-9]\\\)\.\\\([0-9]\\\)/\#define\ GCC_VERSION_INT\ 0x\\1\\2\\3/g > $srcdir/_gccver.h
+
+ # Determine the host, build, and target systems
+ ac_aux_dir=
+diff -urNad msp430-gcc~/gcc/expr.c msp430-gcc/gcc/expr.c
+--- msp430-gcc~/gcc/expr.c 2010-05-20 16:18:52.000000000 -0600
++++ msp430-gcc/gcc/expr.c 2010-05-20 16:20:02.000000000 -0600
+@@ -955,7 +955,7 @@
+ data.autinc_from = 1;
+ data.explicit_inc_from = -1;
+ }
+- if (USE_LOAD_POST_INCREMENT (mode) && ! data.autinc_from)
++ if (USE_LOAD_POST_INCREMENT (mode) && !data.reverse && !data.autinc_from)
+ {
+ data.from_addr = copy_addr_to_reg (from_addr);
+ data.autinc_from = 1;
+diff -urNad msp430-gcc~/gcc/loop-invariant.c msp430-gcc/gcc/loop-invariant.c
+--- msp430-gcc~/gcc/loop-invariant.c 2010-05-20 16:18:52.000000000 -0600
++++ msp430-gcc/gcc/loop-invariant.c 2010-05-20 16:20:02.000000000 -0600
+@@ -1171,11 +1171,13 @@
+ rtx reg, set, dest, note;
+ struct use *use;
+ bitmap_iterator bi;
++ int n_validated;
+
+ if (inv->reg)
+ return true;
+ if (!repr->move)
+ return false;
++ n_validated = num_validated_changes ();
+ /* If this is a representative of the class of equivalent invariants,
+ really move the invariant. Otherwise just replace its use with
+ the register used for the representative. */
+@@ -1200,7 +1202,17 @@
+ reg = gen_reg_rtx_and_attrs (dest);
+
+ /* Try replacing the destination by a new pseudoregister. */
+- if (!validate_change (inv->insn, &SET_DEST (set), reg, false))
++ validate_change (inv->insn, &SET_DEST (set), reg, true);
++
++ /* Replace the uses we know to be dominated. It saves work for copy
++ propagation, and also it is necessary so that dependent invariants
++ are computed right. */
++ /* Note that we must test the changes for validity, lest we might
++ rip apart a match_dup between a use and a clobber. */
++ if (inv->def)
++ for (use = inv->def->uses; use; use = use->next)
++ validate_change (use->insn, use->pos, reg, true);
++ if (!apply_change_group ())
+ goto fail;
+ df_insn_rescan (inv->insn);
+
+@@ -1219,9 +1231,23 @@
+ }
+ else
+ {
+- if (!move_invariant_reg (loop, repr->invno))
+- goto fail;
++ /* Replace the uses we know to be dominated. It saves work for copy
++ propagation, and also it is necessary so that dependent invariants
++ are computed right. */
+ reg = repr->reg;
++ if (inv->def)
++ for (use = inv->def->uses; use; use = use->next)
++ validate_change (use->insn, use->pos, reg, true);
++
++ if (verify_changes (n_validated)
++ && move_invariant_reg (loop, repr->invno))
++ confirm_change_group ();
++ else
++ {
++ cancel_changes (n_validated);
++ goto fail;
++ }
++
+ set = single_set (inv->insn);
+ emit_insn_after (gen_move_insn (SET_DEST (set), reg), inv->insn);
+ delete_insn (inv->insn);
+@@ -1230,17 +1256,9 @@
+
+ inv->reg = reg;
+
+- /* Replace the uses we know to be dominated. It saves work for copy
+- propagation, and also it is necessary so that dependent invariants
+- are computed right. */
+ if (inv->def)
+- {
+- for (use = inv->def->uses; use; use = use->next)
+- {
+- *use->pos = reg;
+- df_insn_rescan (use->insn);
+- }
+- }
++ for (use = inv->def->uses; use; use = use->next)
++ df_insn_rescan (use->insn);
+
+ return true;
+
+diff -urNad msp430-gcc~/libgcc/config.host msp430-gcc/libgcc/config.host
+--- msp430-gcc~/libgcc/config.host 2010-05-20 16:18:52.000000000 -0600
++++ msp430-gcc/libgcc/config.host 2010-05-20 16:20:02.000000000 -0600
+@@ -224,6 +224,8 @@
+ # Make HImode functions for AVR
+ tmake_file=${cpu_type}/t-avr
+ ;;
++msp430-*-*)
++ ;;
+ bfin*-elf*)
+ ;;
+ bfin*-uclinux*)