LLVM backend for 6502
Go to file
Stepan Dyatkovskiy 6ce1c88a4f Related to PR1255. Let's begin. I'll commit classes that corresponds to our latest PR1255 discussion posts in llvm-commits.
Strategy.
0. Implement new classes. Classes doesn't affect anything. They still work with ConstantInt base values at this stage.
1. Fictitious replacement of current ConstantInt case values with ConstantRangesSet. Case ranges set will still hold single value, and ConstantInt *getCaseValue() will return it. But additionally implement new method in SwitchInst that allows to work with case ranges. Currenly I think it should be some wrapper that returns either single value or ConstantRangesSet object.
2. Step-by-step replacement of old "ConstantInt* getCaseValue()" with new alternative. Modify algorithms for all passes that works with SwitchInst. But don't modify LLParser and BitcodeReader/Writer. Still hold single value in each ConstantRangesSet object. On this stage some parts of LLVM will use old-style methods, and some ones new-style.
3. After all getCaseValue() usages will removed and whole LLVM and its clients will work in new style - modify LLParser, Reader and Writer. Remove getCaseValue().
4. Replace ConstantInt*-based case ranges set items with APInt ones.

Currently we are on Zero Stage: New classes.
ConstantRangesSet.
I selected ConstantArrays as case ranges set "holder" object (it is a temporary decision, I'll explain why below). The array items are may be ConstantVectors with single item, and ConstantVectors with two items (that means single number and range respectively).
The ConstantInt will used as basic value representation. It will replaced with APInt then. Of course ConstantArray and ConstantVector will go away after ConstantInt => APInt replacement.

New class mandatory features:
- bool isSatisfies(ConstantInt *V) method (need better name?). Returns true if the given value satisfies this case.
- Case's ranges and values enumeration. In some passes we need to analize each case (SwitchLowering for example).

Factory + unified clusterify.
I also propose to implement the factory that allows to build case object with user friendly way. I called it CRSBuilder by now.
Currenly I implemented the factory that allows add,remove pairs of range+successor. It also allows add existing ConstantRangesSet decompiling it to separated ranges. Factory can emit either clusters set (single case range + successor) or the set of "ConstantRangesSet + Successor" pairs.
So you can use it either as builder for new cases set for SwitchInst, or for clusterification of existing cases set.
Just call Factory.optimize() and it emits optimized and sorted clusters collection for you!
I tested clusterification on SelectionDAGBuilder - it works fine. Don't worry it was not included in this patch. Just new classes.
Factory is a template. There are two params: SuccessorClass and IsReadonly. So you can specify what successor you need (BB or MBB). And you can also restrict your factory to use values in read-only mode (SelectionDAGBuilder need IsReadonly=true). Read-only factory couldn't build the cases ranges.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155464 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-24 18:31:10 +00:00
autoconf Kick off 3.2 cycle for LLVM trunk. 2012-04-20 18:15:07 +00:00
bindings [python] Add negative MemoryBuffer testcase 2012-03-22 11:23:52 +00:00
cmake CMake: Enable LLVM_COMPILER_JOBS on all MS IDEs. We don't support older environments than VS9. 2012-04-21 14:51:02 +00:00
docs [docs] Update version number. I suggest that at some point we make the 2012-04-20 19:28:40 +00:00
examples Remove llvm-ld and llvm-stub (which is only used by llvm-ld). 2012-04-19 19:27:54 +00:00
include Related to PR1255. Let's begin. I'll commit classes that corresponds to our latest PR1255 discussion posts in llvm-commits. 2012-04-24 18:31:10 +00:00
lib AVX: Add additional vbroadcast replacement sequences for integers. 2012-04-24 18:09:59 +00:00
projects Remove llvm-ld and llvm-stub (which is only used by llvm-ld). 2012-04-19 19:27:54 +00:00
runtime Use the correct filename for the error message. 2012-03-28 02:39:06 +00:00
test Add missing test cases for ARM VLD3 (single 3-element structure to all lanes) 2012-04-24 17:45:56 +00:00
tools Remove llvm-ld and llvm-stub (which is only used by llvm-ld). 2012-04-19 19:27:54 +00:00
unittests SparseSet: Add support for key-derived indexes and arbitrary key types. 2012-04-20 20:05:28 +00:00
utils Remove 'XXXRegisterClass' from tablegen output. Targets should use '&XXXRegClass' instead. 2012-04-21 01:49:25 +00:00
.gitignore [docs] Stub out structure for Sphinx-based docs. 2012-04-19 16:31:19 +00:00
CMakeLists.txt CMake: Prune redundant LLVM_COMPILER_JOBS from llvm/CMakeLists.txt. HandleLLVMOptions.cmake has it. 2012-04-21 14:50:56 +00:00
configure Kick off 3.2 cycle for LLVM trunk. 2012-04-20 18:15:07 +00:00
CREDITS.TXT Update woefully stale credits entry. Everything listed there had been 2012-04-17 01:19:37 +00:00
LICENSE.TXT Add YAML parser to Support. 2012-04-03 23:09:22 +00:00
llvm.spec.in
LLVMBuild.txt LLVMBuild: Introduce a common section which currently has a list of the 2011-12-12 22:45:54 +00:00
Makefile When cross compiling, install a host version of llvm-config. <rdar://11187889> 2012-04-19 23:19:55 +00:00
Makefile.common
Makefile.config.in
Makefile.rules Remove llvm-ld and llvm-stub (which is only used by llvm-ld). 2012-04-19 19:27:54 +00:00
README.txt test commit 2012-03-20 13:12:38 +00:00

Low Level Virtual Machine (LLVM)
================================

This directory and its subdirectories contain source code for the Low Level
Virtual Machine, a toolkit for the construction of highly optimized compilers,
optimizers, and runtime environments.

LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.

Please see the HTML documentation provided in docs/index.html for further
assistance with LLVM.

If you're writing a package for LLVM, see docs/Packaging.html for our
suggestions.