[HW8] Usage of type hints #550
Unanswered
pingpingy1
asked this question in
Q&A
Replies: 1 comment 1 reply
-
|
주어진 LLVM IR에 담긴 정보는 자유롭게 활용하시면 됩니다. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
이름 Your Name
이희원 / Heewon Lee
질문 Question
안녕하세요.
과제8의 타입 검사기 구현에서 LLVM IR 코드에 작성된 타입 힌트를 어느 수준까지 사용해야 하는 것인지 여쭙고자 합니다.
과제 설명을 보면 다음과 같은 제약조건 추론을 요구하는 것으로 이해했습니다.
%w = alloca i32, align 4=> T(w) = i32*%v = alloca i8, align 1=> T(v) = i8*store i32 %div, i32* %w, align 4=> ptr of T(div) = T(w)여기서, 처음 두 조건을 구하기 위해서는
i32,i8등의 타입 힌트를 읽어야 하지만,마지막 코드에서 모든 타입 힌트를 고려한다면 T(div) = i32 /\ T(w) = i32* 라는 더 강력한 조건도 추론할 수 있습니다.
따라서, 의도하신 타입 검사기의 의미가 어느 수준까지 타입 힌트를 고려하는 것인지 여쭙고 싶습니다.
예컨대,
%0 = load i32, i32* %x, align 4=> ptr of T(0) = T(x)인지, 아니면 T(0) = i32 /\ T(x) = i32*인지,%add = add nsw i32 10, %0=> T(add) = T(0) = i32인지, 아니면 T(add)=T(0)인지,%call = call i32 @f(i32 noundef %7)로부터 T(f) = i32 -> i32를 추론할 수 있는지,등을 여쭙고 싶습니다.
감사합니다.
번역본 Translated Version
Hello.
I'd like to inquire to what degree we may utilize the type hints in the LLVM IR code.
From the README, I understood that we should infer the following type constraints:
%w = alloca i32, align 4=> T(w) = i32*%v = alloca i8, align 1=> T(v) = i8*store i32 %div, i32* %w, align 4=> ptr of T(div) = T(w)The first two constraints require us to read the type hints such as i32 and i8.
However, if we take all type hints into account for the last instruction, we can infer the substantially stronger constraint:
T(div) = i32 /\ T(w) = i32*.
Thus, I'd like to ask how much type hints should be considered for the intended semantics of the type checker.
For example,
%0 = load i32, i32* %x, align 4=> Should we infer ptr of T(0) = T(x) or T(0) = i32 /\ T(x) = i32*?%add = add nsw i32 10, %0=> Should we infer T(add) = T(0) = i32 or T(add) = T(0)?%call = call i32 @f(i32 noundef %7)that T(f) = i32 -> i32?Thank you.
Beta Was this translation helpful? Give feedback.
All reactions