Add prototype ccc rewrite.
- Entry point is tools/ccc/xcc until we are a functional replacement
for ccc.
This is highly experimental (FIXME/LOC ratio of 3.4%), quite crufty,
and barely usable (and then only on my specific Darwin). However, many
of the right ideas are present, and it already fixes a number of
things gcc gets wrong.
The major missing component is argument translation for tools
(translating driver arguments into cc1/ld/as/etc. arguments). This is
a large part of the driver functionality and will probably double the
LOC, but my hope is that the current architecture is relatively
stable.
Documentation & motivation to follow soon...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61739 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/ccc/ccclib/Phases.py b/tools/ccc/ccclib/Phases.py
new file mode 100644
index 0000000..0384b8f
--- /dev/null
+++ b/tools/ccc/ccclib/Phases.py
@@ -0,0 +1,86 @@
+import Util
+
+class Action(object):
+ def __init__(self, inputs, type):
+ self.inputs = inputs
+ self.type = type
+
+class BindArchAction(Action):
+ """BindArchAction - Represent an architecture binding for child
+ actions."""
+
+ def __init__(self, input, arch):
+ super(BindArchAction, self).__init__([input], input.type)
+ self.arch = arch
+
+ def __repr__(self):
+ return Util.prefixAndPPrint(self.__class__.__name__,
+ (self.inputs[0], self.arch))
+
+class InputAction(Action):
+ """InputAction - Adapt an input file to an action & type. """
+
+ def __init__(self, filename, type):
+ super(InputAction, self).__init__([], type)
+ self.filename = filename
+
+ def __repr__(self):
+ return Util.prefixAndPPrint(self.__class__.__name__,
+ (self.filename, self.type))
+
+class JobAction(Action):
+ """JobAction - Represent a job tied to a particular compilation
+ phase."""
+
+ def __init__(self, phase, inputs, type):
+ super(JobAction, self).__init__(inputs, type)
+ self.phase = phase
+
+ def __repr__(self):
+ return Util.prefixAndPPrint(self.__class__.__name__,
+ (self.phase, self.inputs, self.type))
+
+###
+
+class Phase(object):
+ """Phase - Represent an abstract task in the compilation
+ pipeline."""
+
+ eOrderNone = 0
+ eOrderPreprocess = 1
+ eOrderCompile = 2
+ eOrderAssemble = 3
+ eOrderPostAssemble = 4
+
+ def __init__(self, name, order):
+ self.name = name
+ self.order = order
+
+ def __repr__(self):
+ return Util.prefixAndPPrint(self.__class__.__name__,
+ (self.name, self.order))
+
+class PreprocessPhase(Phase):
+ def __init__(self):
+ super(PreprocessPhase, self).__init__("preprocessor", Phase.eOrderPreprocess)
+
+class PrecompilePhase(Phase):
+ def __init__(self):
+ super(PrecompilePhase, self).__init__("precompiler", Phase.eOrderCompile)
+
+class CompilePhase(Phase):
+ def __init__(self):
+ super(CompilePhase, self).__init__("compiler", Phase.eOrderCompile)
+
+class AssemblePhase(Phase):
+ def __init__(self):
+ super(AssemblePhase, self).__init__("assembler", Phase.eOrderAssemble)
+
+class LinkPhase(Phase):
+ def __init__(self):
+ super(LinkPhase, self).__init__("linker", Phase.eOrderPostAssemble)
+
+class LipoPhase(Phase):
+ def __init__(self):
+ super(LipoPhase, self).__init__("lipo", Phase.eOrderPostAssemble)
+