-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change control flow generation scheme #114
base: master
Are you sure you want to change the base?
Conversation
60c4d3c
to
cfb7c1d
Compare
33f3d55
to
bd9790e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I'd prefer @azhogin to look at the patch as well
const Function &F = MF->getFunction(); | ||
if (F.hasFnAttribute("tvm_raw_func")) { | ||
OutStreamer->EmitRawText("\t.internal\t:" + CurrentFnSym->getName()); | ||
if (Blocks < 16) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we avoid the magic number here?
// | | ||
// ... | ||
bool TVMIfConversionTerm::tryConvertIf2(MachineBasicBlock *MBB) { | ||
MachineBasicBlock *TBB = nullptr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpicking, but TrueBB
and FalseBB
are easier to understand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBB/FBB are usual names in llvm for true/false destination blocks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, they are indeed usual. But 'usual' doesn't imply anything on the quality of the choice. Anyway, naming here is up to the author, I merely expressed my opinion.
I had an idea to represent function adresses as continuations. And add continuation type to language like slice/builder/cell/tuple. |
The idea is surely eligible for the kind of machine you have. Though I'm not sure that LLVM is a right framework for trying to implement the idea. To answer your question: it would be slightly harder, I guess. But does it matter? What is the example of a function address usage in a code of a contract... |
What actually bothers me about this approach is a support of high-level control-flow primitives like WHILE, UNTIL, REPEAT... |
@mskvortsov you've mentioned that the approach you use in the PR doesn't work well with huge functions (with more than 255 BBs). Do you plan to modify the solution somehow (e.g. use tuples of continuations) or do you want to abandon the idea? |
0f62ed2
to
78931e2
Compare
From what I see from performance analysis of a certain C++ sample, a huge number of basic blocks (301 in that code to be precise) looks like a problem by itself. Here is an execution statistics of logically the same
C++:
Stack manipulation primitives, implicit jmprefs and rets, and literals add roughly 7.5k of gas. My current guess it's because of stack modelling goes nuts on this huge number of BBs. |
No description provided.