I am going around in circles through the LLVM / Stack documentation and cannot understand how a global integer variable should be initialized to 0 (first time using LLVM). This is currently part of my code:
TheModule = (argc > 1) ? new Module(argv[1], Context) : new Module("Filename", Context);
This is almost what I want, an example of the output that it can produce:
@a = common global i32, align 4 @b = common global i32, align 4 @c = common global i32, align 4
However, clang foo.c -S -emit-llvm produces this, which I also want:
@a = common global i32 0, align 4 @b = common global i32 0, align 4 @c = common global i32 0, align 4
As far as I can tell, I need a Constant* where I have "???" but I'm not sure how to do this: http://llvm.org/docs/doxygen/html/classllvm_1_1GlobalVariable.html#a095f8f031d99ce3c0b25478713293dea
source share