Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
2
2025ustc-jianmu-compiler
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
14
Merge Requests
14
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
compiler_staff
2025ustc-jianmu-compiler
Commits
c54e751d
Commit
c54e751d
authored
Nov 11, 2025
by
王宇航
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lab3 publish
parent
03dc00fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
include/lightir/BasicBlock.hpp
include/lightir/BasicBlock.hpp
+4
-1
src/lightir/Instruction.cpp
src/lightir/Instruction.cpp
+4
-1
No files found.
include/lightir/BasicBlock.hpp
View file @
c54e751d
...
@@ -30,7 +30,7 @@ class BasicBlock : public Value, public llvm::ilist_node<BasicBlock> {
...
@@ -30,7 +30,7 @@ class BasicBlock : public Value, public llvm::ilist_node<BasicBlock> {
void
add_succ_basic_block
(
BasicBlock
*
bb
)
{
succ_bbs_
.
push_back
(
bb
);
}
void
add_succ_basic_block
(
BasicBlock
*
bb
)
{
succ_bbs_
.
push_back
(
bb
);
}
void
remove_pre_basic_block
(
BasicBlock
*
bb
)
{
pre_bbs_
.
remove
(
bb
);
}
void
remove_pre_basic_block
(
BasicBlock
*
bb
)
{
pre_bbs_
.
remove
(
bb
);
}
void
remove_succ_basic_block
(
BasicBlock
*
bb
)
{
succ_bbs_
.
remove
(
bb
);
}
void
remove_succ_basic_block
(
BasicBlock
*
bb
)
{
succ_bbs_
.
remove
(
bb
);
}
BasicBlock
*
get_entry_block_of_same_function
();
BasicBlock
*
get_entry_block_of_same_function
();
// If the Block is terminated by ret/br
// If the Block is terminated by ret/br
bool
is_terminated
()
const
;
bool
is_terminated
()
const
;
...
@@ -40,6 +40,9 @@ class BasicBlock : public Value, public llvm::ilist_node<BasicBlock> {
...
@@ -40,6 +40,9 @@ class BasicBlock : public Value, public llvm::ilist_node<BasicBlock> {
/****************api about Instruction****************/
/****************api about Instruction****************/
void
add_instruction
(
Instruction
*
instr
);
void
add_instruction
(
Instruction
*
instr
);
void
add_instr_begin
(
Instruction
*
instr
)
{
instr_list_
.
push_front
(
instr
);
}
void
add_instr_begin
(
Instruction
*
instr
)
{
instr_list_
.
push_front
(
instr
);
}
void
add_instr_before_end
(
Instruction
*
instr
)
{
instr_list_
.
insert
(
std
::
prev
(
instr_list_
.
end
()),
instr
);
}
void
erase_instr
(
Instruction
*
instr
)
{
instr_list_
.
erase
(
instr
);
}
void
erase_instr
(
Instruction
*
instr
)
{
instr_list_
.
erase
(
instr
);
}
void
remove_instr
(
Instruction
*
instr
)
{
instr_list_
.
remove
(
instr
);
}
void
remove_instr
(
Instruction
*
instr
)
{
instr_list_
.
remove
(
instr
);
}
...
...
src/lightir/Instruction.cpp
View file @
c54e751d
...
@@ -303,7 +303,10 @@ AllocaInst *AllocaInst::create_alloca_begin(Type *ty, BasicBlock *bb) {
...
@@ -303,7 +303,10 @@ AllocaInst *AllocaInst::create_alloca_begin(Type *ty, BasicBlock *bb) {
if
(
bb
!=
nullptr
)
if
(
bb
!=
nullptr
)
{
{
ret
->
set_parent
(
bb
);
ret
->
set_parent
(
bb
);
bb
->
add_instr_begin
(
ret
);
if
(
bb
->
is_terminated
())
bb
->
add_instr_before_end
(
ret
);
else
bb
->
add_instruction
(
ret
);
}
}
return
ret
;
return
ret
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment