Reputation: 367
I can get the optimization level from the command llc -help
-O=<char> - Optimization level. [-O0, -O1, -O2, or -O3] (default = '-O2')
I want to know what the optimization does exactly.
So, I'm searching the source code of the backend optimizer.
I google it by "llvm backend optimizer", but there is no information about it, only some target-independent pass source code.
I want to know what does the optimization do for div-rem-pars
.
It can combine two instructions of llvm IR to one instruction for assembly code.
Upvotes: 3
Views: 491
Reputation: 3835
Apparently there are backend optimizers options in llvm. They are however not well documented [1,2]. The TargetMachine
[3] class has functions getOptLevel
and setOptLevel
to set an optimization level from 0-3 for a specific target machine, so starting from there you can try to track where it is used.
[1] https://llvm.org/docs/CodeGenerator.html#ssa-based-machine-code-optimizations
[2] https://llvm.org/docs/CodeGenerator.html#late-machine-code-optimizations
[3] https://llvm.org/doxygen/classllvm_1_1TargetMachine.html
Upvotes: 2