// SSA 值体系抽象: // - 常量、参数、指令结果等统一为 Value // - 提供类型信息与使用/被使用关系(按需要实现) #include "ir/IR.h" namespace ir { Value::Value(std::shared_ptr ty, std::string name) : type_(std::move(ty)), name_(std::move(name)) {} const std::shared_ptr& Value::GetType() const { return type_; } const std::string& Value::GetName() const { return name_; } void Value::SetName(std::string n) { name_ = std::move(n); } void Value::AddUser(Instruction* user) { users_.push_back(user); } const std::vector& Value::GetUsers() const { return users_; } ConstantInt::ConstantInt(std::shared_ptr ty, int v) : Value(std::move(ty), ""), value_(v) {} } // namespace ir