This file contains 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
(* Util functions for MIPS instruction parsing *) | |
fun is_jal x = | |
Word32.compare (Word32.andb (x, 0wxfc000000), 0wx0c000000) = EQUAL; | |
fun is_j x = Word32.compare (Word32.andb (x, 0wxfc000000), 0wx08000000) = EQUAL; | |
fun is_jalr x = Word32.compare (Word32.andb (x, 0wxfc1f003f), 0wx9) = EQUAL; | |
val make_icache_flush : Word32.word = 0wx041f0000; (* synci 0($0) *) |
This file contains 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
""" | |
http://en.wikipedia.org/wiki/Path-based_strong_component_algorithm | |
""" | |
class Vertex: | |
def __init__(self, index): | |
self.index = index | |
class Edge: | |
def __init__(self, start, end): | |
self.start = start |
This file contains 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 sys | |
import numpy as np | |
""" | |
0. dump given .text sym from ELF | |
1. handles only obj files (not linked) for now | |
2. usage: havefun.py a.o main | |
""" |
This file contains 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
fun preds (_, [], result) = result | |
| preds (x, n :: ns, result) = | |
let val (from, to) = n | |
in | |
if x = to then preds (x, ns, from :: result) | |
else preds (x, ns, result) | |
end; | |
fun mem (_, []) = false | |
| mem (x, n :: ns) = |
This file contains 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
(* Profile guided code positioning | |
* http://dl.acm.org/citation.cfm?id=93550 | |
* http://pages.cs.wisc.edu/~fischer/cs701.f06/code.positioning.pdf | |
* | |
* Implementation of Procedure ordering | |
*) | |
(* Two nodes and weight. Each node consists of a list of items, which | |
* are nodes in original graph. A graph consits of a list of edges. |
This file contains 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
/* gcc -Wall -g -O3 a.c -pthread */ | |
/* perf stat -e LLC-store-misses,LLC-store,LLC-load-misses,LLC-load ./a.out */ | |
#define _GNU_SOURCE | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <pthread.h> |