Commit Graph

38 Commits

Author SHA1 Message Date
Kartik Agaram
f3d33ac462 7231 2020-11-12 23:25:45 -08:00
Kartik Agaram
93c6352dda 6943
Move some implementation around for floating-point.

I originally thought I wouldn't bother supporting sigils like %xmm0. But
it turns out I need them to pass floats into SubX function calls. And it
turns out the sigils work fine for free.
2020-10-04 00:54:57 -07:00
Kartik Agaram
690fa191f1 6595 2020-06-29 18:01:44 -07:00
Kartik Agaram
7dac9ade15 6507 - use syscall names everywhere 2020-06-10 23:09:30 -07:00
Kartik Agaram
144abce230 6212 2020-04-25 20:27:24 -07:00
Kartik Agaram
df609237c1 6158 - standardize opcode names
At the lowest level, SubX without syntax sugar uses names without prepositions.
For example, 01 and 03 are both called 'add', irrespective of source and
destination operand. Horizontal space is at a premium, and we rely on the
comments at the end of each line to fully describe what is happening.

Above that, however, we standardize on a slightly different naming convention
across:
  a) SubX with syntax sugar,
  b) Mu, and
  c) the SubX code that the Mu compiler emits.

Conventions, in brief:
  - by default, the source is on the left and destination on the right.
    e.g. add %eax, 1/r32/ecx ("add eax to ecx")
  - prepositions reverse the direction.
    e.g. add-to %eax, 1/r32/ecx ("add ecx to eax")
         subtract-from %eax, 1/r32/ecx ("subtract ecx from eax")
  - by default, comparisons are left to right while 'compare<-' reverses.

Before, I was sometimes swapping args to make the operation more obvious,
but that would complicate the code-generation of the Mu compiler, and it's
nice to be able to read the output of the compiler just like hand-written
code.

One place where SubX differs from Mu: copy opcodes are called '<-' and
'->'. Hopefully that fits with the spirit of Mu rather than the letter
of the 'copy' and 'copy-to' instructions.
2020-03-21 16:51:52 -07:00
Kartik Agaram
de4664ffb9 6046
One more error condition when desugaring function calls in SubX.
2020-02-21 18:43:16 -08:00
Kartik Agaram
71eb22a5bf 5924 2020-01-27 00:36:44 -08:00
Kartik Agaram
33258e0ad2 5903 2020-01-19 21:58:32 -08:00
Kartik Agaram
6070c23e5e 5897 - rename comparison instructions
Signed and unsigned don't quite capture the essence of what the different
combinations of x86 flags are doing for SubX. The crucial distinction is
that one set of comparison operators is for integers and the second is
for addresses.
2020-01-16 18:31:12 -08:00
Kartik Agaram
5a6601aba9 5896 2020-01-16 18:10:42 -08:00
Kartik Agaram
01e88c8833 5895 2020-01-16 18:10:42 -08:00
Kartik Agaram
f1eade7286 5883 - drop the ref keyword
When I created it I was conflating two things:
a) needing to refer to just the start, rather than the whole, and
b) counting indirections.

Both are kinda ill-posed. Now Mu will have just `addr` and `handle` types.
Normal types will translate implicitly to `addr` types, while `handle`
will always require explicit handling.
2020-01-12 14:49:35 -08:00
Kartik Agaram
0bcfe6e5cf 5880 2020-01-10 10:35:17 -08:00
Kartik Agaram
7e7a8a6eae 5876 - address -> addr 2020-01-03 01:36:34 -08:00
Kartik Agaram
46c947224f 5844
Let's start putting r32 first in compare instructions that need it. Ordering
there is quite subtle and of great import.
2019-12-30 01:21:00 -08:00
Kartik Agaram
2a2a5b1e43 5804
Try to make the comments consistent with the type system we'll eventually
have.
2019-12-08 23:31:05 -08:00
Kartik Agaram
686a52bd2e 5790
Standardize conventions for labels within objects in the data segment.

We're going to use this in a new tool.
2019-12-05 22:57:51 -08:00
Kartik Agaram
0fba3393a5 5715
Clean up pseudocode to match planned syntax for the type- and memory-safe
level-2 Mu language.

http://akkartik.name/post/mu-2019-2 is already out of date.
2019-10-26 23:42:27 -07:00
Kartik Agaram
f0b7e327c5 5714
Replace calculations of constants with labels.
2019-10-25 06:10:36 -07:00
Kartik Agaram
5409743432 5700 2019-10-17 21:59:51 -07:00
Kartik Agaram
7a5832204a 5698
Thanks Andrew Owen for reporting this typo.
2019-10-15 19:35:19 -07:00
Kartik Agaram
4ac2020fe8 5678 2019-09-19 23:40:53 -07:00
Kartik Agaram
fd91f7f61b 5675 - move helpers from subx-common into layers
This undoes 5672 in favor of a new plan:

Layers 000 - 099 are for running without syntax sugar. We use them for
building syntax-sugar passes.

Layers 100 and up are for running with all syntax sugar.

The layers are arranged in approximate order so more phases rely on earlier
layers than later ones.

I plan to not use intermediate syntax sugar (just sigils without calls,
or sigils and calls without braces) anywhere except in the specific passes
implementing them.
2019-09-19 23:25:49 -07:00
Kartik Agaram
20b71ee7f4 5664 2019-09-18 11:51:05 -07:00
Kartik Agaram
f39eaf81fa 5661 2019-09-15 00:29:52 -07:00
Kartik Agaram
57fa808b18 5637 2019-09-07 13:37:51 -07:00
Kartik Agaram
099f0d5d55 5631 - syntax for calls starting to work!
Now added to CI.
2019-09-06 17:58:53 -07:00
Kartik Agaram
e836615a60 5630 2019-09-06 16:17:51 -07:00
Kartik Agaram
f9973de3b1 5627 2019-09-06 14:47:39 -07:00
Kartik Agaram
77641c35d3 5626 2019-09-06 10:40:06 -07:00
Kartik Agaram
0221c6d3d3 5624
Fix a bug in call.subx's tokenizer.
2019-09-05 00:26:26 -07:00
Kartik Agaram
3449c5893c 5621
Done with calls.subx's variant of next-word.
2019-09-04 18:16:06 -07:00
Kartik Agaram
7a69dd4dc6 5620
Further flesh out next-word variant for calls.subx. All the code is
sketched out, and baseline tests pass. No tests yet for new
functionality compared to sigils.subx.
2019-09-04 17:47:38 -07:00
Kartik Agaram
904a053e9c 5613
Translating common bits from sigils.subx expression-aware variant of
next-word to use sigils in calls.subx.
2019-09-03 18:04:49 -07:00
Kartik Agaram
ae07bf353c 5612 2019-09-02 16:34:31 -07:00
Kartik Agaram
e8a1153af1 5611 2019-09-02 15:46:15 -07:00
Kartik Agaram
18bd3ef902 5607 - start of notation for function calls 2019-09-02 15:36:08 -07:00