phillipstanleymarbell / Noisy-lang-compiler

Noisy language compiler
MIT License
17 stars 1 forks source link

Add dimensionality check of LLVM IR code with Newton signals. #550

Open blackgeorge-boom opened 3 years ago

blackgeorge-boom commented 3 years ago

Proposed Solution We are given an LLVM IR file as input, along with a Newton specification. The goal is to parse the IR file and for every operation, which includes Newton-defined signals, to perform a dimensionality check. One approach is this: for every basic block, determine the Newton types of the live-in and live-out values, and use them to check the consistency of the operations inside the basic block. The Newton type information is conveyed to LLVM through auto-generated header files, and is used from LLVM with the use of debug metadata.

Describe alternatives you've considered Another approach is to examine all operations in a top-down way, taking into account the operator precedence. That is, in order to check the dimensionality consistency of an expression ('+' operator), first do a dimensionality check for each of the terms ('*' operator), then for each of the factors ('^' operator/constant), etc.

blackgeorge-boom commented 3 years ago

Test the code with a real world example: https://github.com/phillipstanleymarbell/Noisy-lang-compiler/blob/master/applications/newton/invariants/BME680-conversion-routines-humidity.nt