Code Monkey home page Code Monkey logo

Comments (5)

apt1002 avatar apt1002 commented on May 29, 2024

If we are content always to assemble a SIB byte when accessing memory, the differences between R12 and other registers vanishes. This adds one byte of code per memory access. A good trade?

We would still need to special-case SP-relative and program-relative addressing.

from mijit.

rrthomas avatar rrthomas commented on May 29, 2024

Would it be too terrible just to emit the extra byte when R12 is used?

from mijit.

apt1002 avatar apt1002 commented on May 29, 2024

It wouldn't be terrible, no. It would be hidden in a black box, and it's probably less work than e.g. making separate methods for assembling R12-relative memory accesses. Maybe we should just do that.

Especially since we could do the same for SP-relative addressing. I recently realized that we're going to have to assemble instructions to add constants to SP; they could be unified too if SP is just another register. There are monsters in push RSP and push [RSP], and similarly for pop, but I suppose it's not my problem if callers engage those monsters.

By the way, we could save way more bytes by using 8-bit immediate constants where possible. I've been ignoring that optimization until now, so I should probably rethink what is and is not worth doing. Maybe I should just ignore R12 completely until the ambient ambition level rises.

from mijit.

apt1002 avatar apt1002 commented on May 29, 2024

Based on today's work, I've added multiplication, division and conditional moves to the list of requirements. Conditional moves are needed for maximum and minimum operations, and also for absolute value.

from mijit.

apt1002 avatar apt1002 commented on May 29, 2024

Closing in favour of #8, #9 and #10.

from mijit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.