diff options
author | Tristan Gingold <tgingold@free.fr> | 2021-02-11 07:52:45 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2021-02-11 18:55:30 +0100 |
commit | 1fa657b73464e9deb1b633dd9d9a0b45935b61c4 (patch) | |
tree | f8baa0140a7a21cb5c63f83fef9cd23740e6ba09 | |
parent | 6090543d0315b2e04374d3ad19b393ea22016974 (diff) | |
download | ghdl-1fa657b73464e9deb1b633dd9d9a0b45935b61c4.tar.gz ghdl-1fa657b73464e9deb1b633dd9d9a0b45935b61c4.tar.bz2 ghdl-1fa657b73464e9deb1b633dd9d9a0b45935b61c4.zip |
vhdl-evaluation: factorize code
-rw-r--r-- | src/vhdl/vhdl-evaluation.adb | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/vhdl/vhdl-evaluation.adb b/src/vhdl/vhdl-evaluation.adb index c3067487e..41d18a07c 100644 --- a/src/vhdl/vhdl-evaluation.adb +++ b/src/vhdl/vhdl-evaluation.adb @@ -622,7 +622,7 @@ package body Vhdl.Evaluation is Func : Iir_Predefined_Functions; begin - if Get_Kind (Operand) = Iir_Kind_Overflow_Literal then + if Is_Overflow (Operand) then -- Propagate overflow. return Build_Overflow (Orig); end if; @@ -1080,7 +1080,7 @@ package body Vhdl.Evaluation is El := Get_Right (Op); end if; Ops_Val (I) := Eval_Static_Expr (El); - if Get_Kind (Ops_Val (I)) = Iir_Kind_Overflow_Literal then + if Is_Overflow (Ops_Val (I)) then Err_Orig := El; else case Iir_Predefined_Concat_Functions (Def) is @@ -1103,7 +1103,7 @@ package body Vhdl.Evaluation is Left_Op := Get_Left (Op); end if; Left_Val := Eval_Static_Expr (Left_Op); - if Get_Kind (Left_Val) = Iir_Kind_Overflow_Literal then + if Is_Overflow (Left_Val) then Err_Orig := Left_Op; else Left_Def := Def; @@ -1575,9 +1575,7 @@ package body Vhdl.Evaluation is Func : constant Iir_Predefined_Functions := Get_Implicit_Definition (Imp); begin - if Get_Kind (Left) = Iir_Kind_Overflow_Literal - or else Get_Kind (Right) = Iir_Kind_Overflow_Literal - then + if Is_Overflow (Left) or else Is_Overflow (Right) then return Build_Overflow (Orig); end if; @@ -2548,7 +2546,7 @@ package body Vhdl.Evaluation is begin Prefix := Get_Prefix (Expr); Prefix := Eval_Static_Expr (Prefix); - if Get_Kind (Prefix) = Iir_Kind_Overflow_Literal then + if Is_Overflow (Prefix) then return Build_Overflow (Expr, Get_Type (Expr)); end if; |