diff options
Diffstat (limited to 'translate')
-rw-r--r-- | translate/gcc/Make-lang.in | 2 | ||||
-rw-r--r-- | translate/ghdldrv/Makefile | 4 | ||||
-rw-r--r-- | translate/ghdldrv/ghdlprint.adb | 15 | ||||
-rw-r--r-- | translate/grt/Makefile.inc | 2 | ||||
-rw-r--r-- | translate/grt/config/amd64.S | 51 | ||||
-rwxr-xr-x[-rw-r--r--] | translate/grt/config/clock.c | 0 | ||||
-rw-r--r-- | translate/grt/config/i386.S | 30 | ||||
-rw-r--r-- | translate/grt/grt-values.adb | 4 | ||||
-rw-r--r-- | translate/grt/grt-vcd.adb | 4 | ||||
-rw-r--r-- | translate/translation.adb | 24 |
10 files changed, 80 insertions, 56 deletions
diff --git a/translate/gcc/Make-lang.in b/translate/gcc/Make-lang.in index 5a0b2a580..5eab2db24 100644 --- a/translate/gcc/Make-lang.in +++ b/translate/gcc/Make-lang.in @@ -92,7 +92,7 @@ ghdllib: ghdl$(exeext) $(GCC_PASSES) force # Build hooks: -vhdl.all.build: +vhdl.all.build: vhdl.all.cross: @echo "No support for building vhdl cross-compiler" diff --git a/translate/ghdldrv/Makefile b/translate/ghdldrv/Makefile index b4199a990..47f6e0f23 100644 --- a/translate/ghdldrv/Makefile +++ b/translate/ghdldrv/Makefile @@ -61,7 +61,7 @@ ortho_code-x86-flags.ads: echo "package Ortho_Code.X86.Flags renames Ortho_Code.X86.$(ORTHO_X86_FLAGS);" >> $@ ghdl_mcode: GRT_FLAGS+=-DWITH_GNAT_RUN_TIME -ghdl_mcode: default_pathes.ads $(GRT_ADD_OBJS) $(ORTHO_DEPS) memsegs_c.o chkstk.o force +ghdl_mcode: default_pathes.ads $(GRT_ADD_OBJS) $(ORTHO_DEPS) memsegs_c.o chkstk.o force $(GNATMAKE) -aI../../ortho/mcode -aI../../ortho $(GNATFLAGS) ghdl_mcode $(GNAT_BARGS) -largs memsegs_c.o chkstk.o $(GNAT_LARGS) $(GRT_ADD_OBJS) $(subst @,$(GRTSRCDIR),$(GRT_EXTRA_LIB)) ghdl_llvm_jit: GRT_FLAGS+=-DWITH_GNAT_RUN_TIME @@ -158,7 +158,7 @@ install.simul: $(MAKE) GHDL=ghdl_simul install.v87 install.v93 clean: force - $(RM) -f *.o *.ali ghdl_gcc ghdl_mcode + $(RM) -f *.o *.ali ghdl_gcc ghdl_mcode $(RM) -f b~*.ad? *~ default_pathes.ads $(RM) -rf ../lib diff --git a/translate/ghdldrv/ghdlprint.adb b/translate/ghdldrv/ghdlprint.adb index 9eaba5ce0..dedc1eb0a 100644 --- a/translate/ghdldrv/ghdlprint.adb +++ b/translate/ghdldrv/ghdlprint.adb @@ -374,17 +374,11 @@ package body Ghdlprint is Disp_Spaces; Disp_Text; when Tok_Xnor .. Tok_Ror => - if Flags.Vhdl_Std > Vhdl_87 then - Disp_Reserved; - else - Disp_Identifier; - end if; + Disp_Reserved; when Tok_Protected => - if Flags.Vhdl_Std >= Vhdl_00 then - Disp_Reserved; - else - Disp_Identifier; - end if; + Disp_Reserved; + when Tok_Across .. Tok_Tolerance => + Disp_Reserved; when Tok_Psl_Default | Tok_Psl_Clock | Tok_Psl_Property @@ -429,6 +423,7 @@ package body Ghdlprint is end if; when Tok_Left_Paren .. Tok_Colon | Tok_Comma .. Tok_Dot + | Tok_Equal_Equal | Tok_Integer | Tok_Real | Tok_Equal .. Tok_Slash diff --git a/translate/grt/Makefile.inc b/translate/grt/Makefile.inc index f0bdf61c6..2cd6722cd 100644 --- a/translate/grt/Makefile.inc +++ b/translate/grt/Makefile.inc @@ -62,7 +62,7 @@ ifeq ($(filter-out i%86 darwin%,$(arch) $(osys)),) GRT_TARGET_OBJS=i386.o linux.o times.o GRT_EXTRA_LIB= endif -ifeq ($(filter-out x84_64 darwin%,$(arch) $(osys)),) +ifeq ($(filter-out x86_64 darwin%,$(arch) $(osys)),) GRT_TARGET_OBJS=amd64.o linux.o times.o GRT_EXTRA_LIB= endif diff --git a/translate/grt/config/amd64.S b/translate/grt/config/amd64.S index 76475acdb..aa9a8c2ae 100644 --- a/translate/grt/config/amd64.S +++ b/translate/grt/config/amd64.S @@ -18,26 +18,34 @@ */ .file "amd64.S" .version "01.01" - + +#ifdef __ELF__ +#define ENTRY(func) .align 4; .globl func; .type func,@function; func: +#define END(func) .size func, . - func +#define NAME(name) name +#elif __APPLE__ +#define ENTRY(func) .align 4; .globl _##func; _##func: +#define END(func) +#define NAME(name) _##name +#else +#define ENTRY(func) .align 4; func: +#define END(func) +#define NAME(name) name +#endif .text - /* Function called to loop on the process. */ - .align 4 - .type grt_stack_loop,@function -grt_stack_loop: + /* Function called to loop on the process. */ +ENTRY(grt_stack_loop) mov 0(%rsp),%rdi call *8(%rsp) - jmp grt_stack_loop - .size grt_stack_loop, . - grt_stack_loop + jmp NAME(grt_stack_loop) +END(grt_stack_loop) /* function Stack_Create (Func : Address; Arg : Address) return Stack_Type; Args: FUNC (RDI), ARG (RSI) */ - .align 4 - .globl grt_stack_create - .type grt_stack_create,@function -grt_stack_create: +ENTRY(grt_stack_create) /* Standard prologue. */ pushq %rbp movq %rsp,%rbp @@ -45,15 +53,15 @@ grt_stack_create: sub $0x10,%rsp mov %rdi,-8(%rbp) mov %rsi,-16(%rbp) - + /* Allocate the stack, and exit in case of failure */ - callq grt_stack_allocate + callq NAME(grt_stack_allocate) test %rax,%rax je .Ldone /* Note: %RAX contains the address of the stack_context. This is also the top of the stack. */ - + /* Prepare stack. */ /* The function to be executed. */ mov -8(%rbp), %rdi @@ -62,7 +70,12 @@ grt_stack_create: mov -16(%rbp), %rsi mov %rsi, -16(%rax) /* The return function. Must be 8 mod 16. */ +#if __APPLE__ + movq _grt_stack_loop@GOTPCREL(%rip), %rsi + movq %rsi, -24(%rax) +#else movq $grt_stack_loop, -24(%rax) +#endif /* The context. */ mov %rbp, -32(%rax) mov %rbx, -40(%rax) @@ -78,16 +91,13 @@ grt_stack_create: .Ldone: leave ret - .size grt_stack_create,. - grt_stack_create +END(grt_stack_create) - .align 4 - .globl grt_stack_switch /* Arguments: TO (RDI), FROM (RSI) [VAL (RDX)] Both are pointers to a stack_context. */ - .type grt_stack_switch,@function -grt_stack_switch: +ENTRY(grt_stack_switch) /* Save call-used registers. */ pushq %rbp pushq %rbx @@ -110,7 +120,6 @@ grt_stack_switch: movq %rdx, %rax /* Run. */ ret - .size grt_stack_switch, . - grt_stack_switch +END(grt_stack_switch) - .ident "Written by T.Gingold" diff --git a/translate/grt/config/clock.c b/translate/grt/config/clock.c index 038ce2210..038ce2210 100644..100755 --- a/translate/grt/config/clock.c +++ b/translate/grt/config/clock.c diff --git a/translate/grt/config/i386.S b/translate/grt/config/i386.S index 2490ea1dd..5c8aa0d3a 100644 --- a/translate/grt/config/i386.S +++ b/translate/grt/config/i386.S @@ -18,7 +18,7 @@ */ .file "i386.S" .version "01.01" - + .text #ifdef __ELF__ @@ -34,7 +34,7 @@ #define END(func) #define NAME(name) name #endif - + /* Function called to loop on the process. */ ENTRY(grt_stack_loop) call *4(%esp) @@ -50,7 +50,7 @@ ENTRY(grt_stack_create) movl %esp,%ebp /* Keep aligned (call + pushl + 8 = 16 bytes). */ subl $8,%esp - + /* Allocate the stack, and exit in case of failure */ call NAME(grt_stack_allocate) testl %eax,%eax @@ -58,7 +58,7 @@ ENTRY(grt_stack_create) /* Note: %EAX contains the address of the stack_context. This is also the top of the stack. */ - + /* Prepare stack. */ /* The function to be executed. */ movl 8(%ebp), %ecx @@ -67,7 +67,13 @@ ENTRY(grt_stack_create) movl 12(%ebp), %ecx movl %ecx, -8(%eax) /* The return function. */ +#if __APPLE__ + call ___x86.get_pc_thunk.cx +L1$pb: + movl L_grt_stack_loop$non_lazy_ptr-L1$pb(%ecx), %eax +#else movl $NAME(grt_stack_loop), -12(%eax) +#endif /* The context. */ movl %ebx, -16(%eax) movl %esi, -20(%eax) @@ -109,5 +115,19 @@ ENTRY(grt_stack_switch) ret END(grt_stack_switch) - + +#if __APPLE__ + .section __TEXT,__textcoal_nt,coalesced,pure_instructions + .weak_definition ___x86.get_pc_thunk.cx + .private_extern ___x86.get_pc_thunk.cx +___x86.get_pc_thunk.cx: + movl (%esp), %ecx + ret + + .section __IMPORT,__pointers,non_lazy_symbol_pointers +L_grt_stack_loop$non_lazy_ptr: + .indirect_symbol _grt_stack_loop + .long 0 +#endif + .ident "Written by T.Gingold" diff --git a/translate/grt/grt-values.adb b/translate/grt/grt-values.adb index 336cf4e0a..97a36ae17 100644 --- a/translate/grt/grt-values.adb +++ b/translate/grt/grt-values.adb @@ -350,7 +350,7 @@ package body Grt.Values is S.Bounds := To_Std_String_Boundp(Bound'Address); -- find characters at the end... - Finish := Ghdl_Index_Type(Bound.Dim_1.Length)-1; + Finish := Bound.Dim_1.Length - 1; while White(S.Base.all(Finish)) loop Finish := Finish - 1; end loop; @@ -389,7 +389,7 @@ package body Grt.Values is end; if Rti.Kind = Ghdl_Rtik_Type_P64 then - Mult := Ghdl_I64(Multiple.Unit_64); + Mult := Multiple.Unit_64; else Mult := Ghdl_I64(Multiple.Unit_32); end if; diff --git a/translate/grt/grt-vcd.adb b/translate/grt/grt-vcd.adb index b262560c6..aa7f352ea 100644 --- a/translate/grt/grt-vcd.adb +++ b/translate/grt/grt-vcd.adb @@ -604,7 +604,9 @@ package body Grt.Vcd is Fact := 0.1; Delta_Exp := 1; end if; - while 1 = 1 loop -- Seek the first digit + + -- Seek the first digit + loop Digit := Digit_Floor(Val_tmp); if Digit > 0 then exit; diff --git a/translate/translation.adb b/translate/translation.adb index 71c05971f..8c46561fc 100644 --- a/translate/translation.adb +++ b/translate/translation.adb @@ -10278,7 +10278,6 @@ package body Translation is Atype := Tinfo.Ortho_Ptr_Type (Mode_Value); end case; when Type_Mode_Record => - -- part 1 of fix for https://gna.org/bugs/?19195 -- Create an object pointer. -- At elaboration: copy base from name. Atype := Tinfo.Ortho_Ptr_Type (Info.Alias_Kind); @@ -10342,7 +10341,6 @@ package body Translation is M2E (Name_Node)); end case; when Type_Mode_Record => - -- part 2 of fix for https://gna.org/bugs/?19195 Open_Temp; Stabilize (Name_Node); New_Assign_Stmt (Get_Var (Alias_Info.Alias_Var), @@ -13220,7 +13218,6 @@ package body Translation is return Lp2M (R, Type_Info, Name_Info.Alias_Kind); end if; when Type_Mode_Record => - -- part 3 of fix for https://gna.org/bugs/?19195 R := Get_Var (Name_Info.Alias_Var); return Lp2M (R, Type_Info, Name_Info.Alias_Kind); when others => @@ -27746,16 +27743,17 @@ package body Translation is if False then El := Get_Context_Items (Unit); --- while El /= Null_Iir loop --- case Get_Kind (El) is --- when Iir_Kind_Use_Clause => --- null; --- when Iir_Kind_Library_Clause => --- null; --- when others => --- Error_Kind ("translate1", El); --- end case; --- end loop; + while El /= Null_Iir loop + case Get_Kind (El) is + when Iir_Kind_Use_Clause => + null; + when Iir_Kind_Library_Clause => + null; + when others => + Error_Kind ("translate1", El); + end case; + El := Get_Chain (El); + end loop; end if; El := Get_Library_Unit (Unit); |