Comments (8)
Thanks for moving your proposal to this repo.
I'd like to echo the comments Paul (riscv/riscv-isa-manual#825 (comment)) and Nick (riscv/riscv-isa-manual#825 (comment)) made.
FWIW, I'm in the camp that the C preprocessor already satisfies this need--elegantly, at that.
from riscv-asm-manual.
The #define
solution leaves anybody without a C-based system out in the cold -- see https://github.com/TheThirdOne/rars for instance. Shouldn't RISC-V be independent of C, at least in the long term?
from riscv-asm-manual.
I'm sympathetic to that concern, but in no way is reliance on the C preprocessor reliance on the C language. No one's being left out in the cold (unless they're rejecting use of the C preprocessor for anti-pragmatic reasons).
from riscv-asm-manual.
Okay. How about I create a pull request that states the problem and points to C preprocessor as a software-supported solution in a general way, mentions the above naming scheme as a poor substitute if that is not possible, and then somebody who has more experience with (and appreciation for) the C preprocessor adds some examples and hints for best practices?
from riscv-asm-manual.
Makes sense to me.
from riscv-asm-manual.
@nick-knight Sorry, you had mentioned in another comment that you use the preprocessor method extensively in your code. Might you have any recommendations or even some sort of a style guide based on your experience, or a recommendation of what not to do? Thank you!
from riscv-asm-manual.
I assume most developers that write assembly code use .S
files (assembly code that is preprocessed by a C preprocessor). For example glibc and Linux use this approach. But some projects also have their own solutions (OpenSSL uses Perl to generate assembly code). I'm convinced that a RISC-V assembler (as defined by this repository) should not aim to provide equivalent solutions. Instead, I prefer standardizing only a minimal set of RISC-V-specific assembly directives (those which are necessary). Otherwise, we introduce a long list of required features for a RISC-V assembler (include directives, binary includes, conditional compilation, etc.) that nobody wants to implement or use, and that are already available by existing mechanisms.
Also note, that a project like rars
could use a stand-alone C pre-processor to be compatible with code form .S
files (I recently stumbled over a project that depends on mcpp
for a similar purpose).
That all does not mean, that feature-rich assemblers can come up with their own solutions. E.g. GAS supports include directives and conditional compilation. In fact GAS' ARM/AArch64 backends also support register aliases using the .req
directive:
.globl return_zero
retval .req w0
return_zero:
mov retval, 0
ret
One last hint: Both, .equ
and .eqv
, already have defined semantics in GAS. So I would expect objections when trying to implement a support patch for GAS that uses these directives.
from riscv-asm-manual.
Obviously this is a solution that nobody seems to see a problem for. I'm going to close this issue, and if it comes up again in a few years we'll know where to find it. Thank you everybody for your feedback!
from riscv-asm-manual.
Related Issues (20)
- Change branch from "master" to "main" HOT 1
- ELF question HOT 2
- Will the "tail" pseudo instruction always get transformed to the "jalr" instruction? HOT 9
- Pseudoinstruction examples don't work for RV64 HOT 2
- Cover more pseudoinstructions, as it was done in riscv-spec-v2.2 HOT 3
- Typos HOT 4
- how does `%hi` work for RISC-V 64? HOT 6
- Missing LICENSE file HOT 2
- Document immediate encoding for addi HOT 7
- wrong instruction generation
- `.option (no)?relax` and label differences HOT 1
- Linker relaxation ignores .option norvc HOT 6
- Compile-time rounding-mode specification in [inline] assembly HOT 1
- Z*inx should require Zicsr
- Code size reduction specification (`C`, `Zca`, `Zcd`, `Zcf` and other `Zc*` extensions) HOT 11
- manual does not mention unsigned load insn, l{b|h|w}u HOT 2
- enhancement request: please could a pdf version, or pdf frindlier version be created? HOT 2
- Nothing can be found except the readme and license file. HOT 1
- Two suggested improvements to the pseudo instruction table HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from riscv-asm-manual.