Commit Graph

1829 Commits

Author SHA1 Message Date
Dan Gohman
57041ea9eb Tidy up semicolons. 2017-11-01 11:30:37 -07:00
Dan Gohman
39c0fbb6c7 Assert that sealed blocks cannot accept new predecessors. 2017-11-01 11:27:54 -07:00
Dan Gohman
1663f141c8 Tidy up unneeded parentheses. 2017-11-01 11:26:55 -07:00
Dan Gohman
aa724846f6 Clear the wasm operand stack at the end of a function.
This preserves an invariant that the stack is empty between function
body translations.
2017-11-01 11:25:22 -07:00
Dan Gohman
09b1bdc108 Make "cton-util compile" default to the isa specified in the test file. 2017-10-31 14:21:07 -07:00
Dan Gohman
5f8b1b9f04 Fix a flake8 lint. 2017-10-31 13:05:26 -07:00
Dan Gohman
3d83d0e4f0 Clean up redundant blank lines. 2017-10-31 12:45:22 -07:00
Dan Gohman
871bf95acf Change reloc_ebb to pass a CodeOffset rather than an Ebb index. 2017-10-31 12:26:38 -07:00
Dan Gohman
5d063eb8bc Merge reloc_func and reloc_globalsym into reloc_external. 2017-10-31 12:26:33 -07:00
Dan Gohman
b60b2ce135 Change parse_multiline to follow PEP 257.
The main change is that it avoids creating blank lines when processing
docstrings.

This also adds blank lines in various places to make the generated code
prettier.
2017-10-31 12:21:23 -07:00
Dan Gohman
149a41a684 Clean up copypasta. 2017-10-31 12:21:14 -07:00
Dan Gohman
9c54c3fff0 Introduce globalsym_addr.
This is an instruction used in legalization of GlobalVarData::Sym global
variables.
2017-10-30 13:26:56 -07:00
Dan Gohman
cb805f704d Put BaldrMonkey-specific behavior under a setting.
BaldrMonkey will need to enable allones_funcaddrs.
2017-10-30 13:26:56 -07:00
Dan Gohman
6fc45b070a Add a new kind of GlobalVar for symbolic addresses.
These addresses will allow referencing C/C++/Rust-style global variables
by name directly.
2017-10-30 13:26:56 -07:00
Dan Gohman
c2665385b1 Rename FunctionName to ExternalName. 2017-10-30 13:26:56 -07:00
Dan Gohman
fae5ffb556 Make generated code more consistent with current rustfmt. 2017-10-30 10:06:23 -07:00
Dan Gohman
1b61d5cd1e Enable the verifier by default in "cton-util compile". 2017-10-26 20:55:45 -07:00
Dan Gohman
683408f30b Break alias cycles by inserting zero values. 2017-10-26 12:22:16 -07:00
Dan Gohman
53e93d94a8 Avoid creating cyclic aliases in unreachable code. 2017-10-26 11:39:53 -07:00
Jakob Stoklund Olesen
91b1566aca Use "test regalloc" for the register allocator tests.
These tests were only using "test compile" because it doesn't require
any filecheck directives to be present, so just stop requiring filecheck
directives for "test regalloc" and other filecheck-based test drivers.
2017-10-25 18:31:14 -07:00
Jakob Stoklund Olesen
d37126565e Also consider fixed outputs for replace_global_defines.
Fixes #178.

When an instruction with a fixed output operand defines a globally live
SSA value, we need to check if the fixed register is available in the
`regs.global` set of registers that can be used across EBB boundaries.

If the fixed output register is not available in regs.global, set the
replace_global_defines flag so the output operands are rewritten as
local values.
2017-10-25 14:28:30 -07:00
Jakob Stoklund Olesen
1b71285b34 Return bools in GPR registers.
Boolean types are returned in %rax, so regclass_for_abi_type() should
return GPR.

Fixes #179.
2017-10-25 13:34:55 -07:00
Jakob Stoklund Olesen
02e81dd1d7 Fix build after flake8 update.
There's a new version of flake8 out which doesn't like variables names
i, l, I.

No functional change intended.
2017-10-25 11:40:37 -07:00
Jakob Stoklund Olesen
e8ecf1f809 Add a FixedTied constraint kind for operand constraints.
Fixes #175.

The Intel division instructions have fixed input operands that are
clobbered by fixed output operands, so the value passed as an input will
be clobbered just like a tied operand.

The FixedTied operand constraint is used to indicate a fixed input
operand that has a corresponding output operand with the same fixed
register.

Teach the spiller to teach a FixedTied operand the same as a Tied
operand constraint and make sure that the input value is killed by the
instruction.
2017-10-25 11:22:20 -07:00
Dan Gohman
2932a9314d Don't allocate srclocs if we only have default SourceLoc values.
This avoids needless extra indentation in `write_function` in the
case where no SourceLoc information is available.
2017-10-25 11:17:29 -07:00
Dan Gohman
dbd75483e8 Rename arg_value to param_value for consistency.
Also rename FunctionBuilder's `pristine` to `params_values_initialized`
to avoid confusion with the unrelated `is_pristine` accessor function.
2017-10-25 10:14:10 -07:00
Dan Gohman
b6eae2cfb6 Put FlagsOrIsa in code-comments. 2017-10-25 10:11:36 -07:00
Dan Gohman
fc0671a0cf Avoid dangling references to block params when sealing an unreachable block. 2017-10-25 10:04:18 -07:00
Dan Gohman
2d5faa01af Simplify code using the FunctionBuilder helper functions. 2017-10-24 15:28:28 -07:00
Dan Gohman
bbdce7e3e0 Update the comment for 'notrap()'. 2017-10-24 10:39:01 -07:00
Dan Gohman
fdf2486c0a Handle uninitialized values of type b1 and vector. 2017-10-23 15:23:57 -07:00
Jakob Stoklund Olesen
bdf726d101 Go back to tracking the latest mypy release.
Our bug (https://github.com/python/mypy/issues/4069) was fixed in the
mypy-0.540 release.
2017-10-21 12:30:46 -07:00
Dan Gohman
8387c53c3f Fix a typo. 2017-10-20 16:01:39 -07:00
Dan Gohman
c93959de7e Fix a bug handling a use_var of a value not defined in the entry block. 2017-10-20 15:55:04 -07:00
Jakob Stoklund Olesen
250c515ba9 Update the register allocator document.
- We have a coalescing pass which puts the code in CSSA form.
- We do not have an EBB argument fixup pass. This isn't needed with
  CSSA.
2017-10-20 15:15:22 -07:00
Dan Gohman
29a6ee77f3 Remove the definition of "safe".
`stack_addr` and unrestricted loads and stores *can* be used with entirely
defined behavior. The sense in which they're not "safe" is only that it's
possible to misuse them. This subtlety wasn't captured in the definition
of "safe" here, so for now, just remove the definition so that it doesn't
cause confusion.
2017-10-20 11:37:25 -07:00
Dan Gohman
f4b25ff058 Have FunctionBuilder clear the ILBuilder's state in its drop(). 2017-10-20 11:37:25 -07:00
Dan Gohman
9fdf44afd4 Clean up a stale comment. 2017-10-20 11:37:25 -07:00
Dan Gohman
f5e4058eb8 Update a stale comment. 2017-10-20 11:37:25 -07:00
Dan Gohman
d3077acf1c TranslationState can assert that its stacks are empty between functions. 2017-10-20 11:37:25 -07:00
Jakob Stoklund Olesen
8e9ac361bd Remove the CFG entry_block member.
It was not used.
2017-10-20 09:40:28 -07:00
Dan Gohman
2569ef4c42 Clarify undefined behavior and notrap. (#170)
* Clarify undefined behavior and notrap.

Remove the "No undefined behavior" paragraph from the README. The other
paragraphs, specifically "Portable semantics" and
"Fast sandbox verification", describe Cretonne's goals in this area.

Define *addressable* and *accessible* memory, so that trapping remains a fully defined part of the semantics, and we have a clear boundary around undefined behavior, and use these terms to describe related constructs.
2017-10-20 09:38:52 -07:00
Julien Wajsberg
e5c0e06fa8 Fix typo in README.rst 2017-10-20 09:27:18 -07:00
Jakob Stoklund Olesen
b3fb41087e Use the term "Function parameter" instead of "argument".
Rename the ArgumentType type to AbiParam since it describes the ABI
characteristics of a parameter or return value, not just the value type.

In Signature, rename members argument_types and return_types to "params"
and "returns". Again, they are not just types.

Fix a couple lingering references to "EBB arguments".
2017-10-19 17:39:23 -07:00
Jakob Stoklund Olesen
921bcc6c25 Use the term "EBB parameter" everywhere.
Add EBB parameter and EBB argument to the langref glossary to clarify
the distinction between formal EBB parameter values and arguments passed
to branches.

- Replace "ebb_arg" with "ebb_param" in function names that deal with
  EBB parameters.
- Rename the ValueDef variants to Result and Param.
- A bunch of other small langref fixes.

No functional changes intended.
2017-10-19 16:17:09 -07:00
Jakob Stoklund Olesen
ea68a69f8b Fix a flake8 lint.
Also don't infer writes_cpu_flags if it is specified explicitly.
2017-10-19 16:17:09 -07:00
Dan Gohman
7c9b9e3d27 Mark spill and fill as can_store and can_load.
This allows GVN to avoid hoisting them. These will be to coarse for
things that want more precise dependence information, however we can
work that out when we build such things.
2017-10-19 13:11:33 -07:00
Dan Gohman
cc0bb70c5d Make GVN aware of instructions that write to CPU flags. 2017-10-19 12:59:10 -07:00
Dan Gohman
bce3c38042 Clarify the todo about minimum / maximum. 2017-10-19 12:59:10 -07:00
Dan Gohman
3ccee371a7 Remove the todo for smod.
It's not present in either WebAssembly or Rust, for example. We can
still add smod in the future if future use cases need it.
2017-10-19 12:59:10 -07:00