From 451deb78a75d488e7fc27d0d2510bfb0fc4e2eb2 Mon Sep 17 00:00:00 2001 From: Yingchi Long Date: Thu, 20 Jun 2024 16:40:02 +0800 Subject: [PATCH] llvm-parser: init --- src/llvm-parser.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/llvm-parser.ts diff --git a/src/llvm-parser.ts b/src/llvm-parser.ts new file mode 100644 index 0000000..8683144 --- /dev/null +++ b/src/llvm-parser.ts @@ -0,0 +1,15 @@ +export function functionList(module: string) { + let result: string[] = []; + + // Split the LLVM module string by lines + const lines = module.split('\n'); + + lines.forEach(line => { + if (line.startsWith('define')) { + let begin = line.indexOf('@'); + let end = line.indexOf('('); + result.push(line.substring(begin + 1, end).trim()); + } + }); + return result; +}