[LLVMdev] Adding integer field to all C++ classes in LLVM

Mohit Mishra mmishra23 at gmail.com
Thu Jul 16 14:37:03 PDT 2015


HI Mats,

Thanks for getting back to me.


I take it you mean that you want to add a field to all classes COMPILED  by
> LLVM, and not all classes that LLVM consists of?
>
YES!

>
> Also, unless I'm terribly misinformed, adding something to an ArrayRef is
> not going to work. ArrayRef, StringRef and such are "references to the
> original data in the calling code", which means you have no right to modify
> it.
>

 What I want is to be able to randomize object layout; and hence adding of
integer fields to the classes might be a good option. While I did think so
about ArrayRef, I thought about to substitute that with vector something
like this:
vector<Type*> vecType = Elements.vec ();
vecType.insert (Type::getInt32Ty (Context))
ST->setBody(vecType, isPacked);

and modify the setBody function parameters replacing ArrayRef with the
vector. However, I'm still skeptical about this.

What do you propose to have a  fairly good object layout randomization?

Best,
Mohit.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150717/0ca5b930/attachment.html>


More information about the llvm-dev mailing list