View | Details | Raw Unified | Return to bug 172352
Collapse All | Expand All

(-)msp430-gcc/Makefile (-2 / +4 lines)
Lines 7-13 Link Here
7
7
8
PORTNAME=	gcc
8
PORTNAME=	gcc
9
PORTVERSION=	${GCCVERSION}.${LTSVERSION}
9
PORTVERSION=	${GCCVERSION}.${LTSVERSION}
10
PORTREVISION=	0
10
PORTREVISION=	1
11
PORTEPOCH=	2
11
PORTEPOCH=	2
12
CATEGORIES=	devel
12
CATEGORIES=	devel
13
MASTER_SITES=	${MASTER_SITE_SOURCEWARE} \
13
MASTER_SITES=	${MASTER_SITE_SOURCEWARE} \
Lines 25-31 Link Here
25
PATCH_DIST_STRIP=	-p1
25
PATCH_DIST_STRIP=	-p1
26
26
27
MAINTAINER=	lev@FreeBSD.org
27
MAINTAINER=	lev@FreeBSD.org
28
COMMENT=	FSF gcc-4.5 for TI's msp430 MCUs cross-development
28
COMMENT=	FSF GCC 4.x for TI's msp430 MCUs cross-development
29
29
30
LICENSE=	GPLv3
30
LICENSE=	GPLv3
31
31
Lines 88-93 Link Here
88
88
89
pre-patch:
89
pre-patch:
90
	@cd ${SRCDIR} && ${PATCH} -s -p1 < ../mspgcc-${LTSVERSION}/${PKGNAMEPREFIX}${PORTNAME}-${GCCVERSION}-${PATCHVERSION}.patch
90
	@cd ${SRCDIR} && ${PATCH} -s -p1 < ../mspgcc-${LTSVERSION}/${PKGNAMEPREFIX}${PORTNAME}-${GCCVERSION}-${PATCHVERSION}.patch
91
	${CP} ${SRCDIR}/gcc/config/msp430/msp430-builtins.c \
92
		${SRCDIR}/gcc/config/msp430/msp430-builtins.c.orig
91
93
92
pre-configure:
94
pre-configure:
93
	cd ${SRCDIR} ; contrib/gcc_update --touch
95
	cd ${SRCDIR} ; contrib/gcc_update --touch
(-)msp430-gcc/files/patch-gcc-config-msp430-msp430-builtins.c (+55 lines)
Line 0 Link Here
1
--- gcc/config/msp430/msp430-builtins.c.orig	2012-09-26 12:24:42.000000000 +0800
2
+++ gcc/config/msp430/msp430-builtins.c	2012-09-26 12:28:31.000000000 +0800
3
@@ -59,6 +59,7 @@
4
   MSP430_BUILTIN_GET_WATCHDOG_CLEAR_VALUE,
5
   MSP430_BUILTIN_SET_WATCHDOG_CLEAR_VALUE,
6
   MSP430_BUILTIN_WATCHDOG_CLEAR,
7
+  MSP430_BUILTIN_EVEN_IN_RANGE,
8
   MSP430_BUILTIN_last_enum
9
 };
10
 
11
@@ -153,6 +154,13 @@
12
   add_builtin_function ("__watchdog_clear",
13
 			build_function_type_list (void_type_node, NULL_TREE),
14
 			MSP430_BUILTIN_WATCHDOG_CLEAR, BUILT_IN_MD, NULL, NULL_TREE);
15
+  add_builtin_function ("__even_in_range",
16
+			build_function_type_list (unsigned_type_node,
17
+						  unsigned_type_node,
18
+						  unsigned_type_node,
19
+						  NULL_TREE),
20
+			MSP430_BUILTIN_EVEN_IN_RANGE, BUILT_IN_MD,
21
+			NULL, NULL_TREE);
22
 }
23
 
24
 rtx
25
@@ -432,6 +440,30 @@
26
       emit_move_insn (retval, arg);
27
       insn = gen_bswaphi1 (retval);
28
       break;
29
+    case MSP430_BUILTIN_EVEN_IN_RANGE:
30
+      {
31
+	tree key_tree = CALL_EXPR_ARG (exp, 0);
32
+	tree limit_tree = CALL_EXPR_ARG (exp, 1);
33
+	rtx key;
34
+	HOST_WIDE_INT limit_val;
35
+	
36
+	need_insn = false;
37
+	if (!cst_and_fits_in_hwi (limit_tree)
38
+	    || (0 > ((limit_val = int_cst_value (limit_tree)))))
39
+	  {
40
+	    error
41
+	      ("__even_in_range second argument must be non-negative integer constant");
42
+	    break;
43
+	  }
44
+	key = expand_expr (key_tree, NULL_RTX, VOIDmode, EXPAND_NORMAL);
45
+	retval = gen_reg_rtx (HImode);
46
+	/* This is a stub.  To complete this, we need to attach notes
47
+	 * that assert that the value is, in fact, even and between 0
48
+	 * and the second argument.  No idea how to do that in a way
49
+	 * that gcc's tablejump will pay any attention to. */
50
+	emit_move_insn (retval, key);
51
+	break;
52
+      }
53
     }
54
 
55
   if (insn)
(-)msp430-gcc/pkg-descr (-1 / +1 lines)
Lines 1-4 Link Here
1
FSF gcc-4.5 for TI's msp430 MCUs cross-development
1
FSF gcc-4.x for TI's msp430 MCUs cross-development
2
2
3
This brings the gcc compiler for the Texas Instruments MSP430 16-bit
3
This brings the gcc compiler for the Texas Instruments MSP430 16-bit
4
RISC-like family of microcontrollers.
4
RISC-like family of microcontrollers.

Return to bug 172352