]> git.ipfire.org Git - thirdparty/gcc.git/commit - gcc/m2/m2.flex
Remove duplicate constants created between passes
authorGaius Mulley <gaiusmod2@gmail.com>
Sun, 30 Apr 2023 01:53:23 +0000 (02:53 +0100)
committerGaius Mulley <gaiusmod2@gmail.com>
Sun, 30 Apr 2023 01:53:23 +0000 (02:53 +0100)
commitd5e2694e82591d734008982bafdc9ce6da65c0b0
tree0efdc9a2d1ecb6d1e64dfac87b2de1a9dceafec4
parent8eb1e39441723b0c38b13d300912a281b41fbd80
Remove duplicate constants created between passes

There is no need to re-create constant literals between passes.
This patch creates a constant pool and reuses a constant literal
providing it is created at the same location.  This in turn avoids
generating duplicate overflow error messages when encountering an
out of range constant literal.

gcc/m2/ChangeLog:

* gm2-compiler/SymbolTable.mod (ConstLitPoolEntry): New
pointer to record.
(ConstLitSym): New field RangeError.
(ConstLitPoolTree): New SymbolTree representing name to
index.
(ConstLitArray): New dynamic array containing pointers
to a ConstLitPoolEntry.
(CreateConstLit): New procedure function.
(LookupConstLitPoolEntry): New procedure function.
(AddConstLitPoolEntry): New procedure function.
(MakeConstLit): Re-implemented to check the constant lit
pool before calling CreateConstLit.
* m2.flex: Add ability to decode binary constant literals.

gcc/testsuite/ChangeLog:

* gm2/pim/run/pass/constlitbase.mod: New test.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
gcc/m2/gm2-compiler/SymbolTable.mod
gcc/m2/m2.flex
gcc/testsuite/gm2/pim/run/pass/constlitbase.mod [new file with mode: 0644]