Commit Graph

425 Commits

Author SHA1 Message Date
whitequark 1be9e7576d transforms.llvm_ir_generator: use byval for FFI calls where appropriate. 2016-01-10 18:31:35 +00:00
whitequark d436093317 transforms.llvm_ir_generator: use sret attribute on FFI calls too. 2016-01-10 17:42:40 +00:00
whitequark 7f914a057c transforms.llvm_ir_generator: use sret attribute. 2016-01-10 17:31:59 +00:00
whitequark edb7423a4f transforms.llvm_ir_generator: use getelementptr inbounds. 2016-01-10 16:36:04 +00:00
whitequark f92ce291ef transforms.llvm_ir_generator: call devirtualized functions directly. 2016-01-10 15:54:46 +00:00
whitequark c46fccdf4b transforms.llvm_ir_generator: annotate invariant loads as such. 2016-01-10 15:45:34 +00:00
whitequark b298170973 transforms.artiq_ir_generator: annotate embedded functions as internal. 2016-01-10 15:45:20 +00:00
whitequark f2f1deb9db transforms.llvm_ir_generator: quote recrusive objects correctly (fixes #213). 2016-01-07 19:52:31 +00:00
whitequark e8bba0a7d6 Commit missing parts of 6a6d7d. 2016-01-05 04:21:46 +00:00
whitequark 6a6d7dab19 transforms.artiq_ir_generator: add support for user-defined context managers. 2016-01-05 04:10:40 +00:00
whitequark dfbf55fed2 transforms/inferencer: add support for user-defined context manager. 2016-01-05 00:11:03 +08:00
whitequark 5baf18ba0d transforms.inferencer: factor out _unify_attribute. 2016-01-04 22:13:05 +08:00
whitequark 05fa80818a transforms.inferencer: make sure parallel/sequential is lone manager. 2016-01-04 21:26:03 +08:00
whitequark 3aa5acbaf3 transforms.llvm_ir_generator: don't crash if embedding is not enabled. 2016-01-03 19:07:11 +08:00
whitequark 81427af506 Remove selective attribute writeback; always synchronize all attributes.
The reasons are:
  1. Shadow memory manipulation added ~12 instructions to TTLOut.pulse
     (without inlining), and it's already barely fast enough.
  2. More importantly, code such as self.ts[1] did not trigger
     attribute writeback, and there seems to be no easy way to fix
     that.
2016-01-03 04:57:58 +08:00
whitequark 38a99fde52 Implement selective attribute writeback using shadow memory. 2016-01-02 22:51:04 +08:00
whitequark 2e33084a5f transforms.llvm_ir_generator: implement instrumentation for attribute writeback. 2016-01-02 06:51:30 +08:00
whitequark 5f68cc6a21 transforms.artiq_ir_generator: handle `raise` in `except:` with `finally:`. 2016-01-02 06:51:29 +08:00
whitequark 693a364d85 transforms.artiq_ir_generator: fix typo. 2015-12-31 22:39:33 +08:00
whitequark ff0ab736e9 Commit missing parts of 8aa34ee9. 2015-12-31 22:36:25 +08:00
whitequark 79d020dd3a transforms.artiq_ir_generator: handle terminated try body. 2015-12-31 22:36:25 +08:00
whitequark 8aa34ee952 compiler: don't require exceptions to inherit ARTIQException. 2015-12-31 21:54:54 +08:00
whitequark 0b69e488e6 transforms.llvm_ir_generator: compare exn typeinfo using strcmp.
This is necessary to correctly catch exceptions from RPCs.
2015-12-31 19:53:28 +08:00
whitequark 9ed6b54249 transforms.cfg_simplifier: remove.
Specifically, the following idiom broke our CFGSimplifier:

b1:
  branch_if %cond, %b2, %b3
b2:
  branch %b3
b3:
  %v = phi [ %b2 => 0, %b3 => 1 ]

This is very annoying to properly handle in general case, and also
this (specifically %b2) is exactly what broke LocalAccessValidator
in the first place. So, remove CFGSimplifier altogether.

Instead, teach LocalAccessValidator how to look through predecessors
in order to get a location.
2015-12-31 17:07:36 +08:00
whitequark 787a1d34fe transforms.llvm_ir_generator: don't crash when quoting over than one list. 2015-12-30 16:22:26 +08:00
whitequark 72b6cca9c3 transforms.cfg_simplifier: correctly update phis. 2015-12-30 16:07:14 +08:00
whitequark ac3a170c8f transforms.llvm_ir_generator: don't crash when quoting empty lists. 2015-12-30 15:47:57 +08:00
whitequark 5dcf936f4e transforms.inferencer: don't crash on partially-inferred binary expressions. 2015-12-30 15:46:54 +08:00
whitequark 78fb3e1b7b compiler: validate local accesses after interleaving. 2015-12-30 15:26:30 +08:00
whitequark df91500f68 Fix ff3206be. 2015-12-30 15:16:05 +08:00
whitequark 14484216ec transforms.cfg_simplifier: handle phi and branch_if properly. 2015-12-30 12:10:28 +08:00
whitequark 8822db089f transforms.cfg_simplifier: implement.
This allows error reporting in LocalAccessValidator to proceed
even when the predecessor is an empty block with only a branch.
2015-12-29 02:15:57 +08:00
whitequark 57ebd57ddb transforms.dead_code_eliminator: update doc. 2015-12-29 02:15:57 +08:00
whitequark b931096ec3 transforms.artiq_ir_generator: fix While codegen (closes #207). 2015-12-26 17:24:05 +08:00
whitequark 082e9e20dd compiler: do not associate SSA values with iodelay even when inlining.
Fixes #201.
2015-12-25 15:02:33 +08:00
whitequark 690b2fd034 transforms.artiq_ir_generator: fix optarg codegen (closes #205). 2015-12-25 12:40:45 +08:00
whitequark 25188f0ca9 transforms.interleaver: correctly handle degenerate `with parallel:` blocks. 2015-12-21 21:32:48 +08:00
whitequark f957be4e6f transforms.llvm_ir_generator: handle loop instruction (fixes #202). 2015-12-21 21:12:17 +08:00
whitequark e4615e7b37 transforms.int_monomorphizer: visit children of CallT. 2015-12-20 18:07:31 +08:00
whitequark 54aeb5030d transforms.int_monomorphizer: also monomorphize round() calls (#198). 2015-12-20 02:36:30 +08:00
whitequark 95af6daa28 transforms.inferencer: accept round(width=n) form (#198). 2015-12-20 01:02:57 +08:00
whitequark 4fcd6abc5e Commit missing parts of 0395efd4. 2015-12-19 06:33:29 +08:00
whitequark 4fb1de33c9 Initial invocation of a @kernel function can now return a value (fixes #197). 2015-12-19 05:26:18 +08:00
whitequark 0395efd479 compiler: give environment types in LLVM IR readable names. 2015-12-18 23:41:51 +08:00
whitequark 7b3ace2e30 transforms.inferencer: fix unsupported decorator diagnostic when embedding.
decorator.loc points to the quoted object with a synthesized location,
and it's not really worth refactoring when we can just point at the @.
2015-12-18 22:58:17 +08:00
whitequark 0755aa38ff transforms.iodelay_estimator: allow goto in zero-iodelay while statements. 2015-12-18 21:14:40 +08:00
whitequark 2759310662 transforms.iodelay_estimator: reject control flow in 'with parallel:' (fixes #195). 2015-12-18 21:02:53 +08:00
whitequark 8cb7844621 transforms.interleaver: unroll loops. 2015-12-17 00:52:22 +08:00
whitequark 5dd1fc993e transforms.dead_code_eliminator: also remove dead instructions. 2015-12-17 00:52:22 +08:00
whitequark 2570932264 transforms.interleaver: don't fail on delay-free loops/conditionals. 2015-12-16 19:26:17 +08:00
whitequark 69cdeaf706 transforms.interleaver: don't fail on degenerate parallel blocks. 2015-12-16 19:26:17 +08:00
whitequark f8eaeaa43f compiler: explicitly represent loops in IR. 2015-12-16 15:33:26 +08:00
whitequark 8751d2ee6c Delay.{expr→interval}. 2015-12-16 13:57:02 +08:00
whitequark 2d906daf7f compiler: implement 'with watchdog' support. 2015-12-10 23:11:00 +08:00
whitequark 4888e897b9 compiler: refactor to use builtins.TInt{32,64}. (NFC) 2015-12-10 23:06:23 +08:00
whitequark c660028abf transforms.llvm_ir_generator: fix reraise inside EH block. 2015-12-10 23:02:32 +08:00
whitequark 3ec9b677b2 Revert "transforms.artiq_ir_generator: treat builtins in 'with' syntactically."
This reverts commit ccc993071b.
2015-12-10 22:25:15 +08:00
whitequark ccc993071b transforms.artiq_ir_generator: treat builtins in 'with' syntactically. 2015-12-10 21:29:16 +08:00
whitequark 22dab0c7cc compiler: clarify confusing comment (NFC). 2015-12-10 20:50:28 +08:00
whitequark 8cb2215edb transforms.inferencer: only instantiate RPC function types, not regular. 2015-12-02 21:48:14 +08:00
whitequark 16ae0fb6eb compiler.embedding: instantiate RPC method types (fixes #180). 2015-11-27 16:29:13 +08:00
whitequark 66b1388a63 transforms.artiq_ir_generator: never put TVars in dicts.
A TVar looks just like whatever it points to, but it does not
compare equal, nor is its hash the same.
2015-11-24 02:59:15 +08:00
whitequark fec5c2ebf0 transforms.interleaver: add a diagnostic for interleave inlining failure. 2015-11-24 02:57:03 +08:00
whitequark 9bc62fa3d2 transforms.iodelay_estimator: correctly handle functions with empty body. 2015-11-24 00:46:26 +08:00
whitequark 32fe4a8a0c transforms.llvm_ir_generator: don't assert on inlined functions. 2015-11-24 00:20:33 +08:00
whitequark 178ff74da2 transforms.interleaver: inline calls. 2015-11-24 00:02:07 +08:00
whitequark 03b4e4027c transforms.interleaver: fix IR type/value mismatch. 2015-11-23 18:53:42 +08:00
whitequark 73845279ae transforms.interleaver: determine when inlining is not necessary. 2015-11-23 18:08:33 +08:00
whitequark a01e328b4a transforms.interleaver: don't assume all delay expressions are folded. 2015-11-21 17:24:00 +08:00
whitequark 82b470891f transforms.interleaver: handle function calls (as atomic so far).
This commit solves issue #2 described in 50e7b44; a function call
is now a valid decomposition for a delay instruction, and this
metadata is propagated when the interleaver converts delays.

However, the interleaver does not yet detect that a called function
is compound, i.e. it is not correct.
2015-11-21 03:34:24 +08:00
whitequark 57dd163d37 transforms.artiq_ir_generator: fix decomposition of explicit delay_mu(). 2015-11-21 03:27:06 +08:00
whitequark cb3b811fd7 compiler: maintain both the IR and iodelay forms of delay expressions.
After this commit, the delay instruction (again) does not generate
any LLVM IR: all heavy lifting is relegated to the delay and delay_mu
intrinsics. When the interleave transform needs to adjust the global
timeline, it synthesizes a delay_mu intrinsnic. This way,
the interleave transformation becomes composable, as the input and
the output IR invariants are the same.

Also, code generation is adjusted so that a basic block is split off
not only after a delay call, but also before one; otherwise, e.g.,
code immediately at the beginning of a `with parallel:` branch
would have no choice but to execute after another branch has already
advanced the timeline.

This takes care of issue #1 described in 50e7b44 and is a step
to solving issue #2.
2015-11-21 03:22:47 +08:00
whitequark 50e7b44d04 compiler: actually implement interleaving correctly (calls are still broken).
The previous implementation was completely wrong: it always advanced
the global timeline by the same amount as the non-interleaved basic
block did.

The new implementation only advances the global timeline by
the difference between its current time and the virtual time of
the branch, which requires it to adjust the delay instructions.

Previously, the delay expression was present in the IR twice: once
as the iodelay.Expr transformation-visible form, and once as regular
IR instructions, with the latter form being passed to the delay_mu
builtin and advancing the runtime timeline.

As a result of this change, this strategy is no longer valid:
we can meaningfully mutate the iodelay.Expr form but not the IR
instruction form. Thus, IR instructions are no longer generated for
delay expressions, and the LLVM lowering pass now has to lower
the iodelay.Expr objects as well.

This works OK for flat `with parallel:` expressions, but breaks down
outside of `with parallel:` or when calls are present. The reasons
it breaks down are as follows:

  * Outside of `with parallel:`, delay() and delay_mu() must accept
    any expression, but iodelay.Expr's are not nearly expressive
    enough. So, the IR instruction form must actually be kept as well.

  * A delay instruction is currently inserted after a call to
    a user-defined function; this delay instruction introduces
    a point where basic block reordering is possible as well as
    provides delay information. However, the callee knows nothing
    about the context in which it is called, which means that
    the runtime timeline is advanced twice. So, a new terminator
    instruction must be added that combines the properties of delay
    and call instructions (and another for delay and invoke as well).
2015-11-21 00:02:47 +08:00
whitequark 73c358a59a Reformat. 2015-11-20 23:33:06 +08:00
whitequark cc623c13b4 Reformat. 2015-11-20 21:45:34 +08:00
whitequark d0f86e05d0 transforms.interleaver: add safety check. 2015-11-20 17:27:04 +08:00
whitequark 88b7990714 transforms.iodelay_estimator: fail statements with indeterminate delay inside `with parallel`. 2015-11-20 17:10:25 +08:00
whitequark 00ec574d73 transforms.interleaver: implement (without inlining). 2015-11-20 00:03:26 +08:00
whitequark 025bfbe746 transforms.llvm_ir_generator: accept delay instructions.
The delay instruction is just like a branch (discontinuity
in instruction flow), but it also carries metadata: how long
did the execution of its basic block take. This metadata only
matters during inlining and interleaving, so we treat it here
as a mere branch.
2015-11-19 23:55:52 +08:00
whitequark 9639a831bc transforms.artiq_ir_generator: correctly emit IfExpT with control flow.
This can happen with nested if expressions, as well as if
the if expression includes delays.
2015-11-19 23:44:39 +08:00
whitequark 2543daa5cf transforms.artiq_ir_generator: don't emit delay instruction for zero delay.
Call nodes with iodelay=Const(0) can be generated outside of
`with parallel:`, where Interleaver won't and LLVMIRGenerator can't
lower them.
2015-11-19 23:24:46 +08:00
whitequark 58db347e01 transforms.iodelay_estimator: fix uninitialized access. 2015-11-19 23:23:39 +08:00
whitequark 48a2bb10d5 transforms.interleaver: add boilerplate. 2015-11-17 05:22:20 +03:00
whitequark de9d7eb2e4 compiler: add `delay` IR instruction. 2015-11-17 05:16:43 +03:00
whitequark e619154c81 transforms.iodelay_estimator: fix handling of `with sequential`. 2015-11-17 01:22:48 +03:00
whitequark 506725f78a transforms.iodelay_estimator: fix handling of methods. 2015-11-17 01:19:22 +03:00
whitequark b0c6b70971 transforms.asttyped_rewriter: fix class redefinition diagnostic. 2015-11-17 01:17:25 +03:00
whitequark 9e0a5b9404 transforms.iodelay_estimator: skip statements, not modules on _UnknownDelay. 2015-11-17 01:00:10 +03:00
whitequark 44d0a35409 transforms.iodelay_estimator: actually iterate to fixpoint. 2015-11-17 00:59:40 +03:00
whitequark 10f82ff2c8 transforms.iodelay_estimator: do not unify indeterminate delays. 2015-11-17 00:59:09 +03:00
whitequark eefa9e2ea6 transforms.inferencer: fix typo. 2015-11-17 00:02:15 +03:00
whitequark b91ffa1b38 ir: fix default argument fiasco. 2015-10-14 17:02:59 +03:00
whitequark 5d64df829e transforms.artiq_ir_generator: fix devirtualized call annotation. 2015-10-14 16:12:00 +03:00
whitequark 32ce33a1f9 transforms.artiq_ir_generator: emit ir.Parallel for with parallel:. 2015-10-09 03:10:39 +03:00
whitequark 48f1f48f09 transforms.artiq_ir_generator: devirtualize method calls. 2015-10-09 02:27:52 +03:00
whitequark 0bb793199f transforms.artiq_ir_generator: devirtualize closure calls. 2015-10-09 01:32:27 +03:00
whitequark 7043b333a7 transforms.devirtualizer → analyses.devirtualization. 2015-10-09 00:29:31 +03:00
whitequark 962dd9de13 transforms.devirtualizer.MethodResolver: implement. 2015-10-07 22:33:08 +03:00
whitequark 6ac82e1439 transforms.devirtualizer.FunctionResolver: implement. 2015-10-07 22:33:00 +03:00
whitequark 42b0089a4c transforms.asttyped_rewriter: simplify. 2015-10-07 22:03:24 +03:00
whitequark 7a6fc3983c Make delay component of function type unifyable. 2015-09-30 18:41:14 +03:00
whitequark 60c985bf0b Remove debug print. 2015-09-27 17:55:19 +03:00
whitequark 867a0689ad transforms.Inferencer: narrow range() element type. 2015-09-02 17:55:48 -06:00
whitequark b971cc8cdf compiler.{iodelay,transforms.iodelay_estimator}: implement. 2015-09-02 17:55:48 -06:00
whitequark 156779007a LLVMIRGenerator: implement quoting of lists. 2015-08-31 23:33:33 -06:00
whitequark 956c1985b1 ARTIQIRGenerator: evaluate SubscriptT index in non-assignment context. 2015-08-31 23:33:04 -06:00
whitequark 3ca5967cea LLVMIRGenerator: don't map sret LLVM argument to any ARTIQ arguments. 2015-08-31 14:02:02 -06:00
whitequark 5e0ec3a6ea ARTIQIRGenerator: fix keyword/optional argument codegen in calls. 2015-08-31 13:42:36 -06:00
whitequark 501ba912c2 Implement {delay,now,at}{,_mu} and {mu,seconds}_to_{seconds,mu}. 2015-08-31 09:59:33 -06:00
whitequark 2124ff9e91 Fix tests. 2015-08-28 05:28:58 -05:00
whitequark 37811f690b ARTIQIRGenerator: support comparisons against None. 2015-08-28 05:14:52 -05:00
whitequark c621b1f275 compiler: handle language.core.int during embedding. 2015-08-28 03:24:15 -05:00
whitequark 83ebb999c8 transforms.Inferencer: improve attribute unification diagnostic. 2015-08-28 03:23:15 -05:00
whitequark 9fd25a1cc4 LLVMIRGenerator: fix syscall emission. 2015-08-28 03:03:12 -05:00
whitequark 9936768603 ARTIQIRGenerator: fix non-nullary method calls. 2015-08-28 02:11:05 -05:00
whitequark c21387dc09 compiler.embedding: support calling methods marked as @kernel. 2015-08-27 19:46:50 -05:00
whitequark 84e32db622 LLVMIRGenerator: handle self-referential class types. 2015-08-27 15:40:46 -05:00
whitequark 71ebe1778d LLVMIRGenerator: remove debug print. 2015-08-27 15:40:15 -05:00
whitequark c62b16d5e1 compiler.embedding: support RPC functions as host attribute values. 2015-08-27 05:53:18 -05:00
whitequark cb225269ff Allow accessing attributes of embedded host objects. 2015-08-27 05:01:04 -05:00
whitequark 9b9fa1ab7c Allow embedding and RPC sending host objects. 2015-08-25 21:56:01 -07:00
whitequark 526d7c4e46 Fix a typo. 2015-08-22 14:01:55 -07:00
whitequark a557445e05 LocalAccessValidator: assume variables with "$" in name are internal.
Internal variables are assumed to be scoped correctly
(including not being accessed uninitialized).

This was changed from "." because artiq.compiler.embedding uses
"." in module prefix of function names.
2015-08-22 13:56:17 -07:00
whitequark 0e26cfb66e LocalAccessValidator: relax restrictions to accept def f(); def g(). 2015-08-22 13:31:09 -07:00
whitequark b39e76ae28 Remove debug print. 2015-08-22 12:22:26 -07:00
whitequark 27a697920a LLVMIRGenerator: use sret when returning large structures. 2015-08-19 15:06:03 -07:00
whitequark afc3f36104 ARTIQIRGenerator: fix polymorphic print on closures. 2015-08-19 12:37:22 -07:00
whitequark 53b4d87647 LLVMIRGenerator: attach debug metadata to all emitted LLVM instructions. 2015-08-19 12:18:20 -07:00
whitequark 51c591f01a Unbreak tests. 2015-08-18 22:44:09 -07:00
whitequark 6c8de9b6d4 Implement methods. 2015-08-18 22:39:22 -07:00
whitequark 94a2d5f5fa Implement class attribute access through instances. 2015-08-15 11:07:54 -04:00
whitequark 00efc8c636 Implement class definitions and class attribute access. 2015-08-15 09:45:16 -04:00
whitequark 786fde827a Unbreak tests. 2015-08-11 00:41:31 +03:00
whitequark c72267ecf5 Implement syscalls for the new compiler. 2015-08-10 20:26:06 +03:00
whitequark b28a874274 Inferencer: range() does not accept a float argument. 2015-08-10 17:06:55 +03:00
whitequark f53a5ff202 Remove syscall builtin. 2015-08-10 16:44:29 +03:00
whitequark c63ec70c53 LLVMIRGenerator: emit debug information. 2015-08-10 15:11:52 +03:00
whitequark 8f510a4407 compiler.ir.Function: add loc field. 2015-08-10 13:14:52 +03:00
whitequark 22570afbda LLVMIRGenerator: allocate less. 2015-08-10 09:12:34 +03:00
whitequark dfc91a35f2 ARTIQIRGenerator.polymorphic_print: str([x]) uses repr(x), not str(x). 2015-08-09 20:27:04 +03:00
whitequark f7b64db8f4 LLVMIRGenerator: fixup phis on expansion of ARTIQ instructions. 2015-08-09 20:24:16 +03:00
whitequark d4270cf66e Implement receiving data from RPCs. 2015-08-09 20:17:00 +03:00
whitequark 02b1543c63 Implement receiving exceptions from RPCs. 2015-08-09 16:16:41 +03:00
whitequark 9c5ca2ae29 LLVMIRGenerator: add target data layout to LLVM modules. 2015-08-09 14:39:21 +03:00
whitequark 153592f1cc Naming. 2015-08-09 02:25:58 +03:00
whitequark b26af5df60 Implement sending RPCs. 2015-08-09 02:17:19 +03:00
whitequark 22457bc19c Ensure uwtable is added to all generated functions. 2015-08-08 21:48:21 +03:00
whitequark ee3f35c608 Improve error message on passing an argument twice. 2015-08-08 21:06:13 +03:00
whitequark bdcf7f100b ARTIQIRGenerator: add semantic locs to all other implicitly raised exceptions. 2015-08-08 16:26:53 +03:00
whitequark acd8d6355f transforms.ARTIQIRGenerator: IndexError loc should point to "[". 2015-08-08 16:18:57 +03:00
whitequark 27d2390fed Add zero-cost exception support to runtime and host. 2015-08-08 16:01:31 +03:00
whitequark a7633f75c7 Show origin of expansion in diagnostics for synthesized code. 2015-08-07 13:56:18 +03:00
whitequark 50448ef554 Add support for referring to host values in embedded functions. 2015-08-07 13:24:01 +03:00
whitequark 353f454a29 Add basic support for embedded functions with new compiler. 2015-08-07 11:44:49 +03:00
whitequark 1a969aa9e4 compiler.transforms.inferencer: accept and ignore @kernel decorator. 2015-08-07 07:54:35 +03:00
whitequark 7562d39750 compiler.module: split off inferencing from Module.__init__. 2015-08-06 08:25:53 +03:00
whitequark ca52b2fdd0 compiler.transforms.ARTIQIRGenerator: fix typo. 2015-08-06 08:25:53 +03:00
whitequark e8c107925c Implement shared object linking. 2015-07-29 20:35:16 +03:00
whitequark 3378dd57b8 Fold llvmlite patches into m-labs/llvmlite repository. 2015-07-29 13:54:00 +03:00
whitequark 2939d4f0f3 Add tests for finally clause and reraising. 2015-07-27 12:36:21 +03:00
whitequark a83e7e2248 Add tests for exceptional control flow. 2015-07-27 10:22:28 +03:00
whitequark 90be44c596 Add tests for non-exceptional control flow across finally. 2015-07-27 10:13:22 +03:00
whitequark 7c77dd317a Implement __artiq_personality. 2015-07-27 09:10:20 +03:00
whitequark 47f13bf921 Always load the personality library in JIT testbench, if available. 2015-07-27 04:44:40 +03:00
whitequark 692791f0bd Make sure a landing pad returns {i8*} to soothe LLVM codegen. 2015-07-25 07:01:25 +03:00
whitequark ece52062f2 Implement code generation for exception handling. 2015-07-25 05:37:37 +03:00
whitequark 65121b437f Rework internal logic of slices. 2015-07-23 07:57:49 +03:00
whitequark 9db199cad9 Handle closure effects appropriately in LocalAccessValidator. 2015-07-23 03:15:36 +03:00
whitequark acb8810e62 Add tests for lambdas and functions. 2015-07-23 03:07:30 +03:00
whitequark f8c2709943 Make division by zero raise an exception. 2015-07-23 01:26:50 +03:00
whitequark 4cfe4ea148 Make negative and too-far shifts have defined behavior. 2015-07-23 00:58:41 +03:00
whitequark bf60978c7b Add bool coercion support. 2015-07-22 19:15:54 +03:00
whitequark de181e0cb9 Revert "Require boolean operand in BoolOp."
This reverts commit 5d518dcec6.
2015-07-22 18:35:18 +03:00
whitequark 51aef980a0 Revert "Require boolean condition in If, While, IfExp."
This reverts commit e21829ce74.
2015-07-22 18:35:14 +03:00
whitequark f2a6110cc4 Add integration tests for every language construct. 2015-07-22 18:34:52 +03:00
whitequark dff4ce7e3a Return LLVM IR module from LLVMIRGenerator.process. 2015-07-22 04:13:04 +03:00
whitequark 86e006830c Use the correct printf format for 64-bit integers. 2015-07-22 03:05:15 +03:00
whitequark 236d5b886a Add support for Assert. 2015-07-22 02:58:59 +03:00
whitequark 5d518dcec6 Require boolean operand in BoolOp. 2015-07-21 23:46:22 +03:00
whitequark e21829ce74 Require boolean condition in If, While, IfExp. 2015-07-21 23:39:22 +03:00
whitequark 1e851adf4f Add a polymorphic print function. 2015-07-21 22:32:10 +03:00
whitequark 0e7294db8d Null-terminate all string literals. 2015-07-21 19:57:18 +03:00
whitequark 9d20080624 Use internal linkage for interior Python global values. 2015-07-21 19:55:43 +03:00
whitequark 7301a76d68 Mark string constants as unnamed_addr.
As a result they will be merged when possible.
2015-07-21 17:10:31 +03:00
whitequark 49ece6a12a Add support for string literals. 2015-07-21 14:27:48 +03:00
whitequark ec9d40b04f Add LLVM IR generation for function calls. 2015-07-21 13:45:27 +03:00
whitequark 6f11fa6bb1 Add conversion to LLVM IR (except handling of exception handling). 2015-07-21 04:55:01 +03:00
whitequark 2c010b10ee Remove UnaryOp ARTIQ IR instruction; rename BinaryOp to Arith.
Everything it can express can also be expressed via Arith.
2015-07-19 11:51:53 +03:00
whitequark ac491fae47 Add LocalAccessValidator. 2015-07-19 11:44:51 +03:00
whitequark adf18bb042 Fix assignment to tuples in IRGenerator. 2015-07-19 10:31:11 +03:00
whitequark 4bd83fb43d Use ".k" instead of "k" for the finalizer continuation variable.
The dot signifies that this is an internal variable and it
does not need to be tracked as if it was a user-defined one.
2015-07-19 10:30:42 +03:00
whitequark 8eedb3bc44 Fix IRGenerator.append(loc=...). 2015-07-19 10:29:33 +03:00
whitequark f212ec0263 Add a trivial dead code elimination transform.
Its purpose is to sweep up basic blocks with no predecessors,
which are annoying to handle explicitly elsewhere.
2015-07-19 10:29:14 +03:00
whitequark 47cbadb564 Revert "Ensure bindings are created in correct order for e.g. "x, y = y, x"."
This reverts commit bcd1832203.

The bindings are actually created in lexical order, as evident
in e.g. "x = lambda: x". The safety provided by this check should
be instead provided by a local access analysis.
2015-07-18 09:54:11 +03:00
whitequark 8e1cc8d985 Add an explicit ARTIQ IR instruction to create a closure. 2015-07-18 09:27:34 +03:00
whitequark 5ad02d5282 Fix ARTIQ IR generation for variables declared global. 2015-07-18 09:10:41 +03:00
whitequark 21eafefd28 Fix inference for globals. 2015-07-18 08:13:49 +03:00
whitequark 0d66bdfbf8 Fix For miscompilation. 2015-07-18 07:58:43 +03:00
whitequark dde2e67c3f Add source locations to ARTIQ IR instructions. 2015-07-18 07:49:42 +03:00
whitequark 255ffec483 Generate more compact ARTIQ IR for else-less if. 2015-07-18 07:49:27 +03:00
whitequark e96bc3c36c Add complete IR generator. 2015-07-17 21:29:06 +03:00
whitequark f28549a11a Add builtins.is_exception. 2015-07-17 16:05:02 +03:00
whitequark 3b661b2b65 Fix environment corruption by ExceptHandler without a name. 2015-07-17 16:04:46 +03:00
whitequark 2dcb744519 Fix inference for default arguments. 2015-07-16 17:26:31 +03:00
whitequark bcd1832203 Ensure bindings are created in correct order for e.g. "x, y = y, x". 2015-07-16 15:59:59 +03:00
whitequark 5756cfcebc Correctly infer type of list(iterable). 2015-07-16 15:35:46 +03:00
whitequark c1e7a82e97 Add IndexError and ValueError builtins. 2015-07-16 14:58:40 +03:00
whitequark a6950bf11d Move builtin.is_{builtin,exn_constructor} to types. 2015-07-16 14:56:39 +03:00
whitequark 5000f87dfc Rename the field of CoerceT from expr to value. 2015-07-16 14:55:23 +03:00
whitequark e9416f4707 Convert Slice into typed SliceT. 2015-07-16 14:54:04 +03:00
whitequark 53fb03d1bf Restrict comprehensions to single for and no if clauses. 2015-07-16 14:52:41 +03:00
whitequark 227f97f8a3 Add inference for Index, Slice and ExtSlice. 2015-07-16 04:22:41 +03:00
whitequark c724e024ce Fix inference for multiple-target assignments. 2015-07-15 06:33:44 +03:00
whitequark bdcb24108b Add basic IR generator. 2015-07-14 08:56:51 +03:00
whitequark f417ef31a4 Make binop coercion look through CoerceT nodes.
This fixes inference for "x = 1 + 1" after int monomorphization.
2015-07-14 06:42:09 +03:00
whitequark 4785f0a2de Don't error out in inferencer if builtin arguments have polymorphic types. 2015-07-04 04:27:15 +03:00
whitequark 16432d2652 Implement escape analysis. 2015-07-04 04:16:37 +03:00
whitequark 4358c5c453 Unbreak return type inference. 2015-07-04 02:23:55 +03:00
whitequark 561d403ddd Add missing _loc forwarding. 2015-07-04 00:59:03 +03:00
whitequark ee0990cb5e Automatically infer return type of NoneType for no return statements. 2015-07-04 00:58:48 +03:00
whitequark 7c833f0727 Move transforms.MonomorphismChecker to validators.MonomorphismValidator. 2015-07-02 21:54:31 +03:00
whitequark 02b41ea0f7 Add MonomorphismChecker. 2015-07-02 21:28:26 +03:00
whitequark 8a65266f14 Improve builtin call error message. 2015-07-02 20:06:07 +03:00
whitequark 196acb37f6 Add IntMonomorphizer. 2015-07-02 19:57:27 +03:00
whitequark 7ce9bdf54d Move transforms to artiq.compiler.transforms, add artiq.Module. 2015-07-02 19:35:35 +03:00