ACSE 2.0.3
Advanced Compiler System for Education
Loading...
Searching...
No Matches
cfg.c File Reference

Control Flow Graph generation and related analyses implementation. More...

#include <assert.h>
#include <stdlib.h>
#include "cfg.h"
#include "target_info.h"
#include "target_asm_print.h"
#include "errors.h"

Go to the source code of this file.

Functions

t_basicBlocknewBasicBlock (void)
void deleteBasicBlock (t_basicBlock *block)
void bbAddPred (t_basicBlock *block, t_basicBlock *pred)
void bbAddSucc (t_basicBlock *block, t_basicBlock *succ)
t_bbNodebbInsertInstruction (t_basicBlock *block, t_instruction *instr)
t_bbNodebbInsertInstructionBefore (t_basicBlock *block, t_instruction *instr, t_bbNode *ip)
t_bbNodebbInsertInstructionAfter (t_basicBlock *block, t_instruction *instr, t_bbNode *ip)
void deleteCFG (t_cfg *graph)
t_basicBlockcfgCreateBlock (t_cfg *graph)
t_cfgprogramToCFG (t_program *program)
void cfgToProgram (t_program *program, t_cfg *graph)
int cfgIterateNodes (t_cfg *graph, void *context, int(*callback)(t_bbNode *node, int nodeIndex, void *context))
t_listNodebbGetLiveOut (t_basicBlock *bblock)
t_listNodebbGetLiveIn (t_basicBlock *bblock)
void cfgComputeLiveness (t_cfg *graph)
void cfgDump (t_cfg *graph, FILE *fout, bool verbose)

Detailed Description

Control Flow Graph generation and related analyses implementation.

Definition in file cfg.c.

Function Documentation

◆ bbAddPred()

void bbAddPred ( t_basicBlock * block,
t_basicBlock * pred )

Adds a predecessor to a basic block.

Parameters
blockThe successor block.
predThe predecessor block.

Definition at line 163 of file cfg.c.

◆ bbAddSucc()

void bbAddSucc ( t_basicBlock * block,
t_basicBlock * succ )

Adds a successor to a basic block.

Parameters
blockThe predecessor block.
succThe successor block.

Definition at line 175 of file cfg.c.

◆ cfgCreateBlock()

t_basicBlock * cfgCreateBlock ( t_cfg * graph)

Inserts a new block in a control flow graph.

Parameters
graphThe graph where the block must be added.
Returns
The new block.

Definition at line 265 of file cfg.c.

◆ deleteBasicBlock()

void deleteBasicBlock ( t_basicBlock * block)

Frees the memory associated with a given basic block.

Parameters
blockThe block to be freed.

Definition at line 141 of file cfg.c.

◆ newBasicBlock()

t_basicBlock * newBasicBlock ( void )

Allocate a new empty basic block.

Returns
The new block.

Definition at line 127 of file cfg.c.