Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hammer
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Denley Lam
hammer
Commits
5180f827
Commit
5180f827
authored
5 years ago
by
Andrea Shepard
Browse files
Options
Downloads
Patches
Plain Diff
Use LLVM name/label macros in epsilon.c
parent
2747168d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/parsers/epsilon.c
+9
-22
9 additions, 22 deletions
src/parsers/epsilon.c
with
9 additions
and
22 deletions
src/parsers/epsilon.c
+
9
−
22
View file @
5180f827
...
@@ -27,10 +27,8 @@ static bool epsilon_llvm(HLLVMParserCompileContext *ctxt,
...
@@ -27,10 +27,8 @@ static bool epsilon_llvm(HLLVMParserCompileContext *ctxt,
/* Allocator */
/* Allocator */
HAllocator
*
mm__
=
NULL
;
HAllocator
*
mm__
=
NULL
;
/* Names */
/* Names */
char
*
eps_bb_name
=
NULL
;
H_LLVM_DECLARE_NAME
(
epsilon
);
int
eps_bb_name_len
=
0
;
H_LLVM_DECLARE_NAME
(
epsilon_result_ptr
);
char
*
eps_result_ptr_name
=
NULL
;
int
eps_result_ptr_name_len
=
0
;
/* Epsilon basic block */
/* Epsilon basic block */
LLVMBasicBlockRef
epsilon_bb
;
LLVMBasicBlockRef
epsilon_bb
;
/* Args for make_result() */
/* Args for make_result() */
...
@@ -46,10 +44,8 @@ static bool epsilon_llvm(HLLVMParserCompileContext *ctxt,
...
@@ -46,10 +44,8 @@ static bool epsilon_llvm(HLLVMParserCompileContext *ctxt,
mm__
=
ctxt
->
mm__
;
mm__
=
ctxt
->
mm__
;
/* Set up the basic block */
/* Set up the basic block */
eps_bb_name_len
=
snprintf
(
NULL
,
0
,
"epsilon_%p"
,
p
);
H_LLVM_COMPUTE_NAME
(
epsilon
,
p
);
eps_bb_name
=
h_new
(
char
,
eps_bb_name_len
+
1
);
epsilon_bb
=
LLVMAppendBasicBlock
(
ctxt
->
func
,
epsilon_name
);
snprintf
(
eps_bb_name
,
eps_bb_name_len
+
1
,
"epsilon_%p"
,
p
);
epsilon_bb
=
LLVMAppendBasicBlock
(
ctxt
->
func
,
eps_bb_name
);
/* Basic block: epsilon */
/* Basic block: epsilon */
LLVMBuildBr
(
ctxt
->
builder
,
epsilon_bb
);
LLVMBuildBr
(
ctxt
->
builder
,
epsilon_bb
);
...
@@ -59,28 +55,19 @@ static bool epsilon_llvm(HLLVMParserCompileContext *ctxt,
...
@@ -59,28 +55,19 @@ static bool epsilon_llvm(HLLVMParserCompileContext *ctxt,
* For epsilon we make a null-token parse result like with end, but we
* For epsilon we make a null-token parse result like with end, but we
* do it unconditionally.
* do it unconditionally.
*/
*/
eps_result_ptr_name_len
=
snprintf
(
NULL
,
0
,
"epsilon_result_ptr_%p"
,
p
);
H_LLVM_COMPUTE_NAME
(
epsilon_result_ptr
,
p
);
eps_result_ptr_name
=
h_new
(
char
,
eps_result_ptr_name_len
+
1
);
snprintf
(
eps_result_ptr_name
,
eps_result_ptr_name_len
+
1
,
"epsilon_result_ptr_%p"
,
p
);
make_result_args
[
0
]
=
ctxt
->
arena
;
make_result_args
[
0
]
=
ctxt
->
arena
;
make_result_args
[
1
]
=
LLVMConstNull
(
ctxt
->
llvm_parsedtokenptr
);
make_result_args
[
1
]
=
LLVMConstNull
(
ctxt
->
llvm_parsedtokenptr
);
result_ptr
=
LLVMBuildCall
(
ctxt
->
builder
,
result_ptr
=
LLVMBuildCall
(
ctxt
->
builder
,
LLVMGetNamedFunction
(
ctxt
->
mod
,
"make_result"
),
LLVMGetNamedFunction
(
ctxt
->
mod
,
"make_result"
),
make_result_args
,
2
,
eps_result_ptr_name
);
make_result_args
,
2
,
eps
ilon
_result_ptr_name
);
/* Pass it back out */
/* Pass it back out */
*
res
=
result_ptr
;
*
res
=
result_ptr
;
if
(
eps_bb_name
)
{
/* Free names */
h_free
(
eps_bb_name
);
H_LLVM_FREE_NAME
(
epsilon
);
eps_bb_name
=
NULL
;
H_LLVM_FREE_NAME
(
epsilon_result_ptr
);
}
if
(
eps_result_ptr_name
)
{
h_free
(
eps_result_ptr_name
);
eps_result_ptr_name
=
NULL
;
}
return
true
;
return
true
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment