tinysnail 3 years ago
commit 3deb33ed04

@ -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.llcpp
|      └── go_upstairs_gen.cpp <- go_upstairs.llcpp
└── task3
└── test
├── test.py <- PW6
├── test.py <-
└── test <-
```

@ -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);

@ -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<GlobalVariable *>(v))
{
op_ir += "@"+v->get_name();
}
else if ( dynamic_cast<Function *>(v) )
{
op_ir += "@"+v->get_name();
}
else if ( dynamic_cast<Constant *>(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";
}
Loading…
Cancel
Save