This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import operator | |
from collections import defaultdict | |
from dataclasses import dataclass, field | |
from typing import Dict, List, Any, Union, Set | |
# --- Type Aliases for clarity --- | |
Value = Union[int, bool, None] | |
Store = Dict[str, Value] | |
Program = Dict[str, List['Instruction']] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Script to run LLVM's opt tool for | |
# benchmarking Execution Time and Code Size | |
# from a chosen set of transforms | |
# | |
# | |
# Usage: | |
# ./run_benchmark.sh SRC_FILE | |
# where: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import copy | |
B = 9 # number of basic blocks | |
use = { # variables being used on each basic block | |
1:set(), | |
2:set(), | |
3:{'v'}, | |
4:{'r','n'}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import abc | |
from tokenize import tokenize | |
class AbstractExpression(metaclass=abc.ABCMeta): | |
@abc.abstractmethod | |
def interpret(self): | |
pass | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from threading import Thread | |
# Item 3 da Check list do Object Pool | |
class Singleton(type): | |
def __init__(cls, name, bases, attrs, **kwargs): | |
super().__init__(name, bases, attrs) | |
cls._instance = None | |
def __call__(cls, *args, **kwargs): |