llvm - How to insert a GlobalVariable at the end of the module? -


there's constructor seems match needs :

00055   /// globalvariable ctor - if parent module specified, global 00056   /// automatically inserted end of specified modules global list. 00057   globalvariable(type *ty, bool isconstant, linkagetypes linkage, 00058                  constant *initializer = nullptr, const twine &name = "", 00059                  threadlocalmode = notthreadlocal, unsigned addressspace = 0, 00060                  bool isexternallyinitialized = false); 

according documentation below, if parent module specified gv inserted @ end of it. how specifiy module ?

it looks comment wrong. can use this constructor, takes module& first parameter. can specify globalvariable new 1 inserted before, it's optional , without new global gets inserted @ end.

alternatively (going title of question), if have globalvariable, can call getgloballist on module , push_back global variable onto it.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -