Skip to content

[WIP] ABI Lowering Library #140112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

[WIP] ABI Lowering Library #140112

wants to merge 6 commits into from

Conversation

vortex73
Copy link
Contributor

This PR details the implementation details of the proposed ABI lowering library.

  • Implementing a Shadow TypeSystem
  • Implement a bridge between Clang Qualtype to the shadow Typesystem
  • Integrate into Clang
  • Implement BPF ABIInfo
  • Implement SysV ABIInfo

TypeKind Kind;
uint64_t SizeInBits;
uint64_t AlignInBits;
bool IsExplicitlyAligned;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're probably going to need more than IsExplicitAligned, but we can deal with it when we get to it.

bool IsSigned;

public:
IntegerType(uint64_t BitWidth, uint64_t Align, bool Signed)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll have to distinguish __int128 and _BitInt(128) here, but we can deal with that when we get to it.

class VectorType : public Type {
private:
const Type *ElementType;
uint64_t NumElements;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably be ElementCount for scalable vector support.

StructPacking Pack = StructPacking::Default) {
FieldInfo *FieldArray = Allocator.Allocate<FieldInfo>(Fields.size());

for (size_t I = 0; I < Fields.size(); ++I) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Avoid braces for single line ifs.

Copy link

github-actions bot commented May 26, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing still missing here is handling for C++ structs with base classes.

@makslevental makslevental self-requested a review June 2, 2025 17:22
continue;

const RecordType *BaseRT = Base.getType()->getAs<RecordType>();
if (!BaseRT)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this can fail. Assert instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants