[llvm-commits] [llvm] r62301 - /llvm/trunk/include/llvm/CodeGen/AsmPrinter.h

Sanjiv.Gupta at microchip.com Sanjiv.Gupta at microchip.com
Thu Jan 15 20:25:01 PST 2009


> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=62301&view=rev
> > Log:
> > Few targets do not have a single directive to emit global constants.
> > For example, PIC16 needs to break a long or int constant into
> > mulitple parts and emit multiple directives. So Allow targets to
> > overried EmitConstantValueOnly().
> 
> Hi Sanjiv,
> 
> I don't think this is the right approach.  EmitConstantValueOnly
> should handle this case directly by checking to see if you have a
> directive to emit a 32-bit integer value.  This is how we handle "lack
> of i64 emission" on 32-bit targets.
> 
> -Chris
> 
(Size > 4) is hard coded in EmitGlobalConstant(). 

} else if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
    // Small integers are handled below; large integers are handled
here.
    if (Size > 4) {
      EmitGlobalConstantLargeInt(CI);
      return;
    }

This needs to be fixed to check if the target has a directive to print
that Size. The other thing is that if these constants are going to exist
in rom address space we need to emit them in a different way. I am not
sure if we have this functionality available in the generic code.
Currently we are handling these cases in a target specific manner, but I
agree that the AsmPrinter framework should be enhanced/fixed to handle
such things. We will probably take that up after 2.5 if you guys agree.

- Sanjiv

> >
> >
> > Modified:
> >    llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
> >
> > Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
> > URL: http://llvm.org/viewvc/llvm-
>
project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=62301&r1=62300&
r2
> =62301&view=diff
> >
> > =
> > =
> > =
> > =
> > =
> > =
> > =
> > =
> >
======================================================================
> > --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original)
> > +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Thu Jan 15 20:45:46
> > 2009
> > @@ -317,7 +317,7 @@
> >
> >     /// EmitConstantValueOnly - Print out the specified constant,
> > without a
> >     /// storage class.  Only constants of first-class type are
> > allowed here.
> > -    void EmitConstantValueOnly(const Constant *CV);
> > +    virtual void EmitConstantValueOnly(const Constant *CV);
> >
> >     /// EmitGlobalConstant - Print a general LLVM constant to the .s
> > file.
> >     void EmitGlobalConstant(const Constant* CV);
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 





More information about the llvm-commits mailing list