xref: /aosp_15_r20/external/llvm/docs/HistoricalNotes/2001-07-06-LoweringIRForCodeGen.txt (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard WorkerDate: Fri, 6 Jul 2001 16:56:56 -0500
2*9880d681SAndroid Build Coastguard WorkerFrom: Vikram S. Adve <[email protected]>
3*9880d681SAndroid Build Coastguard WorkerTo: Chris Lattner <[email protected]>
4*9880d681SAndroid Build Coastguard WorkerSubject: lowering the IR
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard WorkerBTW, I do think that we should consider lowering the IR as you said.  I
7*9880d681SAndroid Build Coastguard Workerdidn't get time to raise it today, but it comes up with the SPARC
8*9880d681SAndroid Build Coastguard Workermove-conditional instruction.  I don't think we want to put that in the core
9*9880d681SAndroid Build Coastguard WorkerVM -- it is a little too specialized.  But without a corresponding
10*9880d681SAndroid Build Coastguard Workerconditional move instruction in the VM, it is pretty difficult to maintain a
11*9880d681SAndroid Build Coastguard Workerclose mapping between VM and machine code.  Other architectures may have
12*9880d681SAndroid Build Coastguard Workerother such instructions.
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard WorkerWhat I was going to suggest was that for a particular processor, we define
15*9880d681SAndroid Build Coastguard Workeradditional VM instructions that match some of the unusual opcodes on the
16*9880d681SAndroid Build Coastguard Workerprocessor but have VM semantics otherwise, i.e., all operands are in SSA
17*9880d681SAndroid Build Coastguard Workerform and typed.  This means that we can re-generate core VM code from the
18*9880d681SAndroid Build Coastguard Workermore specialized code any time we want (so that portability is not lost).
19*9880d681SAndroid Build Coastguard Worker
20*9880d681SAndroid Build Coastguard WorkerTypically, a static compiler like gcc would generate just the core VM, which
21*9880d681SAndroid Build Coastguard Workeris relatively portable.  Anyone (an offline tool, the linker, etc., or even
22*9880d681SAndroid Build Coastguard Workerthe static compiler itself if it chooses) can transform that into more
23*9880d681SAndroid Build Coastguard Workerspecialized target-specific VM code for a particular architecture.  If the
24*9880d681SAndroid Build Coastguard Workerlinker does it, it can do it after all machine-independent optimizations.
25*9880d681SAndroid Build Coastguard WorkerThis would be the most convenient, but not necessary.
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard WorkerThe main benefit of lowering will be that we will be able to retain a close
28*9880d681SAndroid Build Coastguard Workermapping between VM and machine code.
29*9880d681SAndroid Build Coastguard Worker
30*9880d681SAndroid Build Coastguard Worker--Vikram
31*9880d681SAndroid Build Coastguard Worker
32