Re: How to include "wide int" in code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I think these wide int routines make it possible to create 64bit targets
on 32bit hosts, ie. crosscompiling.


Regarding make: it should work when touch'ing a source file.
I just tried it out with the ../gcc_src/gcc/expmed.c: yes, it behaves as expected.

Maybe you did the build (configure and make) via a script,
but now calling make not from the same script: in this case
the environment can be different. One should avoid that;
better is doing the make in the same script as the configure,
in this case just disabling the configure step beforehand.

OTOH, maybe just your "hook" is causing some side effects leading to that
unexpected behavior? :-) I don't think so, but w/o seeing the modification
one can only guess.
If it's not much code, then you can post your hook here, I then can try
to compile it and tell you about the outcome.


colinb2 . wrote on 07/11/2018 11:55 PM:
Thanks. That makes sense to me, and it fits in with something that
U.Matlu suggested. The following is my reply to U.Matlu's most recent
post on this:

Thanks for the link. The following is my (limited) understanding of the terms:
* HOST_WIDE_INT, unsigned HOST_WIDE_INT are the largest fixed size integers
   available on the computing platform in question; HOST_BITS_PER_WIDE_INT has
   the number of bits of those fixed size integers.
* "wide int" (and functions associated with it) is an implementation of integers
   which in a particular instance (probably) has a fixed number of bits, but
   that number of bits can be arbitrarily larger than HOST_BITS_PER_WIDE_INT.

It seems plausible that all these are as you say mostly used internally in the
"GCC Middle and Back End API". Maybe my hope of using "#include" is impossible?

I have used "wide int" in the past by putting a "hook" in choose_multiplier in
expmed.c so that when a GCC make runs choose_multiplier to test it, instead of
running the tests the GCC make runs some "wide int" code that I want to try out.

I can still run some code from 2018-02-12-t-15:26:27 by copying an expmed.c
replacement over the original GCC.7.3.0 expmed.c, and using a GCC make which
skips unchanged files and starts with the first changed file, that is expmed.c.
But changing that expmed.c's modification date (even with no changes to it)
stops that method working. I've tried reinstalling GCC, copying the "hooked"
expmed.c over the existing expmed.c, and then using make, but that fails before
running the "hooked" code. I'm now completely at a loss as to how to progress.

I hope the above makes some sort of sense, and thanks again for your help.

On 7/11/18, Martin Sebor <msebor@xxxxxxxxx> wrote:
On 07/11/2018 06:01 AM, colinb2 . wrote:
Thanks to the two quick responders: I wasn't anticipating such immediate
help.

I've looked in gccint.pdf, and I was hoping to find but couldn't something
like:
#include <stdlib.h>

If it helps, "wide int" is used in function "choose_multiplier" in
expmed.c
which is located here for example: gcc-7.3.0/gcc/expmed.c

I've only ever managed to use "wide int" by making GCC and inserting a
"hook"
in "choose_multiplier" which runs some tests and benchmarks comparing
using
"wide int" with using fixed width integers "unsigned HOST_WIDE_INT".
I was hoping there was an easier way to do it!

The wide int classes aren't meant to be used outside GCC itself.
They are defined in wide-int.{h,cc} with formatted output support
in wide-int-print.{h,cc}.  AFAICT, the .o files are only linked
into libbackend.a.

Martin








[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux