Update TODO.md

This commit is contained in:
Ben Vanik 2013-01-22 13:15:02 -08:00
parent 9dfcbee090
commit 01fee047f7
1 changed files with 73 additions and 3 deletions

76
TODO.md
View File

@ -25,16 +25,64 @@ extsbx
slwx
srawix
# can be no-op
# can be no-op, or @llvm.prefetch
dcbt
dcbtst
twi
twi # @llvm.debugtrap ?
```
Overflow bits can be set via the intrinsics:
`llvm.sadd.with.overflow`/etc
It'd be nice to avoid doing this unless absolutely required. The SDB could
walk functions to see if they ever read or branch on the SO bit of things.
`@llvm.expect.i32`/`.i64` could be used with the BH bits in branches to
indicate expected values.
## Codegen
Make membase/state constant. Ensure optimized code uses constant value.
### Branch generation
Change style to match: http://llvm.org/docs/tutorial/LangImpl5.html
Insert check code, then push_back the branch block and implicit else after
its generated. This ensures ordering stays legit.
### Stack variables
Use stack variables for registers.
- All allocas should go in the entry block.
- Lazily add or just add all registers/etc at the head.
- Must be 1 el, int64
- Reuse through function.
- On FlushRegisters write back to state.
- FlushRegisters on indirect branch or call.
```
/// CreateEntryBlockAlloca - Create an alloca instruction in the entry block of
/// the function. This is used for mutable variables etc.
static AllocaInst *CreateEntryBlockAlloca(Function *TheFunction,
const std::string &VarName) {
IRBuilder<> TmpB(&TheFunction->getEntryBlock(),
TheFunction->getEntryBlock().begin());
return TmpB.CreateAlloca(Type::getDoubleTy(getGlobalContext()), 0,
VarName.c_str());
}
// stash result of above and reuse
// on first use in entry get the value from state?
// Promote allocas to registers.
OurFPM.add(createPromoteMemoryToRegisterPass());
// Do simple "peephole" optimizations and bit-twiddling optzns.
OurFPM.add(createInstructionCombiningPass());
// Reassociate expressions.
OurFPM.add(createReassociatePass());
```
### Tracing
Tracing modes:
@ -46,12 +94,14 @@ Tracing modes:
Inject extern functions into module:
- XeTraceKernelCall(caller_ia, cia, name, state)
- XeTraceUserCall(caller_ia, cia, name, state)
- XeTraceInstruction(cia, name, state)
- XeTraceInstruction(cia, state)
### Calling convention
Experiment with fastcc? May need typedef fn ptrs to call into the JITted code.
nonlazybind fn attribute to prevent lazy binding (slow down startup)
### Indirect branches (ctr/lr)
emit_control.cc XeEmitBranchTo
@ -78,6 +128,26 @@ Slow path:
- If found, return, add to lookup table, and jump.
- If not found, need new function codegen!
If the indirect br looks like it may be local (no stack setup/etc?) then
build a jump table:
```
Branch register with no link:
switch i32 %nia, label %non_local [ i32 0x..., label %loc_...
i32 0x..., label %loc_...
i32 0x..., label %loc_... ]
%non_local: going outside of the function
Could put one of these tables at the bottom of each function and share
it.
This could be done via indirectbr if branchaddress is used to stash the
address. The address must be within the function, though.
Branch register with link:
check, never local?
```
### Caching of register values in basic blocks
Right now the SSA values seem to leak from the blocks somehow. All caching