Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Things that are hard about compiling to x86

Name: Anonymous 2015-07-30 0:16

It is really hard to compile arithmetic to x86 assembly because:

* (A) add x,y requires at least one of x,y to be a register.
* (B) mul x is predefined to use eax and edx registers.

These make it hard when you're trying to do register allocation because

* (A) What if you spilled x and now need to spill y? You cannot spill both
* (B) This messes with register coloring, you want to precolor the graph but the polytime algorithms (for chordal graphs, which SSA has) break if you precolor.

I'm really stuck, any advice welcome

Name: Anonymous 2015-07-30 0:22

* (A) add x,y requires at least one of x,y to be a register.
How is this a problem?

* (B) mul x is predefined to use eax and edx registers.
Multiplication in x86 is weird, x86 originally did not have mul and div.

Name: Anonymous 2015-07-30 3:50

Chordal graphs, more like choadal graphs.

Name: Anonymous 2015-07-30 3:55

kill x86

Name: Anonymous 2015-07-30 5:00

My advice is to use LLVM.

Name: Anonymous 2015-07-30 12:38

>>2
i explained how in part 2

Name: Cudder !cXCudderUE 2015-07-30 13:30

>>1
It's "really hard" because you're thinking about it in the wrong way.
add x,y requires at least one of x,y to be a register.
So what? Just arrange for either one to be in a register when that instruction is executed. This is not specific to x86 either. Would you also complain about MIPS or ARM, where all the operands of ALU instructions need to be in registers...?

This messes with register coloring, you want to precolor the graph
I've said this multiple times before, don't use graph colouring. It's a stupid algorithm for circlejerking academics that makes no intuitive sense. Basically everyone writing non-toy-compilers has moved on from it.

>>2
x86 originally did not have mul and div.
WRONG.

http://datasheets.chipdb.org/Intel/x86/808x/datashts/8086/231455-005.pdf :
8 and 16-bit Signed and Unsigned Arithmetic in Binary or Decimal Including Multiply and Divide
(emphasis mine)

Here's a hint: start at the result and work backwards. If you know you need a multiply or divide (or modulus), arrange for the input to that instruction to end up in edx:eax. Ditto for non-constant shifts (make sure output gets into cl).

Name: Anonymous 2015-07-30 13:39

>>7
fuck off retard

Name: Cudder !cXCudderUE 2015-07-30 14:40

>>8
NO U

Name: Anonymous 2015-07-30 15:48

Cudder is all talk and no action

Name: Anonymous 2015-07-30 18:56

>>10
dubs

Name: Anonymous 2015-07-30 21:15

I wish someone would help me

Name: Anonymous 2015-07-30 21:33

>>12
Woah deja vu

Name: Anonymous 2015-07-30 22:27

>>12
The all talk and no action guy helped you at >>7. You can start by replying to himer.

Name: Anonymous 2015-07-30 22:31

>>14
no they didn't. they just said some useless words that would sound smart to anyone who doesn't understand the problem

Name: Anonymous 2015-07-30 22:33

>>15
Reply to him directly.

Name: Anonymous 2015-07-31 0:10

>>16
Fuck off and die

Name: Anonymous 2015-07-31 12:10

>>17
I see you do not want help. It's okay, not all of us need help.

Name: Anonymous 2015-07-31 14:07

no one on prog can write a simple compiler to x86

Name: Anonymous 2015-07-31 15:44

>>19
Whom are you quoting?

Name: Anonymous 2015-07-31 16:25

>>20
and you think you are improving this board with that post... pathetic

Name: Anonymous 2015-07-31 16:33

>>21
dubs

Name: Anonymous 2015-07-31 16:47

>>21
and you think you are improving this board by bumping this thread... pathetic

Name: Anonymous 2015-07-31 17:34

>>21
How is quoting what hasn't been said improving the board more than his post?

Name: Anonymous 2015-07-31 18:47

>>19
Apparently you cannot.

Name: Anonymous 2015-07-31 22:10

>>25
Satire is the lowest form of comedy. Any idiot can make ironic comparisons, extended metaphors, and humorous allegories. It takes real intelligence to do observational comedy.

Name: Anonymous 2015-08-01 5:59

Monte carlo solves every problem. Just use monte carlo register assignment.

Name: Anonymous 2015-08-01 14:57

Neural networks solve every problem. Just use neural network register assignment.

Name: Cudder !cXCudderUE 2015-08-01 15:05

>>28
Also known as "the brain of the programmer".

Name: Anonymous 2015-08-01 16:33

Genetic algorithms solve every problem. Just use genetic algorithm register assignment.

>>29
No such thing exists.

Name: Anonymous 2015-08-01 17:09

>>26
Irony is the highest form of comedy.

Name: Anonymous 2015-08-01 19:37

>>33
Checking them is the highest form of posting.

Name: Anonymous 2015-08-01 20:36

dubs

Name: Anonymous 2015-08-02 15:49

>>31,32
highest
420blazeit

Name: Anonymous 2015-08-02 15:52

register allocation
Just use stack for everything. CPU pipeline optimizes it to use registers internally anyway. There's hardly any performance hit.

Name: Anonymous 2015-08-02 20:23

Just do >>35 >>1-kun. Just get something that works first. You can allocate everything on the stack and just used registers to load values for instructions.

Name: Anonymous 2015-08-02 22:54

FUGGEN STACKBOIS

LMAOING @ YOUR LIFE

Name: Anonymous 2015-08-03 6:34

>>37
It's stacks all the way down...

Name: Anonymous 2015-08-03 10:09

>>32-34
...How did this happen?

Name: Anonymous 2015-08-03 14:22

>>39
Yo-ho-ho he took a bite of gum-gum.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List