diff --git a/README.md b/README.md index f1f3d73..9c7f9e0 100644 --- a/README.md +++ b/README.md @@ -25,17 +25,17 @@ ``` log . ├── CMakeLists.txt -├── README.md <- PW6实验文档说明(你在这里) +├── README.md <- 实验文档说明(你在这里) ├── doc │   ├── AST.md │   ├── phase1.md <- 各阶段文档 │   ├── phase2.md │   ├── phase3.md │   ├── SysYF语言定义.pdf -| └── SysYFIR.md <- SysYF IR 相关文档 +| └── SysYFIR.md <- SysYF IR 应用编程接口相关文档 ├── report -│   ├── report.md <- PW6所需提交的实验报告 -│   └── contribution.md <- PW6所需提交的组员贡献(队长负责填写) +│   ├── report.md <- 需提交的实验报告 +│   └── contribution.md <- 需提交的组员贡献(队长负责填写) ├── include <- 实验所需的头文件 │   ├── ... │   └── SysYFIR @@ -44,11 +44,11 @@ │   ├── SysYFIR │   └── SysYFIRBuilder | ├── CMakeLists.txt -| └── IRBuilder.cpp <- 第三部分你需要修改的文件 +| └── IRBuilder.cpp <- 你需要在第三关任务中修改的文件 └── Student ├── CMakeLists.txt - ├── task1 - | ├── ll <- PW6所需提交的.ll目录(第一部分) + ├── task1 <- 第一关任务相关的目录 + | ├── ll <- 需提交的LLVM IR文件(.ll)的目录(第一关) | | ├── assign_hand.ll |   │   ├── fun_hand.ll |   │   ├── if_hand.ll @@ -60,8 +60,8 @@ |   │   └── while_test.sy | └── demo |      └── go_upstairs.c - ├── task2 - | ├── cpp <- PW6所需提交的.cpp目录(第二部分) + ├── task2 <- 第二关任务相关的目录 + | ├── cpp <- 需提交的.cpp目录(第二关) | | ├── CMakeLists.txt | | ├── assign_gen.cpp |   │   ├── fun_gen.cpp @@ -75,10 +75,10 @@ | └── demo |      |── CMakeLists.txt |      |── go_upstairs.sy - |      └── go_upstairs_gen.cpp <- 助教提供的打印go_upstairs.ll的cpp + |      └── go_upstairs_gen.cpp <- 打印go_upstairs.ll的cpp文件 └── task3 └── test - ├── test.py <- PW6第三部分评测脚本 + ├── test.py <- 第三关任务的评测脚本 └── test <- 测试样例文件夹 ``` diff --git a/include/SysYFIR/IRprinter.h b/include/SysYFIR/IRprinter.h deleted file mode 100644 index 1f7b082..0000000 --- a/include/SysYFIR/IRprinter.h +++ /dev/null @@ -1,13 +0,0 @@ -#include "Value.h" -#include "Module.h" -#include "Function.h" -#include "GlobalVariable.h" -#include "Constant.h" -#include "BasicBlock.h" -#include "Instruction.h" -#include "User.h" -#include "Type.h" - -std::string print_as_op( Value *v, bool print_ty ); -std::string print_cmp_type( CmpInst::CmpOp op); -std::string print_fcmp_type( FCmpInst::CmpOp op); \ No newline at end of file diff --git a/src/SysYFIR/IRprinter.cpp b/src/SysYFIR/IRprinter.cpp deleted file mode 100644 index b2a6b1e..0000000 --- a/src/SysYFIR/IRprinter.cpp +++ /dev/null @@ -1,86 +0,0 @@ -#include "IRPrinter.h" - -std::string print_as_op( Value *v, bool print_ty ) -{ - std::string op_ir; - if( print_ty ) - { - op_ir += v->get_type()->print(); - op_ir += " "; - } - - if (dynamic_cast(v)) - { - op_ir += "@"+v->get_name(); - } - else if ( dynamic_cast(v) ) - { - op_ir += "@"+v->get_name(); - } - else if ( dynamic_cast(v)) - { - op_ir += v->print(); - } - else - { - op_ir += "%"+v->get_name(); - } - - return op_ir; -} - -std::string print_cmp_type( CmpInst::CmpOp op ) -{ - switch (op) - { - case CmpInst::GE: - return "sge"; - break; - case CmpInst::GT: - return "sgt"; - break; - case CmpInst::LE: - return "sle"; - break; - case CmpInst::LT: - return "slt"; - break; - case CmpInst::EQ: - return "eq"; - break; - case CmpInst::NE: - return "ne"; - break; - default: - break; - } - return "wrong cmpop"; -} - -std::string print_fcmp_type( FCmpInst::CmpOp op ) -{ - switch (op) - { - case FCmpInst::GE: - return "uge"; - break; - case FCmpInst::GT: - return "ugt"; - break; - case FCmpInst::LE: - return "ule"; - break; - case FCmpInst::LT: - return "ult"; - break; - case FCmpInst::EQ: - return "ueq"; - break; - case FCmpInst::NE: - return "une"; - break; - default: - break; - } - return "wrong fcmpop"; -}