summaryrefslogtreecommitdiff
path: root/Function.py
blob: 6621fb84ae9b5ff2962bce8ce8be90f9b57bc68f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env python
"""Compiles C into assembly for the practicum processor (PP2)

All rights reserved, you may not redistribute or use this program without prior
permission from Peter Wu or Xander Houtman. Use of this program is entirely
your own risk. In no circumstances can the authors of this program be held
responsible for any damage including, but not limited to, financial damage or
data loss. Modification of this program is not allowed without prior
permission. The generated output (assembly and messages) are not subject to
this license.
"""

__author__ = "Peter Wu"
__copyright__ = "Copyright 2011, Peter Wu"
__credits__ = ["Peter Wu"]
__license__ = "Proprietary"
__version__ = "1.0"
__maintainer__ = "Peter Wu"
__email__ = "uwretep@gmail.com"

class Function(object):
    def __init__(self, node):
        self.name = node.decl.name
        self.node = node
    def labelBegin(self):
        """Returns a label pointing to the begin of a function"""
        return "fn_" + self.name
    def labelEnd(self):
        """Returns a label pointing to the end of a function"""
        return "fne_" + self.name