[LLVMdev] Building a new struct type, etc

Joel Stanley jstanley at cs.uiuc.edu
Tue Jan 28 12:19:01 PST 2003


Hi folks,

I was just wondering if someone would be willing to tell me the best way
to make a new structure type in LLVM and get it inserted as a valid type
into a particular Module instance?

I've done the following:

        vector<const Type*> types;
        types.push_back(Type::UIntTy);
        types.push_back(Type::UIntTy);
        structType = StructType::get(types);

But can't seem to find any member functions in Module that allow me to
introduce this as a new type...

Furthermore, how would I create a (preferably static) global instance of
the above structure type, together with a static initializer for it?

If there's some example code floating around somewhere for this, that'd
be sufficient; I simply couldn't find anything that did what I wanted.

Thanks in advance!

-j

-- 
Joel Stanley * jstanley at cs.uiuc.edu





More information about the llvm-dev mailing list