LLVMDisposeModule(M);
}
-int calc(void) {
+int llvm_calc(void) {
- tokenize_stdin(handle_line);
+ llvm_tokenize_stdin(handle_line);
return 0;
}
do_disassemble(triple, features, disbuf, disbuflen);
}
-int disassemble(void) {
+int llvm_disassemble(void) {
LLVMInitializeAllTargetInfos();
LLVMInitializeAllTargetMCs();
LLVMInitializeAllDisassemblers();
- tokenize_stdin(handle_line);
+ llvm_tokenize_stdin(handle_line);
return 0;
}
}
}
-int echo(void) {
+int llvm_echo(void) {
LLVMEnablePrettyStackTrace();
- LLVMModuleRef Src = load_module(false, true);
+ LLVMModuleRef Src = llvm_load_module(false, true);
LLVMContextRef Ctx = LLVMContextCreate();
LLVMModuleRef Dst = LLVMModuleCreateWithNameInContext("<stdin>", Ctx);
#define MAX_TOKENS 512
#define MAX_LINE_LEN 1024
-void tokenize_stdin(void (*cb)(char **tokens, int ntokens)) {
+void llvm_tokenize_stdin(void (*cb)(char **tokens, int ntokens)) {
char line[MAX_LINE_LEN];
char *tokbuf[MAX_TOKENS];
#endif
// helpers.c
-void tokenize_stdin(void (*cb)(char **tokens, int ntokens));
+void llvm_tokenize_stdin(void (*cb)(char **tokens, int ntokens));
// module.c
-LLVMModuleRef load_module(bool Lazy, bool New);
-int module_dump(bool Lazy, bool New);
-int module_list_functions(void);
-int module_list_globals(void);
+LLVMModuleRef llvm_load_module(bool Lazy, bool New);
+int llvm_module_dump(bool Lazy, bool New);
+int llvm_module_list_functions(void);
+int llvm_module_list_globals(void);
// calc.c
-int calc(void);
+int llvm_calc(void);
// disassemble.c
-int disassemble(void);
+int llvm_disassemble(void);
// metadata.c
-int add_named_metadata_operand(void);
-int set_metadata(void);
+int llvm_add_named_metadata_operand(void);
+int llvm_set_metadata(void);
// object.c
-int object_list_sections(void);
-int object_list_symbols(void);
+int llvm_object_list_sections(void);
+int llvm_object_list_symbols(void);
// targets.c
-int targets_list(void);
+int llvm_targets_list(void);
// echo.c
-int echo(void);
+int llvm_echo(void);
#ifdef __cplusplus
}
LLVMInitializeCore(pr);
if (argc == 2 && !strcmp(argv[1], "--lazy-new-module-dump")) {
- return module_dump(true, true);
+ return llvm_module_dump(true, true);
} else if (argc == 2 && !strcmp(argv[1], "--new-module-dump")) {
- return module_dump(false, true);
+ return llvm_module_dump(false, true);
} else if (argc == 2 && !strcmp(argv[1], "--lazy-module-dump")) {
- return module_dump(true, false);
+ return llvm_module_dump(true, false);
} else if (argc == 2 && !strcmp(argv[1], "--module-dump")) {
- return module_dump(false, false);
+ return llvm_module_dump(false, false);
} else if (argc == 2 && !strcmp(argv[1], "--module-list-functions")) {
- return module_list_functions();
+ return llvm_module_list_functions();
} else if (argc == 2 && !strcmp(argv[1], "--module-list-globals")) {
- return module_list_globals();
+ return llvm_module_list_globals();
} else if (argc == 2 && !strcmp(argv[1], "--targets-list")) {
- return targets_list();
+ return llvm_targets_list();
} else if (argc == 2 && !strcmp(argv[1], "--object-list-sections")) {
- return object_list_sections();
+ return llvm_object_list_sections();
} else if (argc == 2 && !strcmp(argv[1], "--object-list-symbols")) {
- return object_list_symbols();
+ return llvm_object_list_symbols();
} else if (argc == 2 && !strcmp(argv[1], "--disassemble")) {
- return disassemble();
+ return llvm_disassemble();
} else if (argc == 2 && !strcmp(argv[1], "--calc")) {
- return calc();
+ return llvm_calc();
} else if (argc == 2 && !strcmp(argv[1], "--add-named-metadata-operand")) {
- return add_named_metadata_operand();
+ return llvm_add_named_metadata_operand();
} else if (argc == 2 && !strcmp(argv[1], "--set-metadata")) {
- return set_metadata();
+ return llvm_set_metadata();
} else if (argc == 2 && !strcmp(argv[1], "--echo")) {
- return echo();
+ return llvm_echo();
} else {
print_usage();
}
#include "llvm-c-test.h"
-int add_named_metadata_operand(void) {
+int llvm_add_named_metadata_operand(void) {
LLVMModuleRef m = LLVMModuleCreateWithName("Mod");
LLVMValueRef values[] = { LLVMConstInt(LLVMInt32Type(), 0, 0) };
return 0;
}
-int set_metadata(void) {
+int llvm_set_metadata(void) {
LLVMBuilderRef b = LLVMCreateBuilder();
LLVMValueRef values[] = { LLVMConstInt(LLVMInt32Type(), 0, 0) };
exit(1);
}
-LLVMModuleRef load_module(bool Lazy, bool New) {
+LLVMModuleRef llvm_load_module(bool Lazy, bool New) {
LLVMMemoryBufferRef MB;
LLVMModuleRef M;
char *msg = NULL;
return M;
}
-int module_dump(bool Lazy, bool New) {
- LLVMModuleRef M = load_module(Lazy, New);
+int llvm_module_dump(bool Lazy, bool New) {
+ LLVMModuleRef M = llvm_load_module(Lazy, New);
char *irstr = LLVMPrintModuleToString(M);
puts(irstr);
return 0;
}
-int module_list_functions(void) {
- LLVMModuleRef M = load_module(false, false);
+int llvm_module_list_functions(void) {
+ LLVMModuleRef M = llvm_load_module(false, false);
LLVMValueRef f;
f = LLVMGetFirstFunction(M);
return 0;
}
-int module_list_globals(void) {
- LLVMModuleRef M = load_module(false, false);
+int llvm_module_list_globals(void) {
+ LLVMModuleRef M = llvm_load_module(false, false);
LLVMValueRef g;
g = LLVMGetFirstGlobal(M);
#include <stdio.h>
#include <stdlib.h>
-int object_list_sections(void) {
+int llvm_object_list_sections(void) {
LLVMMemoryBufferRef MB;
LLVMObjectFileRef O;
LLVMSectionIteratorRef sect;
return 0;
}
-int object_list_symbols(void) {
+int llvm_object_list_symbols(void) {
LLVMMemoryBufferRef MB;
LLVMObjectFileRef O;
LLVMSectionIteratorRef sect;
#include "llvm-c/TargetMachine.h"
#include <stdio.h>
-int targets_list(void) {
+int llvm_targets_list(void) {
LLVMTargetRef t;
LLVMInitializeAllTargetInfos();
LLVMInitializeAllTargets();