Closed mewmew closed 8 years ago
@sangisos If you feel like it, please take a look at how we may wish to implement implicit type conversion. Hopefully we can keep add it at the right part of the irgen abstraction, so that the code is generic and doesn't have to be sprinkled across every expression generation function.
Related to this, we may wish to remove the zext
(and possibly sext
) instructions which are currently used to convert conditional binary expressions to the type of their arguments. This could potentially help fix #66.
For now, lets try to get it working first. So it is ok to sprinkle type conversions across each IR generation function. When we have it working and stable, we could try to find the right point to insert the abstraction, and also look closer at perhaps fixing #66.
Feel free to ping me if you wish to discuss these things, or have any thoughts regarding the implementation. I'll try to ponder myself on how we may wish to do this.
Cheers /u
I have been reading the C99 draft and the clang sources, a typeCast function has an initial implementation in util(not yet pushed), but will be needed to be used in different ways before every use of a value.
I'm currently looking at how it is used in clangs ast context.
I have been reading the C99 draft and the clang sources, a typeCast function has an initial implementation in util(not yet pushed), but will be needed to be used in different ways before every use of a value.
Great! I'd be happy to take a look once you push it.
I'm currently looking at how it is used in clangs ast context.
Found anything interesting? How do they do it?
A duplicate of this issue is located at #63.
Still left to do, implement conversion of function arguments in call expressions.
From callExpr
:
for _, arg := range callExpr.Args {
expr := m.expr(f, arg)
// TODO: Add cast
args = append(args, expr)
}
Implicit conversion of function arguments in call expressions was implemented in commit a62d7fc. Closing this issue.
Add support for implicit type conversion. This feature affects the following test cases.
Type mismatch
testdata/quiet/semantic/s01.c
testdata/quiet/semantic/s05.c
testdata/quiet/semantic/s06.c
testdata/quiet/rtl/r01.c
testdata/quiet/rtl/r03.c
testdata/quiet/mips/m01.c
testdata/noisy/simple/sim04.c
testdata/noisy/simple/sim05.c
testdata/noisy/simple/sim06.c
testdata/noisy/simple/sim07.c
testdata/noisy/simple/sim08.c
testdata/noisy/simple/sim09.c
testdata/noisy/simple/sim10.c
testdata/noisy/simple/sim11.c
testdata/noisy/medium/circle.c
testdata/noisy/medium/fib.c
testdata/noisy/advanced/bubble.c
testdata/noisy/advanced/eval.c
testdata/noisy/advanced/primes.c
testdata/noisy/advanced/quick.c