|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
java.lang.Object | +--coins.casttohir.ToHirCast
This class offers the cast function.
. explicit/implicit cast . usual arithmetic converson . integral promotion . comparison result type . ?: resultant type etc.
フィールドの概要 | |
protected int |
fDbgLevel
|
コンストラクタの概要 | |
(パッケージプライベート) |
ToHirCast(ToHir tohir)
|
メソッドの概要 | |
(パッケージプライベート) Exp |
assignCast(Type t1,
Exp e2)
Do cast for assignment statement. |
(パッケージプライベート) Exp |
cast(Type t1,
Exp e2)
Cast for HIR type object. |
(パッケージプライベート) Exp |
daPromotion(Exp e)
Default argument promotion |
(パッケージプライベート) Type |
getCompareType(Type t1,
Type t2)
Get the type for casting operands of comparison operation. |
(パッケージプライベート) Type |
getPointerOpType(Type t1,
Type t2)
Get the rresultant type of address expression. |
(パッケージプライベート) Type |
getSelectType(Type t2,
Type t3)
Get the resultant type of selection expression (? |
(パッケージプライベート) Type |
getUacType(Type t1,
Type t2)
Get the resultant type of UAC (usual arithmetic converson). |
(パッケージプライベート) Exp |
iPromotion(Exp e)
Integral promotion. |
(パッケージプライベート) Exp |
siPromotion(Exp e)
Do signed integral promotion (used at unary -). |
クラス java.lang.Object から継承したメソッド |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
フィールドの詳細 |
protected int fDbgLevel
コンストラクタの詳細 |
ToHirCast(ToHir tohir)
メソッドの詳細 |
Exp cast(Type t1, Exp e2)
t1
- Ttarget type.e2
- Expression.
Exp iPromotion(Exp e)
e
- Expression.
Exp siPromotion(Exp e)
e
- Expression.
Exp daPromotion(Exp e)
e
- Expression.
Exp assignCast(Type t1, Exp e2)
Condition of permissible assignment: *) Both sides are array of toHir.typeChar (initiation by char string for HIR-base) 1) Both sides are arithmetic and their types are compatible except for type qualifier. 2) Both sides are struct/union and their types are compatible except for type qualifier. 3) Both sides are pointer, and their pointed types are compatible except for type qualifier (warning if incompatible), and left hand side pointed type includes type qualifier of the pointed type of right hand side (warning if not included). 4) Both sides are pointer, and one of them is the pointer to void, and left hand side pointed type includes type qualifier of the pointed type of right hand side (warning if not included). //5) Left hand side is pointer and right hand side is NULL pointer constant. 5-1) Left hand side is pointer and right hand side is integral (implicitly cast to left hand side issueing warning). 5-2) Left hand side is integral and right hand side is pointer (implicitly cast to left hand side issueing warning).
t1
- Left operand Type.e2
- Right operand.
Type getUacType(Type t1, Type t2)
If the rank of left operand is less than the rannk of right operand, exchange operands to make processing easy. If one of operands is not arithmetic, result (resultant type) is null. If ranks are less than the rank of int then { Do integral promotion. If one of operands has precision greater than int and it is unsigned, then the result is unsigned int. In other cases return int. } If one of operands has rank greater than the rank of int then { If left operand precision > right operand precision, return left operand type. If one of operands is unsigned, then return the left oprerand type changing it to unsigned if required. If both operands are signed, then return the left operand type. }
t1
- Left operand type.t2
- Right operand type.
Type getCompareType(Type t1, Type t2)
1) Both operands are arithmetic toHir.isArithmetic(t1) && toHir.isArithmetic(t2) 2) Both operands are pointer and their pointed types are compatible with each other disregarding type qualifier. isPointer(t1) && isPointer(t2) && toHir.isCompatible(ptd1,ptd2,false) // 3) pointer and NULL pointer constant 3) One operand is pointer and the other operand is integer is made permissible. In such case, 0 is converted to NULL pointer and other integer values are casted to pointer after issueing warning message. 4) One operand is pointer and the other operand is pointer to void with or without type qualifier.
t1
- Right operand type.t2
- Left operand type.
Type getSelectType(Type t2, Type t3)
1) Both operands are arithmetic --> usual arithmetic conversion 2) Both operands are compatible struct/union --> composite type 3) Both operands are void --> void 4) Both operands are pointer and pointed types are compatible with each other disregarding type qualifier --> pointer to composite type with all type qualifiers specified 5) One operator is pointer and the oper is NULL pointer constant (treating as integer) --> pointer 6) Both operands are pointer and one is the pointer to void --> pointer to void with all type qualifiers specified
t2
- 2nd operand type.t3
- 3rd operand type.
Type getPointerOpType(Type t1, Type t2)
address expression +/- integer (pointer - pointer is treated in atOffset)
t1
- Typet2
- Type
|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |