summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsspenst <[email protected]>2016-07-05 11:58:39 -0700
committersspenst <[email protected]>2016-07-05 11:58:39 -0700
commitfa63d925c3d73d4c1dd7b27799d501c90917aa84 (patch)
tree30fb33a52ad5ea0f919a46f2cbe088f1a88652b1
parent91b2afe09dbeb0fa1c5eb57cd4b416a5eb24bf60 (diff)
Slight addition to the parser for CPTX aesthetics. You now begin and end your custom inserted PTX with CPTX_BEGIN and CPTX_END, respectively.
-rw-r--r--src/cuda-sim/ptx.l8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/cuda-sim/ptx.l b/src/cuda-sim/ptx.l
index 1ac047c..49fd790 100644
--- a/src/cuda-sim/ptx.l
+++ b/src/cuda-sim/ptx.l
@@ -148,6 +148,8 @@ nop TC; ptx_lval.int_value = NOP_OP; return OPCODE;
break TC; ptx_lval.int_value = BREAK_OP; return OPCODE;
breakaddr TC; ptx_lval.int_value = BREAKADDR_OP; return OPCODE;
+"CPTX_END" printf("ENDING CUSTOM PTX.\n"); BEGIN(IN_COMMENT);
+
<INITIAL,NOT_OPCODE,IN_INST,IN_FUNC_DECL>{
\.align TC; return ALIGN_DIRECTIVE;
@@ -393,9 +395,9 @@ breakaddr TC; ptx_lval.int_value = BREAKADDR_OP; return OPCODE;
<IN_COMMENT>{
"*/" BEGIN(INITIAL);
"CPTX_BEGIN" printf("BEGINNING CUSTOM PTX.\n"); BEGIN(INITIAL);
-[^C*\n]+ // eat comment in chunks
-"C"
-"*" // eat the lone star
+[^C*\n]+ // eat comment in chunks
+"C" // eat the lone C
+"*" // eat the lone star
\n TC;
}