diff options
author | Tristan Gingold <tgingold@free.fr> | 2020-03-08 21:14:26 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2020-03-08 21:14:26 +0100 |
commit | 442f905f3549cfc959c15a54c6b8d26e3cdd3052 (patch) | |
tree | cabea613ad0048f320eb7a5c245a206eccbdd00c /src/synth/synth-expr.adb | |
parent | 21ab5cfb88d182927e14789353e56fecd9960fd3 (diff) | |
download | ghdl-442f905f3549cfc959c15a54c6b8d26e3cdd3052.tar.gz ghdl-442f905f3549cfc959c15a54c6b8d26e3cdd3052.tar.bz2 ghdl-442f905f3549cfc959c15a54c6b8d26e3cdd3052.zip |
synth: handle user-defined operator call.
Diffstat (limited to 'src/synth/synth-expr.adb')
-rw-r--r-- | src/synth/synth-expr.adb | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/synth/synth-expr.adb b/src/synth/synth-expr.adb index 9d71145b6..b36545e89 100644 --- a/src/synth/synth-expr.adb +++ b/src/synth/synth-expr.adb @@ -1666,7 +1666,7 @@ package body Synth.Expr is end case; end Synth_Type_Conversion; - procedure Error_Unknown_Operator (Imp : Node; Loc : Node) is + procedure Error_Ieee_Operator (Imp : Node; Loc : Node) is begin if Get_Kind (Get_Parent (Imp)) = Iir_Kind_Package_Declaration and then (Get_Identifier @@ -1676,10 +1676,8 @@ package body Synth.Expr is then Error_Msg_Synth (+Loc, "unhandled predefined IEEE operator %i", +Imp); Error_Msg_Synth (+Imp, " declared here"); - else - Error_Msg_Synth (+Loc, "user defined operator %i not handled", +Imp); end if; - end Error_Unknown_Operator; + end Error_Ieee_Operator; function Synth_String_Literal (Syn_Inst : Synth_Instance_Acc; Str : Node; Str_Typ : Type_Acc) @@ -1814,6 +1812,10 @@ package body Synth.Expr is return Synth_Short_Circuit (Syn_Inst, Id_Or, Get_Left (Expr), Get_Right (Expr), Bit_Type, Expr); + when Iir_Predefined_None => + Error_Ieee_Operator (Imp, Expr); + return Synth_User_Operator + (Syn_Inst, Get_Left (Expr), Get_Right (Expr), Expr); when others => return Synth_Dyadic_Operation (Syn_Inst, Imp, @@ -1826,14 +1828,13 @@ package body Synth.Expr is Def : constant Iir_Predefined_Functions := Get_Implicit_Definition (Imp); begin - if Def in Iir_Predefined_Implicit - or else Def in Iir_Predefined_IEEE_Explicit - then + if Def = Iir_Predefined_None then + Error_Ieee_Operator (Imp, Expr); + return Synth_User_Operator + (Syn_Inst, Get_Operand (Expr), Null_Node, Expr); + else return Synth_Monadic_Operation (Syn_Inst, Imp, Get_Operand (Expr), Expr); - else - Error_Unknown_Operator (Imp, Expr); - raise Internal_Error; end if; end; when Iir_Kind_Simple_Name |