Page MenuHomePhabricator

Non-8-bit addressable units showcase
Needs ReviewPublic

Authored by JesperAntonsson on May 9 2019, 5:12 AM.
This revision needs review, but there are no reviewers specified.



This is a twin patch to D61432, using the "addressable units" terminology instead of "byte".

It's meant to be an addition to llvm-dev discussion "RFC: On removing magic numbers assuming 8-bit bytes", just to show one way it could look when using "addressable unit" terminology.

Diff Detail

Event Timeline

JesperAntonsson created this revision.May 9 2019, 5:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 9 2019, 5:12 AM

Dear Jesper,

I am working on an architecture where the minimal addressable unit size is 64 bit. So far everything worked fine until I started testing strings(i8-layout) and pointer to char and short, were I ran into serious problems with the 8-bit/Byte alignment philosophy of LLVM. After research with Dr. Google I found a solution from Embecosm and your approach and decided to follow this solution.

My question is:

How do you deal with the Int8PtrTy, AllocaInt8PtrTy and getInt8PtrTy, which are all over llvm and clang.

Int8PtrTy = Int8Ty->getPointerTo(0);
Int8PtrPtrTy = Int8PtrTy->getPointerTo(0);
AllocaInt8PtrTy = Int8Ty->getPointerTo(


ResumeFnType(FunctionType::get(Type::getVoidTy(Context), Int8Ptr,
NullPtr(ConstantPointerNull::get(Int8Ptr)) {}


/// void* in address space 0
union {
  llvm::PointerType *VoidPtrTy;
  llvm::PointerType *Int8PtrTy;

I would appreciate your help (