我正在使用LLVM IR编写程序,尝试初始化一个包含“Hello World!”的字符串,但我无法弄清楚如何实现。代码的目标是计算字符串中字符的数量。在字符串需要被初始化之前,在头文件之后,我有以下代码:
int main (int argc, const char *argv[]) {
//Setting up
//Build a pointer to the string - LLVMValueRef *strptr=LLVMBuildGlobalStringPtr(builder, const char *string, const char *name);
LLVMValueRef *strptr;
LLVMContextRef context = LLVMContextCreate();
LLVMBuilderRef builder = LLVMCreateBuilderInContext (context);
LLVMModuleRef module1 = LLVMModuleCreateWithNameInContext("mod", context);
}
char *
是内容(这里是Hello World
),第二个则类似于变量名。 - JDS