shiltian wrote:

> The IR is a representation of what goes on a final .o. It is not really 
> intended to enable new features or make the program portable.

My .02 is, it depends on how to think about it. If we eliminate the "unwanted" 
part (especially those that could potentially affect ABI) at the very beginning 
of the middle end, it will not have optimization effects.

In addition, the compiler backend lowering is essentially doing something like:

```
if (target == A)
  lower Inst to I1
else if (has_feature_that_only_compiler_can_call("..."))
  lower Inst to I2
...
```

If speaking from "portability", the compiler is "portable". The reflection is 
just to give end user an interface to do similar things:

```
if (__builtin_get_target() == A)
  do something in one way
else if (has_feature_that_user_can_call("..."))
  do something in another way
...
```

Of course the interface(s) have to be carefully designed and all the queried 
information can't be changed during optimization.

https://github.com/llvm/llvm-project/pull/119091
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to