mirror of
https://github.com/pret/agbcc.git
synced 2026-03-22 01:54:15 -05:00
build libgcc with older version of compiler and add install script
This commit is contained in:
parent
0dfd357a51
commit
d1cb3194bb
19
Makefile
19
Makefile
|
|
@ -1,19 +0,0 @@
|
|||
.PHONY: all clean
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
AGBCC := agbcc.exe
|
||||
else
|
||||
AGBCC := agbcc
|
||||
endif
|
||||
|
||||
all: gcc/$(AGBCC) libgcc/libgcc.a
|
||||
|
||||
gcc/$(AGBCC):
|
||||
make -C gcc
|
||||
|
||||
libgcc/libgcc.a: | gcc/$(AGBCC)
|
||||
make -C libgcc
|
||||
|
||||
clean:
|
||||
make -C gcc clean
|
||||
make -C libgcc clean
|
||||
7
build.sh
Normal file
7
build.sh
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
make -C gcc clean
|
||||
make -C gcc old
|
||||
make -C libgcc clean
|
||||
make -C libgcc
|
||||
make -C gcc clean
|
||||
make -C gcc
|
||||
20
gcc/Makefile
20
gcc/Makefile
|
|
@ -24,7 +24,7 @@ VPATH = $(srcdir)
|
|||
|
||||
CC = gcc
|
||||
|
||||
CFLAGS = -g -std=gnu11 -Wunused-function -m32
|
||||
BASE_CFLAGS = -g -std=gnu11 -Wunused-function -m32
|
||||
|
||||
INCLUDES = -I. -I$(srcdir)
|
||||
|
||||
|
|
@ -55,8 +55,17 @@ GENERATED = genrtl.c genrtl.h \
|
|||
tree-check.h \
|
||||
insn-config.h insn-flags.h insn-codes.h insn-attr.h
|
||||
|
||||
agbcc: $(OBJS)
|
||||
$(CC) $(CFLAGS) -o $@ $(OBJS) $(RTL_OBJS) $(PRINT_OBJS) $(RTLANAL_OBJS)
|
||||
.PHONY: normal old clean
|
||||
|
||||
# The usual compiler.
|
||||
normal: CFLAGS = $(BASE_CFLAGS)
|
||||
normal: $(OBJS)
|
||||
$(CC) $(CFLAGS) -o agbcc $(OBJS) $(RTL_OBJS) $(PRINT_OBJS) $(RTLANAL_OBJS)
|
||||
|
||||
# The old version of the compiler, used for building libgcc.
|
||||
old: CFLAGS = $(BASE_CFLAGS) -DOLD_COMPILER
|
||||
old: $(OBJS)
|
||||
$(CC) $(CFLAGS) -o old_agbcc $(OBJS) $(RTL_OBJS) $(PRINT_OBJS) $(RTLANAL_OBJS)
|
||||
|
||||
# Clear suffixes.
|
||||
.SUFFIXES:
|
||||
|
|
@ -84,10 +93,9 @@ $(DEPDIR)/%.d: ;
|
|||
GEN = genemit genoutput genrecog genextract genflags gencodes genconfig \
|
||||
genpeep gengenrtl gencheck genattr genattrtab genopinit
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
clean:
|
||||
$(RM) agbcc agbcc.exe $(OBJS) $(RTL_OBJS) $(RTLANAL_OBJS) $(PRINT_OBJS)
|
||||
$(RM) agbcc agbcc.exe old_agbcc old_agbcc.exe
|
||||
$(RM) $(OBJS) $(RTL_OBJS) $(RTLANAL_OBJS) $(PRINT_OBJS)
|
||||
$(RM) $(GENERATED)
|
||||
$(RM) $(GEN) $(addsuffix .exe,$(GEN)) $(addsuffix .o,$(GEN))
|
||||
$(RM) s-config s-flags s-codes s-emit s-recog s-opinit s-extract s-peep \
|
||||
|
|
|
|||
|
|
@ -6133,7 +6133,9 @@ expand_function_end (filename, line, end_bindings)
|
|||
use_variable (outgoing);
|
||||
}
|
||||
|
||||
#ifndef OLD_COMPILER
|
||||
use_return_register ();
|
||||
#endif
|
||||
|
||||
/* If this is an implementation of __throw, do what's necessary to
|
||||
communicate between __builtin_eh_return and the epilogue. */
|
||||
|
|
|
|||
|
|
@ -7634,8 +7634,12 @@ check_dbra_loop (loop_end, insn_count, loop_start, loop_info)
|
|||
}
|
||||
}
|
||||
}
|
||||
#ifndef OLD_COMPILER
|
||||
else if (GET_CODE (bl->biv->add_val) == CONST_INT
|
||||
&& INTVAL (bl->biv->add_val) > 0)
|
||||
#else
|
||||
else if (INTVAL (bl->biv->add_val) > 0)
|
||||
#endif
|
||||
{
|
||||
/* Try to change inc to dec, so can apply above optimization. */
|
||||
/* Can do this if:
|
||||
|
|
|
|||
|
|
@ -1512,6 +1512,7 @@ arm_valid_machine_decl_attribute(tree decl, tree attributes, tree attr, tree arg
|
|||
int
|
||||
s_register_operand(rtx op, enum machine_mode mode)
|
||||
{
|
||||
#ifndef OLD_COMPILER
|
||||
if (GET_MODE(op) != mode && mode != VOIDmode)
|
||||
return 0;
|
||||
|
||||
|
|
@ -1524,4 +1525,7 @@ s_register_operand(rtx op, enum machine_mode mode)
|
|||
return (GET_CODE(op) == REG
|
||||
&& (REGNO(op) >= FIRST_PSEUDO_REGISTER
|
||||
|| REGNO_REG_CLASS(REGNO(op)) != NO_REGS));
|
||||
#else
|
||||
return register_operand(op, mode);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
12
gcc/unroll.c
12
gcc/unroll.c
|
|
@ -238,7 +238,9 @@ unroll_loop (loop_end, insn_count, loop_start, end_insert_before,
|
|||
struct inline_remap *map;
|
||||
char *local_label;
|
||||
char *local_regno;
|
||||
#ifndef OLD_COMPILER
|
||||
int max_local_regnum;
|
||||
#endif
|
||||
int maxregnum;
|
||||
int new_maxregnum;
|
||||
rtx exit_label = 0;
|
||||
|
|
@ -756,8 +758,10 @@ unroll_loop (loop_end, insn_count, loop_start, end_insert_before,
|
|||
/* The preconditioning code may allocate two new pseudo registers. */
|
||||
maxregnum = max_reg_num ();
|
||||
|
||||
#ifndef OLD_COMPILER
|
||||
/* local_regno is only valid for regnos < max_local_regnum. */
|
||||
max_local_regnum = maxregnum;
|
||||
#endif
|
||||
|
||||
/* Allocate and zero out the splittable_regs and addr_combined_regs
|
||||
arrays. These must be zeroed here because they will be used if
|
||||
|
|
@ -1058,7 +1062,11 @@ unroll_loop (loop_end, insn_count, loop_start, end_insert_before,
|
|||
if (local_label[j])
|
||||
set_label_in_map (map, j, gen_label_rtx ());
|
||||
|
||||
#ifndef OLD_COMPILER
|
||||
for (j = FIRST_PSEUDO_REGISTER; j < max_local_regnum; j++)
|
||||
#else
|
||||
for (j = FIRST_PSEUDO_REGISTER; j < maxregnum; j++)
|
||||
#endif
|
||||
if (local_regno[j])
|
||||
{
|
||||
map->reg_map[j] = gen_reg_rtx (GET_MODE (regno_reg_rtx[j]));
|
||||
|
|
@ -1214,7 +1222,11 @@ unroll_loop (loop_end, insn_count, loop_start, end_insert_before,
|
|||
if (local_label[j])
|
||||
set_label_in_map (map, j, gen_label_rtx ());
|
||||
|
||||
#ifndef OLD_COMPILER
|
||||
for (j = FIRST_PSEUDO_REGISTER; j < max_local_regnum; j++)
|
||||
#else
|
||||
for (j = FIRST_PSEUDO_REGISTER; j < maxregnum; j++)
|
||||
#endif
|
||||
if (local_regno[j])
|
||||
{
|
||||
map->reg_map[j] = gen_reg_rtx (GET_MODE (regno_reg_rtx[j]));
|
||||
|
|
|
|||
12
install.sh
Normal file
12
install.sh
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
if [ "$1" != "" ]; then
|
||||
mkdir -p $1/tools/agbcc
|
||||
mkdir -p $1/tools/agbcc/bin
|
||||
mkdir -p $1/tools/agbcc/include
|
||||
mkdir -p $1/tools/agbcc/lib
|
||||
cp gcc/agbcc $1/tools/agbcc/bin/
|
||||
cp ginclude/* $1/tools/agbcc/include/
|
||||
cp libgcc/libgcc.a $1/tools/agbcc/lib/
|
||||
else
|
||||
echo "Usage: install.sh PATH"
|
||||
fi
|
||||
3
libgcc/.gitignore
vendored
Normal file
3
libgcc/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
*.a
|
||||
fp-bit.c
|
||||
dp-bit.c
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
CC1 = ../gcc/agbcc
|
||||
CC1 = ../gcc/old_agbcc
|
||||
CPP = cpp
|
||||
AS = $(DEVKITARM)/bin/arm-none-eabi-as
|
||||
AR = ar
|
||||
|
|
@ -24,6 +24,7 @@ libgcc1.a: lib1thumb.asm
|
|||
do \
|
||||
echo $${name}; \
|
||||
$(CPP) -DL$${name} -x assembler-with-cpp -o $${name}.s lib1thumb.asm; \
|
||||
echo -e ".text\n\t.align\t2, 0\n" >> $${name}.s ; \
|
||||
$(AS) -mcpu=arm7tdmi -o $${name}.o $${name}.s; \
|
||||
rm -f $${name}.s; \
|
||||
$(AR) -rc tmplibgcc1.a $${name}.o; \
|
||||
|
|
@ -42,6 +43,7 @@ libgcc2.a: libgcc2.c longlong.h
|
|||
$(CPP) -I ../ginclude -nostdinc -DL$${name} -o $${name}.i libgcc2.c; \
|
||||
$(CC1) -O2 $${name}.i; \
|
||||
rm -f $${name}.i; \
|
||||
echo -e ".text\n\t.align\t2, 0\n" >> $${name}.s ; \
|
||||
$(AS) -mcpu=arm7tdmi -o $${name}.o $${name}.s; \
|
||||
rm -f $${name}.s; \
|
||||
$(AR) -rc tmplibgcc2.a $${name}.o; \
|
||||
|
|
@ -53,6 +55,7 @@ fp-bit.o: fp-bit.c
|
|||
$(CPP) -I ../ginclude -nostdinc -o fp-bit.i fp-bit.c
|
||||
$(CC1) -O2 fp-bit.i
|
||||
rm -f fp-bit.i
|
||||
echo -e ".text\n\t.align\t2, 0\n" >> fp-bit.s
|
||||
$(AS) -mcpu=arm7tdmi -o fp-bit.o fp-bit.s
|
||||
rm -f fp-bit.s
|
||||
|
||||
|
|
@ -60,6 +63,7 @@ dp-bit.o: dp-bit.c
|
|||
$(CPP) -I ../ginclude -nostdinc -o dp-bit.i dp-bit.c
|
||||
$(CC1) -O2 dp-bit.i
|
||||
rm -f dp-bit.i
|
||||
echo -e ".text\n\t.align\t2, 0\n" >> dp-bit.s
|
||||
$(AS) -mcpu=arm7tdmi -o dp-bit.o dp-bit.s
|
||||
rm -f dp-bit.s
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user