Seung Jae Lee wrote:> Thank you for this reply.
> If so, is there any way to merge basic blocks into a single one?
Why are you asking and what do you want to do?
I (Basile) wrote previously:
>> I believe you cannot do that, since the basic blocks are defined by the
control flow graph, i.e. by the points in the
>> program to which (conditional or unconditional) jumps go. In other
words, basic blocks are defined by the destination of
>> goto (in particular those in loops and tests) and calls.
Basic blocks is not some LLVM pecularity, it is a notion you can find in any
compiler book!
The only way to have bigger basic blocks is to avoid branching (ie any kind of
jumps, including loops, tests, function
calls and returns).
Intuitively you cannot jump inside a basic block or outside of it, only at the
start (jumping to before the first
instruction of the block) or end (jumping from after the last instruction of the
basic block).
I cannot figure what you are asking. Does your pecular language have no tests,
no loops, no jumps, no calls? If it is
the case (hence your language is not Turing complete) then you might have
choosen a too big tool (a compiler like LLVM)
for your goals.
Remember that the LLVM language is an intermediate language. Your translator has
to analyze your source code to break
into "atomic" control flow parts, which are precisely the basic
blocks.
Please take a few hours to read some basic tutorial on compilation...
Or maybe you are thinking of loop unrolling or inlining or other optimisation
(or program transformations).
What is hurting you in the notion of basic blocks and in the LLVM usage of them?
--
Basile STARYNKEVITCH http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faïencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***