Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I'm having a bit of trouble getting the output from
- CreateAlloca()
- CreateLoad()
- CreateStore()
- In the right place. If inside the production, I (incorrectly) have
- statement: T_ID '=' expression
- {
- // The code that is retrieving 'expression' as a Value* and being built as an AssignVarAST is here
- Function *print_int = gen_print_int_def();
- Function *TheFunction = gen_main_def(RetVal, print_int);
- verifyFunction(*TheFunction);
- }
- Then I get the resulting output, where the highlighted lines are what I want after
- entry:
- // All the highlighted lines I want here in the same order
- }
- http://i.imgur.com/2bxr1TD.png
- However if I take away gen_print_int_def() and gen_main_def() from the production T_ID '=' expression, then I get the following result, where all the lines I want aren't going to the output any more.
- http://i.imgur.com/FFdlzpi.png
- I understand that in the first picture I'm getting multiple instances of
- Because I'm calling T_ID '=' expression twice, followed by a single T_ID '(' expression ')'.
- From what I can tell, calls to the functions Builder.CreateAlloca(), Builder.CreateLoad(), Builder.CreateStore() won't go to the output unless
- BasicBlock *BB = BasicBlock::Create(getGlobalContext(), "entry", TheFunction);
- Builder.SetInsertPoint(BB);
- From gen_main_def() is done first. Since T_ID '(' expression ')' is the last line in the example, that is the reason I'm not getting the lines from the first picture in the second picture.
- Any help in clarifying how I can remedy this issue would be greatly appreciated
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement