This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [tree-ssa] AST optimizer in C++?

> > Maybe you could work up a patch to tree-ssa-ccp or tree-ssa-pre.c that
> > shows how much easier it would be if we had it in the IR?
> > No need to actually make it *work*, i just want to see an actual
> > benefit in terms of what the code looks like, or how short it is, etc,
> > rather than all theoretical junk.
> I'm having a hard time getting access to those files.
> doesn't seem to like displaying branches in viewcvs, and those files don't
> show up here:

Okay I found the code in the Attic directory (is this normal?).
Basically, I think the benefits would be:

* Simpler code.  I'm not really sure why you have two loops in
  ssa_ccp_substitute_constants, but SCCP should only require one loop of
  transformation over the representation to finalize it.  In LLVM this
  looks like this:

  for (Function::iterator BB = F.begin(), BBE = F.end(); BB != BBE; ++BB)
    for (BasicBlock::iterator BI = BB->begin(); BI != BB->end();) {
      Instruction &Inst = *BI;
      if (ValueState[&Inst].isConstant()) {
        Constant *Const = ValueState[&Inst].getConstant();
        // Replaces all of the uses of a variable with uses of the constant.
        // Remove the operator from the list of definitions... and delete it.
        BI = BB->getInstList().erase(BI);
      } else {

  [slightly simplified from]

  why does your SCCP have the extra loop?

* Macros should disappear.  Given a structured representation, many of the
  macros should go away...


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]