llvm(phis): 静的Box self 先頭規約を phi に段階導入し、自己検証スモークを追加\n\n- lang/src/llvm_ir/instructions/phi.hako: lower_* 群に self を追加(呼び出し側はインスタンス経由で互換)\n- smokes: quick/core/phi/self_param_phi_vm.sh で JSON 生成を確認
This commit is contained in:
@ -19,7 +19,7 @@ static box LLVMPhiInstructionBox {
|
||||
// Returns:
|
||||
// JSON文字列: {"op":"phi","dst":5,"incoming":[...]}
|
||||
//
|
||||
lower_phi(dst, incoming_list) {
|
||||
lower_phi(self, dst, incoming_list) {
|
||||
// 空チェック: incoming が空の場合は 0 定数を返す
|
||||
// Python: phi.py 34-37行の動作と同じ
|
||||
if incoming_list == null {
|
||||
@ -41,7 +41,7 @@ static box LLVMPhiInstructionBox {
|
||||
|
||||
// 空のPHI: 0定数にフォールバック
|
||||
// Python: phi.py 34-37行
|
||||
_phi_empty_fallback(dst) {
|
||||
_phi_empty_fallback(self, dst) {
|
||||
// No incoming edges - use zero constant
|
||||
return "{\"op\":\"const\",\"dst\":" + dst + ",\"value\":{\"type\":\"i64\",\"value\":0}}"
|
||||
}
|
||||
@ -54,7 +54,7 @@ static box LLVMPhiInstructionBox {
|
||||
// Returns:
|
||||
// JSON配列文字列: [{"value":1,"block":1},{"value":2,"block":2}]
|
||||
//
|
||||
_build_incoming_array(incoming_list) {
|
||||
_build_incoming_array(self, incoming_list) {
|
||||
local result = "["
|
||||
local first = 1
|
||||
|
||||
@ -86,8 +86,8 @@ static box LLVMPhiInstructionBox {
|
||||
}
|
||||
|
||||
// デバッグ用 - 生成された命令の確認
|
||||
debug_phi(dst, incoming_list) {
|
||||
local json = me.lower_phi(dst, incoming_list)
|
||||
debug_phi(self, dst, incoming_list) {
|
||||
local json = me.lower_phi(self, dst, incoming_list)
|
||||
print("Generated PHI instruction: " + json)
|
||||
return json
|
||||
}
|
||||
@ -95,33 +95,33 @@ static box LLVMPhiInstructionBox {
|
||||
// Stage 2 プレースホルダー: Block End Values管理(将来実装)
|
||||
// Python: phi.py 69-79行の block_end_values スナップショット処理
|
||||
// 注: Hakorune版では不要(C++バックエンドが処理)
|
||||
lower_phi_with_snapshot(dst, incoming_list, block_end_values) {
|
||||
lower_phi_with_snapshot(self, dst, incoming_list, block_end_values) {
|
||||
// 現時点では基本版と同じ動作
|
||||
return me.lower_phi(dst, incoming_list)
|
||||
return me.lower_phi(self, incoming_list)
|
||||
}
|
||||
|
||||
// Stage 3 プレースホルダー: 型変換処理(将来実装)
|
||||
// Python: phi.py 84-103行の型変換処理
|
||||
// 注: Hakorune版では不要(C++バックエンドが処理)
|
||||
lower_phi_with_type_info(dst, incoming_list, type_info) {
|
||||
lower_phi_with_type_info(self, dst, incoming_list, type_info) {
|
||||
// 現時点では基本版と同じ動作
|
||||
return me.lower_phi(dst, incoming_list)
|
||||
return me.lower_phi(self, incoming_list)
|
||||
}
|
||||
|
||||
// Stage 4 プレースホルダー: Strict Mode(将来実装)
|
||||
// Python: phi.py 118-121行の NYASH_LLVM_PHI_STRICT チェック
|
||||
// 注: C++バックエンドで実装予定
|
||||
lower_phi_strict(dst, incoming_list, strict_mode) {
|
||||
lower_phi_strict(self, dst, incoming_list, strict_mode) {
|
||||
// 現時点では基本版と同じ動作
|
||||
return me.lower_phi(dst, incoming_list)
|
||||
return me.lower_phi(self, incoming_list)
|
||||
}
|
||||
|
||||
// Stage 5 プレースホルダー: 文字列性伝播(将来実装)
|
||||
// Python: phi.py 131-142行の resolver.is_stringish() 処理
|
||||
// 注: C++バックエンドで実装予定
|
||||
lower_phi_with_string_propagation(dst, incoming_list, resolver) {
|
||||
lower_phi_with_string_propagation(self, dst, incoming_list, resolver) {
|
||||
// 現時点では基本版と同じ動作
|
||||
return me.lower_phi(dst, incoming_list)
|
||||
return me.lower_phi(self, incoming_list)
|
||||
}
|
||||
|
||||
// ヘルパー: incoming要素の検証(デバッグ用)
|
||||
|
||||
Reference in New Issue
Block a user