引入了常量池优化,修改constvalue类并对IR生成修复,能够编译通过
This commit is contained in:
@@ -552,10 +552,10 @@ std::any SysYIRGenerator::visitNumber(SysYParser::NumberContext *ctx) {
|
||||
} else if (text.find("0") == 0) {
|
||||
base = 8;
|
||||
}
|
||||
res = ConstantValue::get((int)std::stol(text, 0, base));
|
||||
res = ConstantValue::get(Type::getIntType() ,(int)std::stol(text, 0, base));
|
||||
} else if (auto fLiteral = ctx->FLITERAL()) {
|
||||
const auto text = fLiteral->getText();
|
||||
res = ConstantValue::get((float)std::stof(text));
|
||||
res = ConstantValue::get(Type::getFloatType(), (float)std::stof(text));
|
||||
}
|
||||
cout << "number: ";
|
||||
res->print(cout);
|
||||
|
||||
Reference in New Issue
Block a user