This is the mail archive of the gcc@gcc.gnu.org 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]

Q: Accessing signgam from the middle-end for builtin lgamma


I'd like to work on using MPFR to handle builtin lgamma.  The lgamma
function requires setting the global int variable "signgam" in addition to
calculating the return value of lgamma.  I think I see how to do grab a
handle on signgam like so:

sg = maybe_get_identifier("signgam");
if (sg)
{
  sg = identifier_global_value(sg); /* Question 1 */
  if (sg)
  {
    if (TREE_TYPE (sg) == TYPE_DECL
        && DECL_ORIGINAL_TYPE (sg) == integer_type_node)
      return sg; /* Use this to set signgam. */
    else
      /* Question 2 */ ;
  }
  else
  {
    /* Question 3 */ ;
  }
else
{
  /* Question 4 */
}


I've marked above where I have questions about how to proceed.

1.  Only the C-family functions have identifier_global_value.  I need to
access this from the middle-end.  Should I use a langhook?  What should
the non-C languages default to returning?  NULL?  Should I punt in non-C
or just set the return value of lgamma without setting signgam?  I could
also declare signgam myself.

2.  I assume that if signgam is defined at global scope with something
other than int type then I punt, or should I proceed without setting
signgam?

3.  If signgam is declared somehow but not at global scope, then should I
declare it myself with type int and proceed to set it?  Or should I ignore
signgam but still generate the lgamma value?  Or do nothing?

4.  Likewise, if signgam is not declared at all, which of the three
choices from #3 should I do?

My guesses are:
1.  Do nothing for non-C.
2.  Punt.
3.  Declare signgam and proceed.
4.  Ditto.

		Thanks,
		--Kaveh
--
Kaveh R. Ghazi			ghazi@caip.rutgers.edu


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