Ai
1 Star 0 Fork 0

fuoct/BUAA-Compiler-2023

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
run_llvm_ir.sh 860 Bytes
一键复制 编辑 原始数据 按行查看 历史
wokron 提交于 2023-10-31 22:14 +08:00 . chore: simple run script for llvm ir
TARGET_FILE=$1
echo "target file: ${TARGET_FILE}"
mkdir ./tmp
cat > ./tmp/libsysy.c << EOF
#include<stdio.h>
#include<stdarg.h>
#include<sys/time.h>
/* Input & output functions */
int getint(),getch(),getarray(int a[]);
void putint(int a),putch(int a),putarray(int n,int a[]);
/* Input & output functions */
int getint(){int t; scanf("%d",&t); return t; }
int getch(){char c; scanf("%c",&c); return (int)c; }
int getarray(int a[]){
int n;
scanf("%d",&n);
for(int i=0;i<n;i++)scanf("%d",&a[i]);
return n;
}
void putint(int a){ printf("%d",a);}
void putch(int a){ printf("%c",a); }
void putarray(int n,int a[]){
printf("%d:",n);
for(int i=0;i<n;i++)printf(" %d",a[i]);
printf("\n");
}
EOF
clang -emit-llvm -S ./tmp/libsysy.c -o ./tmp/lib.ll
llvm-link $TARGET_FILE ./tmp/lib.ll -S -o ./tmp/out.ll
lli ./tmp/out.ll
rm ./tmp -r
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fuoct/BUAA-Compiler-2023.git
git@gitee.com:fuoct/BUAA-Compiler-2023.git
fuoct
BUAA-Compiler-2023
BUAA-Compiler-2023
master

搜索帮助