[PATCH] D19221: [ELF] - Implemented basic set of arithmetic operations on location counter.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 18 06:23:04 PDT 2016
grimar created this revision.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: llvm-commits, grimar.
Patch implements set of basic arithmetic operations
that are commonly used in linkerscripts, they
are: +,-,*,/,&,().
At first for expression Reverse Polish Notation (RPN) is built
using shunting-yard algorithm by Edsger Dijkstra.
Then RPN is used to calculate the expression.
Approach and algorithm should be extremely fast.
To analyze the running time complexity of this algorithm, one
has only to note that each token will be read once, each function,
operator, or parenthesis will be pushed onto the stack and popped
off the stack once – therefore, there are at most a constant number
of operations executed per token, and the running time is
thus O(n) – linear in the size of the input.
Also this approach is easy to extend to support functions,
ternary operator and other operators which we might want to add
in future.
http://reviews.llvm.org/D19221
Files:
ELF/LinkerScript.cpp
ELF/LinkerScript.h
test/ELF/linkerscript-locationcounter.s
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19221.54052.patch
Type: text/x-patch
Size: 13358 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160418/2b0b3279/attachment.bin>
More information about the llvm-commits
mailing list