Giter Club home page Giter Club logo

Comments (2)

PragmaTwice avatar PragmaTwice commented on July 20, 2024

It seems that struct_element_addr has been renamed to get_member, but the issue still exists.

If no one has already started working on it, I will look into it soon : )

from clangir.

PragmaTwice avatar PragmaTwice commented on July 20, 2024

I have checked the issue and it appears challenging to handle when dealing with bitfields.

The bitfield information in cir.struct has already been erased, making it difficult to map each field type in cir.struct to the data member's name.

It seems to me that one possible way is to maintain data member types in cir.struct with bitfield information, and transform it to the current form when dumping LLVM IR, e.g.

// SOURCE CODE
struct A {
  int a;
  int b : 1;
  int c : 1;
};

// AS IS:
!ty_22A22 = !cir.struct<struct "A" {!cir.int<s, 32>, !cir.int<u, 8>}

// TO BE: (not real CIR code)
!ty_22A22 = !cir.struct<struct "A" {!cir.int<s, 32> a, !cir.int<s, 32> BITFIELD(1) b, !cir.int<s, 32> BITFIELD(1) c}

But in this way, the handling of memory location / memory layout in CIR will be a bit tricky.

Another way might be to keep the current approach and put the data member name in cir.get_member.

Any suggestions for this? 🤔 cc @bcardosolopes @sitio-couto

from clangir.

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.