Code Monkey home page Code Monkey logo

Comments (6)

vnmakarov avatar vnmakarov commented on July 21, 2024

I am agree. If people want to start use c2mir compiler as interface language to their JITs, we need to provide it as library, remove global state, and improve error processing.

I am only going to provide this as a separate layer. I think in some cases, people will want only MIR layer because of faster compilation and smaller size.

This work will also require decoupling c2mir driver and defining what options should be used by driver and library itself. I don't know when it will be done (right now I am busy with another project until April) but I hope it will be done before the year end.

from mir.

vnmakarov avatar vnmakarov commented on July 21, 2024

I removed the global state from C2MIR and added error processing to remove all allocated memory in case of compilation errors. I also separated C2MIR driver to use C2MIR as a separate program.

So I am moving to the direction to make C2MIR a library. Probably the current interface (c2mir.h) is not final and it will change but not radically.

Removing the global state slows down the compiler by 10%. So I am going to work to decrease this compilation speed degradation.

from mir.

dibyendumajumdar avatar dibyendumajumdar commented on July 21, 2024

wow, amazing!

from mir.

dibyendumajumdar avatar dibyendumajumdar commented on July 21, 2024

Thanks a lot for looking at this so soon. Really appreciated.

I have a few questions:

  1. What is the purpose of module_num?
  2. I presume each call to c2mir_compile() results in a single module?
  3. How can we get hold of the module just compiled?

Thank you

from mir.

vnmakarov avatar vnmakarov commented on July 21, 2024

Thanks a lot for looking at this so soon. Really appreciated.

I have a few questions:

1. What is the purpose of module_num?

Module has a name M<number>, where <number> is value of module_num

2. I presume each call to c2mir_compile() results in a single module?

Yes, it translates what could be considered one C file and generate one MIR module.

3. How can we get hold of the module just compiled?

It is the last module in the context module list. To reach it you can use DLIST_TAIL (MIR_module_t, *MIR_get_module_list (ctx)). If unique numbers are used for modules, you could find them by the name in the module list.

The current interface is just first version of separation of compiler itself and the driver. If you have questions about c2mir compiler interface, c2mir-driver.c would be the first place to look at.

from mir.

dibyendumajumdar avatar dibyendumajumdar commented on July 21, 2024

Closing as library api now available

from mir.

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.