删除调试信息输出
This commit is contained in:
60
src/IR.cpp
60
src/IR.cpp
@@ -135,7 +135,7 @@ auto Function::getCalleesWithNoExternalAndSelf() -> std::set<Function *> {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// 函数克隆,后续函数级优化(内联等)需要用到
|
||||
Function * Function::clone(const std::string &suffix) const {
|
||||
std::stringstream ss;
|
||||
std::map<BasicBlock *, BasicBlock *> oldNewBlockMap;
|
||||
@@ -527,11 +527,7 @@ Function * Function::clone(const std::string &suffix) const {
|
||||
return newFunction;
|
||||
}
|
||||
/**
|
||||
* @brief 设置操作数
|
||||
*
|
||||
* @param [in] index 所要设置的操作数的位置
|
||||
* @param [in] value 所要设置成的value
|
||||
* @return 无返回值
|
||||
* 设置操作数
|
||||
*/
|
||||
void User::setOperand(unsigned index, Value *value) {
|
||||
assert(index < getNumOperands());
|
||||
@@ -539,11 +535,7 @@ void User::setOperand(unsigned index, Value *value) {
|
||||
value->addUse(operands[index]);
|
||||
}
|
||||
/**
|
||||
* @brief 替换操作数
|
||||
*
|
||||
* @param [in] index 所要替换的操作数的位置
|
||||
* @param [in] value 所要替换成的value
|
||||
* @return 无返回值
|
||||
* 替换操作数
|
||||
*/
|
||||
void User::replaceOperand(unsigned index, Value *value) {
|
||||
assert(index < getNumOperands());
|
||||
@@ -561,17 +553,12 @@ CallInst::CallInst(Function *callee, const std::vector<Value *> &args, BasicBloc
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @brief 获取被调用函数的指针
|
||||
*
|
||||
* @return 被调用函数的指针
|
||||
* 获取被调用函数的指针
|
||||
*/
|
||||
Function * CallInst::getCallee() const { return dynamic_cast<Function *>(getOperand(0)); }
|
||||
|
||||
/**
|
||||
* @brief 获取变量指针
|
||||
*
|
||||
* @param [in] name 变量名字
|
||||
* @return 变量指针
|
||||
* 获取变量指针
|
||||
*/
|
||||
auto SymbolTable::getVariable(const std::string &name) const -> User * {
|
||||
auto node = curNode;
|
||||
@@ -586,11 +573,7 @@ auto SymbolTable::getVariable(const std::string &name) const -> User * {
|
||||
return nullptr;
|
||||
}
|
||||
/**
|
||||
* @brief 添加变量
|
||||
*
|
||||
* @param [in] name 变量名字
|
||||
* @param [in] variable 变量指针
|
||||
* @return 变量指针
|
||||
* 添加变量到符号表
|
||||
*/
|
||||
auto SymbolTable::addVariable(const std::string &name, User *variable) -> User * {
|
||||
User *result = nullptr;
|
||||
@@ -621,21 +604,15 @@ auto SymbolTable::addVariable(const std::string &name, User *variable) -> User *
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* @brief 获取全局变量
|
||||
*
|
||||
* @return 全局变量列表
|
||||
* 获取全局变量
|
||||
*/
|
||||
auto SymbolTable::getGlobals() -> std::vector<std::unique_ptr<GlobalValue>> & { return globals; }
|
||||
/**
|
||||
* @brief 获取常量
|
||||
*
|
||||
* @return 常量列表
|
||||
* 获取常量
|
||||
*/
|
||||
auto SymbolTable::getConsts() const -> const std::vector<std::unique_ptr<ConstantVariable>> & { return consts; }
|
||||
/**
|
||||
* @brief 进入新的作用域
|
||||
*
|
||||
* @return 无返回值
|
||||
* 进入新的作用域
|
||||
*/
|
||||
void SymbolTable::enterNewScope() {
|
||||
auto newNode = new SymbolTableNode;
|
||||
@@ -647,31 +624,20 @@ void SymbolTable::enterNewScope() {
|
||||
curNode = newNode;
|
||||
}
|
||||
/**
|
||||
* @brief 进入全局作用域
|
||||
*
|
||||
* @return 无返回值
|
||||
* 进入全局作用域
|
||||
*/
|
||||
void SymbolTable::enterGlobalScope() { curNode = nodeList.front().get(); }
|
||||
/**
|
||||
* @brief 离开作用域
|
||||
*
|
||||
* @return 无返回值
|
||||
* 离开作用域
|
||||
*/
|
||||
void SymbolTable::leaveScope() { curNode = curNode->pNode; }
|
||||
/**
|
||||
* @brief 是否位于全局作用域
|
||||
*
|
||||
* @return 布尔值
|
||||
* 是否位于全局作用域
|
||||
*/
|
||||
auto SymbolTable::isInGlobalScope() const -> bool { return curNode->pNode == nullptr; }
|
||||
|
||||
/**
|
||||
* @brief 移动指令
|
||||
*
|
||||
* @param [in] sourcePos 源指令列表位置
|
||||
* @param [in] targetPos 目的指令列表位置
|
||||
* @param [in] block 目标基本块
|
||||
* @return 无返回值
|
||||
*移动指令
|
||||
*/
|
||||
auto BasicBlock::moveInst(iterator sourcePos, iterator targetPos, BasicBlock *block) -> iterator {
|
||||
auto inst = sourcePos->release();
|
||||
|
||||
Reference in New Issue
Block a user