I've begun writing the interface layer to Cecil for my CIL optimizer, and I have some questions on using Cecil that I have not been able to find an answer to on my own. Any help would be appreciated.
0. I assume Cecil is sufficiently related to Mono for questions about it to be on-topic on this list, especially as I don't see any Cecil-specific mailing list. Am I correct? (if not: sorry! :-) ) 1. I'm using ildasm and the largely uncommented Cecil source as documentation. Is there some actual documentation other than the FAQ? 2. I need to know the types of the things on the stack. Can Cecil help with that? If not, is there some nice way to get .NET to handle the operations on the type lattice? 3. When emitting a Br (branch) instruction, Cecil insists on getting the target instruction immediately. The trouble is that when I am writing out CIL to Cecil from the CIL representation internal to my program, it is often the case that the target of the branch has not been emitted yet. Currently I get around this by passing it a dummy Nop instruction and then correcting the target in a second pass. Is there some way to avoid constructing a dummy instruction, such as by getting Cecil to accept a null as the (preliminary) target? (When I try to do that the obvious way I get an exception) 4. Cecil requires that the type of a local variable be specified as a TypeReference, so I need to get those. Is there some way to get a TypeReference for built in types like System.Int32 without loading an assembly? The way I am doing it now is getting it as assembly.MainModule.TypeReferences["System.Int32"]. 5. I would like to emit the short form of the Br instruction when this is possible. My initial idea is to always emit the short form, and then expand to the long form where necessary. That makes it necessary to take into account the possibility of a cascade where expanding one instruction increases the distance to the target of another Br instruction which then also needs to be expanded to the long form and so on. I would like to avoid this trouble, so is there some way to get Cecil to do this for me? /Bjarke Roune _______________________________________________ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list