reilabs / llvm-to-cairo

Efforts to compile LLVM bytecode to run on top of the CairoVM and hence execute provably on Starknet
http://starknet.io
Apache License 2.0
1 stars 0 forks source link

Determine Features to Disable #28

Open ktemkin opened 5 days ago

ktemkin commented 5 days ago

Description

There are certain features (e.g. trampolines/retpolines used as a spectre mitigation) that are not relevant for Cairo as a target. We will need to work out how to handle these as some of them use functions generated as part of the Compiler RT.

We want to disable features that get us the highest ratio of saved implementation effort to increased complexity of compilation. Some, like the aforementioned trampolines, are a no-brainer to disable, but others may require a cost-benefit analysis.

wzmuda commented 1 day ago

After our long meeting my understanding is that this task is about the Rust -> LLVM IR compilation phase. In that case, there seems to be nothing to turn off.

The example of retpolines and spectre mitigation seem to be used on the machine-specific assembly code generation level. Here's an example of such feature in LLVM - my understanding is that it alters emitted x86 assembly and has no impact on the IR emitted in the previous stage.

Looks like the IR undergoes these passes but they don't seem target-specific, so I don't see a reason to figure out how to turn any of them off.

There is such thing as machine- or target-dependent pass, but my understanding is that this happens on the llc level, so out of our interest.

In other words, I think there's nothing to do here.