refactor(irgen): IR改成alloca和store形式
This commit is contained in:
@@ -28,6 +28,13 @@ const std::shared_ptr<Type>& Context::Int32() {
|
||||
return int32_;
|
||||
}
|
||||
|
||||
const std::shared_ptr<Type>& Context::PtrInt32() {
|
||||
if (!ptr_i32_) {
|
||||
ptr_i32_ = std::make_shared<Type>(Type::Kind::PtrInt32);
|
||||
}
|
||||
return ptr_i32_;
|
||||
}
|
||||
|
||||
ConstantInt* Context::GetConstInt(int v) {
|
||||
auto it = const_ints_.find(v);
|
||||
if (it != const_ints_.end()) return it->second.get();
|
||||
@@ -38,7 +45,7 @@ ConstantInt* Context::GetConstInt(int v) {
|
||||
|
||||
std::string Context::NextTemp() {
|
||||
std::ostringstream oss;
|
||||
oss << "%t" << temp_index_++;
|
||||
oss << "%" << ++temp_index_;
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user