Commit Graph

1348 Commits

Author SHA1 Message Date
Dan Gohman
2b6502ac6e Fix handling of CFG triangles in compute_postorder.
For example, in `loops_one`, ebb3 is the bottom of a triangle, so
postorder should order it after the rest of the triangle.
2017-11-07 16:57:22 -08:00
Dan Gohman
849f090562 Fix nondeterminism in br_table translation. 2017-11-07 15:33:35 -08:00
Dan Gohman
15aff899ee Block no longer needs to implement Hash. 2017-11-07 15:19:55 -08:00
Dan Gohman
6d91a32d39 Add comments about "user" parameters. 2017-11-07 15:13:46 -08:00
Dan Gohman
cbb99bf233 Rename "user_arg_count" to "user_param_count" for consistency. 2017-11-07 15:13:46 -08:00
Dan Gohman
9b15fe7dfd Simplify Ebb parameter creation.
Ebb parameters are appended explicitly by whoever calls create_block,
so they don't need to also be inferred from branches. This makes the
frontend code more flexible for producers that want to create things
in a different order, and it eliminates more temporary allocations.

FunctionBuilder no longer maintains its own list of the function
parameter values; these can be obtained from the ebb parameter list
on the entry block.
2017-11-07 15:13:00 -08:00
Dan Gohman
cce2384ede Remove switch_to_block's jump_args argument.
switch_to_block doesn't need its jump_args argument, since jump
arguments are handled by the `jump` instruction and others, rather
than on the switch to a new ebb itself.
2017-11-06 16:38:13 -08:00
Dan Gohman
f76640778c Fix printing with -p when -c is also given. 2017-11-06 16:28:15 -08:00
Dan Gohman
5dda19035d Implement Hash for ExternalName.
This allows users to have HashMaps etc. with ExternalNames as keys.
2017-11-06 11:34:09 -08:00
Dan Gohman
1d8df2ed1e Remove the requirement that Variable implement Default. 2017-11-06 11:10:14 -08:00
Dan Gohman
4091688cc0 Avoid unnecessary name qualification. 2017-11-06 11:10:03 -08:00
Dan Gohman
d9743290ea Elide elidable lifetime parameters. 2017-11-06 11:09:56 -08:00
Dan Gohman
8501cb798e Minor comment cleanups. 2017-11-03 16:43:29 -07:00
Dan Gohman
acc6d941a3 Combine redundant match arm bodies. 2017-11-03 16:40:51 -07:00
Dan Gohman
c7f01f88b2 Clarify some comments. 2017-11-03 11:44:58 -07:00
Dan Gohman
e21479a843 Mark check_return_args as #[cfg(debug_assertions)]. 2017-11-02 12:28:01 -07:00
Dan Gohman
1cbf921d9d Add a function to seal all the blocks at once. 2017-11-02 08:00:55 -07:00
Dan Gohman
c6d39dea5d Add a comment about shrink_to_fit(). 2017-11-01 11:35:15 -07:00
Dan Gohman
61a51f5275 Rename a variable to clarify its purpose. 2017-11-01 11:34:16 -07:00
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