{"action":"created","comment":{"url":"https://api.github.com/repos/Leeingnyo/snupl/pulls/comments/65709976","id":65709976,"diff_hunk":"@@ -616,20 +616,33 @@ size_t CBackendx86::ComputeStackOffsets(CSymtab *symtab,\n {\n   assert(symtab != NULL);\n   vector<CSymbol*> slist = symtab->GetSymbols();\n-  int size = 4;\n-\n-  // TODO\n-  // foreach local symbol l in slist do\n-  //   compute aligned offset on stack and store in symbol l\n-  //   set base register to %ebp\n-  //\n-  // foreach parameter p in slist do\n-  //   compute offset on stack and store in symbol p\n-  //   set base register to %ebp\n-  //\n-  // align size\n-  //\n-  // dump stack frame to assembly file\n-\n-  return size;\n+  int p_i = 0;\n+  int l_size = 0;\n+\n+  _out << _ind << \"# stack offsets:\" << endl;\n+  for (CSymbol *s : slist){\n+    if (s->GetSymbolType() == ESymbolType::stLocal){\n+      s->SetBaseRegister(\"%ebp\");\n+      const CType *type = s->GetDataType();\n+      l_size += type->GetSize();\n+      if (type->GetAlign() == 4 && l_size % 4 != 0){\n+        // need set align\n+        l_size += (4 - l_size % 4);\n+      }\n+      s->SetOffset(local_ofs - l_size);\n+    }\n+    if (s->GetSymbolType() == ESymbolType::stParam){\n+      s->SetBaseRegister(\"%ebp\");\n+      s->SetOffset(param_ofs + 4 * p_i);","path":"src/backend.cpp","position":46,"original_position":46,"commit_id":"92a52dbb8113bab7477602585768faa0c6ed3a6d","original_commit_id":"92a52dbb8113bab7477602585768faa0c6ed3a6d","user":{"login":"Rajin9601","id":7630229,"avatar_url":"https://avatars.githubusercontent.com/u/7630229?v=3","gravatar_id":"","url":"https://api.github.com/users/Rajin9601","html_url":"https://github.com/Rajin9601","followers_url":"https://api.github.com/users/Rajin9601/followers","following_url":"https://api.github.com/users/Rajin9601/following{/other_user}","gists_url":"https://api.github.com/users/Rajin9601/gists{/gist_id}","starred_url":"https://api.github.com/users/Rajin9601/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rajin9601/subscriptions","organizations_url":"https://api.github.com/users/Rajin9601/orgs","repos_url":"https://api.github.com/users/Rajin9601/repos","events_url":"https://api.github.com/users/Rajin9601/events{/privacy}","received_events_url":"https://api.github.com/users/Rajin9601/received_events","type":"User","site_admin":false},"body":"이거 parameter 순서로 넣어야 되는거 아닌가? 파라미터 넣을 때 stack처럼 넣으면 그 순서대로 할당되지 않나?\r\n","created_at":"2016-06-03T13:51:40Z","updated_at":"2016-06-03T13:51:40Z","html_url":"https://github.com/Leeingnyo/snupl/pull/58#discussion_r65709976","pull_request_url":"https://api.github.com/repos/Leeingnyo/snupl/pulls/58","_links":{"self":{"href":"https://api.github.com/repos/Leeingnyo/snupl/pulls/comments/65709976"},"html":{"href":"https://github.com/Leeingnyo/snupl/pull/58#discussion_r65709976"},"pull_request":{"href":"https://api.github.com/repos/Leeingnyo/snupl/pulls/58"}}},"pull_request":{"url":"https://api.github.com/repos/Leeingnyo/snupl/pulls/58","id":72506618,"html_url":"https://github.com/Leeingnyo/snupl/pull/58","diff_url":"https://github.com/Leeingnyo/snupl/pull/58.diff","patch_url":"https://github.com/Leeingnyo/snupl/pull/58.patch","issue_url":"https://api.github.com/repos/Leeingnyo/snupl/issues/58","number":58,"state":"open","locked":false,"title":"Implement compute stack offset","user":{"login":"Leeingnyo","id":6760150,"avatar_url":"https://avatars.githubusercontent.com/u/6760150?v=3","gravatar_id":"","url":"https://api.github.com/users/Leeingnyo","html_url":"https://github.com/Leeingnyo","followers_url":"https://api.github.com/users/Leeingnyo/followers","following_url":"https://api.github.com/users/Leeingnyo/following{/other_user}","gists_url":"https://api.github.com/users/Leeingnyo/gists{/gist_id}","starred_url":"https://api.github.com/users/Leeingnyo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Leeingnyo/subscriptions","organizations_url":"https://api.github.com/users/Leeingnyo/orgs","repos_url":"https://api.github.com/users/Leeingnyo/repos","events_url":"https://api.github.com/users/Leeingnyo/events{/privacy}","received_events_url":"https://api.github.com/users/Leeingnyo/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-06-03T13:27:15Z","updated_at":"2016-06-03T13:51:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d789d228e35219bce18f0153dc19319990438eac","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Leeingnyo/snupl/pulls/58/commits","review_comments_url":"https://api.github.com/repos/Leeingnyo/snupl/pulls/58/comments","review_comment_url":"https://api.github.com/repos/Leeingnyo/snupl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Leeingnyo/snupl/issues/58/comments","statuses_url":"https://api.github.com/repos/Leeingnyo/snupl/statuses/92a52dbb8113bab7477602585768faa0c6ed3a6d","head":{"label":"Leeingnyo:implement-compute-stack-offset","ref":"implement-compute-stack-offset","sha":"92a52dbb8113bab7477602585768faa0c6ed3a6d","user":{"login":"Leeingnyo","id":6760150,"avatar_url":"https://avatars.githubusercontent.com/u/6760150?v=3","gravatar_id":"","url":"https://api.github.com/users/Leeingnyo","html_url":"https://github.com/Leeingnyo","followers_url":"https://api.github.com/users/Leeingnyo/followers","following_url":"https://api.github.com/users/Leeingnyo/following{/other_user}","gists_url":"https://api.github.com/users/Leeingnyo/gists{/gist_id}","starred_url":"https://api.github.com/users/Leeingnyo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Leeingnyo/subscriptions","organizations_url":"https://api.github.com/users/Leeingnyo/orgs","repos_url":"https://api.github.com/users/Leeingnyo/repos","events_url":"https://api.github.com/users/Leeingnyo/events{/privacy}","received_events_url":"https://api.github.com/users/Leeingnyo/received_events","type":"User","site_admin":false},"repo":{"id":53873536,"name":"snupl","full_name":"Leeingnyo/snupl","owner":{"login":"Leeingnyo","id":6760150,"avatar_url":"https://avatars.githubusercontent.com/u/6760150?v=3","gravatar_id":"","url":"https://api.github.com/users/Leeingnyo","html_url":"https://github.com/Leeingnyo","followers_url":"https://api.github.com/users/Leeingnyo/followers","following_url":"https://api.github.com/users/Leeingnyo/following{/other_user}","gists_url":"https://api.github.com/users/Leeingnyo/gists{/gist_id}","starred_url":"https://api.github.com/users/Leeingnyo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Leeingnyo/subscriptions","organizations_url":"https://api.github.com/users/Leeingnyo/orgs","repos_url":"https://api.github.com/users/Leeingnyo/repos","events_url":"https://api.github.com/users/Leeingnyo/events{/privacy}","received_events_url":"https://api.github.com/users/Leeingnyo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Leeingnyo/snupl","description":"","fork":false,"url":"https://api.github.com/repos/Leeingnyo/snupl","forks_url":"https://api.github.com/repos/Leeingnyo/snupl/forks","keys_url":"https://api.github.com/repos/Leeingnyo/snupl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Leeingnyo/snupl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Leeingnyo/snupl/teams","hooks_url":"https://api.github.com/repos/Leeingnyo/snupl/hooks","issue_events_url":"https://api.github.com/repos/Leeingnyo/snupl/issues/events{/number}","events_url":"https://api.github.com/repos/Leeingnyo/snupl/events","assignees_url":"https://api.github.com/repos/Leeingnyo/snupl/assignees{/user}","branches_url":"https://api.github.com/repos/Leeingnyo/snupl/branches{/branch}","tags_url":"https://api.github.com/repos/Leeingnyo/snupl/tags","blobs_url":"https://api.github.com/repos/Leeingnyo/snupl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Leeingnyo/snupl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Leeingnyo/snupl/git/refs{/sha}","trees_url":"https://api.github.com/repos/Leeingnyo/snupl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Leeingnyo/snupl/statuses/{sha}","languages_url":"https://api.github.com/repos/Leeingnyo/snupl/languages","stargazers_url":"https://api.github.com/repos/Leeingnyo/snupl/stargazers","contributors_url":"https://api.github.com/repos/Leeingnyo/snupl/contributors","subscribers_url":"https://api.github.com/repos/Leeingnyo/snupl/subscribers","subscription_url":"https://api.github.com/repos/Leeingnyo/snupl/subscription","commits_url":"https://api.github.com/repos/Leeingnyo/snupl/commits{/sha}","git_commits_url":"https://api.github.com/repos/Leeingnyo/snupl/git/commits{/sha}","comments_url":"https://api.github.com/repos/Leeingnyo/snupl/comments{/number}","issue_comment_url":"https://api.github.com/repos/Leeingnyo/snupl/issues/comments{/number}","contents_url":"https://api.github.com/repos/Leeingnyo/snupl/contents/{+path}","compare_url":"https://api.github.com/repos/Leeingnyo/snupl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Leeingnyo/snupl/merges","archive_url":"https://api.github.com/repos/Leeingnyo/snupl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Leeingnyo/snupl/downloads","issues_url":"https://api.github.com/repos/Leeingnyo/snupl/issues{/number}","pulls_url":"https://api.github.com/repos/Leeingnyo/snupl/pulls{/number}","milestones_url":"https://api.github.com/repos/Leeingnyo/snupl/milestones{/number}","notifications_url":"https://api.github.com/repos/Leeingnyo/snupl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Leeingnyo/snupl/labels{/name}","releases_url":"https://api.github.com/repos/Leeingnyo/snupl/releases{/id}","deployments_url":"https://api.github.com/repos/Leeingnyo/snupl/deployments","created_at":"2016-03-14T16:40:15Z","updated_at":"2016-04-10T03:00:49Z","pushed_at":"2016-06-03T13:48:33Z","git_url":"git://github.com/Leeingnyo/snupl.git","ssh_url":"git@github.com:Leeingnyo/snupl.git","clone_url":"https://github.com/Leeingnyo/snupl.git","svn_url":"https://github.com/Leeingnyo/snupl","homepage":null,"size":446,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"Leeingnyo:master","ref":"master","sha":"48bad0d7d4b285b2da355c5d17849cf188c6d59d","user":{"login":"Leeingnyo","id":6760150,"avatar_url":"https://avatars.githubusercontent.com/u/6760150?v=3","gravatar_id":"","url":"https://api.github.com/users/Leeingnyo","html_url":"https://github.com/Leeingnyo","followers_url":"https://api.github.com/users/Leeingnyo/followers","following_url":"https://api.github.com/users/Leeingnyo/following{/other_user}","gists_url":"https://api.github.com/users/Leeingnyo/gists{/gist_id}","starred_url":"https://api.github.com/users/Leeingnyo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Leeingnyo/subscriptions","organizations_url":"https://api.github.com/users/Leeingnyo/orgs","repos_url":"https://api.github.com/users/Leeingnyo/repos","events_url":"https://api.github.com/users/Leeingnyo/events{/privacy}","received_events_url":"https://api.github.com/users/Leeingnyo/received_events","type":"User","site_admin":false},"repo":{"id":53873536,"name":"snupl","full_name":"Leeingnyo/snupl","owner":{"login":"Leeingnyo","id":6760150,"avatar_url":"https://avatars.githubusercontent.com/u/6760150?v=3","gravatar_id":"","url":"https://api.github.com/users/Leeingnyo","html_url":"https://github.com/Leeingnyo","followers_url":"https://api.github.com/users/Leeingnyo/followers","following_url":"https://api.github.com/users/Leeingnyo/following{/other_user}","gists_url":"https://api.github.com/users/Leeingnyo/gists{/gist_id}","starred_url":"https://api.github.com/users/Leeingnyo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Leeingnyo/subscriptions","organizations_url":"https://api.github.com/users/Leeingnyo/orgs","repos_url":"https://api.github.com/users/Leeingnyo/repos","events_url":"https://api.github.com/users/Leeingnyo/events{/privacy}","received_events_url":"https://api.github.com/users/Leeingnyo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Leeingnyo/snupl","description":"","fork":false,"url":"https://api.github.com/repos/Leeingnyo/snupl","forks_url":"https://api.github.com/repos/Leeingnyo/snupl/forks","keys_url":"https://api.github.com/repos/Leeingnyo/snupl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Leeingnyo/snupl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Leeingnyo/snupl/teams","hooks_url":"https://api.github.com/repos/Leeingnyo/snupl/hooks","issue_events_url":"https://api.github.com/repos/Leeingnyo/snupl/issues/events{/number}","events_url":"https://api.github.com/repos/Leeingnyo/snupl/events","assignees_url":"https://api.github.com/repos/Leeingnyo/snupl/assignees{/user}","branches_url":"https://api.github.com/repos/Leeingnyo/snupl/branches{/branch}","tags_url":"https://api.github.com/repos/Leeingnyo/snupl/tags","blobs_url":"https://api.github.com/repos/Leeingnyo/snupl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Leeingnyo/snupl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Leeingnyo/snupl/git/refs{/sha}","trees_url":"https://api.github.com/repos/Leeingnyo/snupl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Leeingnyo/snupl/statuses/{sha}","languages_url":"https://api.github.com/repos/Leeingnyo/snupl/languages","stargazers_url":"https://api.github.com/repos/Leeingnyo/snupl/stargazers","contributors_url":"https://api.github.com/repos/Leeingnyo/snupl/contributors","subscribers_url":"https://api.github.com/repos/Leeingnyo/snupl/subscribers","subscription_url":"https://api.github.com/repos/Leeingnyo/snupl/subscription","commits_url":"https://api.github.com/repos/Leeingnyo/snupl/commits{/sha}","git_commits_url":"https://api.github.com/repos/Leeingnyo/snupl/git/commits{/sha}","comments_url":"https://api.github.com/repos/Leeingnyo/snupl/comments{/number}","issue_comment_url":"https://api.github.com/repos/Leeingnyo/snupl/issues/comments{/number}","contents_url":"https://api.github.com/repos/Leeingnyo/snupl/contents/{+path}","compare_url":"https://api.github.com/repos/Leeingnyo/snupl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Leeingnyo/snupl/merges","archive_url":"https://api.github.com/repos/Leeingnyo/snupl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Leeingnyo/snupl/downloads","issues_url":"https://api.github.com/repos/Leeingnyo/snupl/issues{/number}","pulls_url":"https://api.github.com/repos/Leeingnyo/snupl/pulls{/number}","milestones_url":"https://api.github.com/repos/Leeingnyo/snupl/milestones{/number}","notifications_url":"https://api.github.com/repos/Leeingnyo/snupl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Leeingnyo/snupl/labels{/name}","releases_url":"https://api.github.com/repos/Leeingnyo/snupl/releases{/id}","deployments_url":"https://api.github.com/repos/Leeingnyo/snupl/deployments","created_at":"2016-03-14T16:40:15Z","updated_at":"2016-04-10T03:00:49Z","pushed_at":"2016-06-03T13:48:33Z","git_url":"git://github.com/Leeingnyo/snupl.git","ssh_url":"git@github.com:Leeingnyo/snupl.git","clone_url":"https://github.com/Leeingnyo/snupl.git","svn_url":"https://github.com/Leeingnyo/snupl","homepage":null,"size":446,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Leeingnyo/snupl/pulls/58"},"html":{"href":"https://github.com/Leeingnyo/snupl/pull/58"},"issue":{"href":"https://api.github.com/repos/Leeingnyo/snupl/issues/58"},"comments":{"href":"https://api.github.com/repos/Leeingnyo/snupl/issues/58/comments"},"review_comments":{"href":"https://api.github.com/repos/Leeingnyo/snupl/pulls/58/comments"},"review_comment":{"href":"https://api.github.com/repos/Leeingnyo/snupl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Leeingnyo/snupl/pulls/58/commits"},"statuses":{"href":"https://api.github.com/repos/Leeingnyo/snupl/statuses/92a52dbb8113bab7477602585768faa0c6ed3a6d"}}}}
{"actor":{"display_login":"Rajin9601"}}