Questions tagged [ssa]

Static single assignment is a property of a compiler's intermediate representation for optimization and static analysis.

Static single assignment is an intermediate representation where each "variable" is assigned only once. When translating from a form with mutable variables, each variable is replaced with a set of variables representing each possible assignment in order to make the definition and usage of every value explicit.

63 questions
3
votes
1 answer

LLVM IR phi node with only one possible predecessor

What is the benefit of using a phi node when there is only one possible predecessor? For example, when I run opt -loop- some-cool-file.ll -S, the output will frequently include a phi node with only one possible predecessor if I…
Daniel Robertson
  • 1,354
  • 13
  • 22
3
votes
1 answer

Java RSASSA-PKCS1 howto

Can anybody tell me how to generate signature for RSASSA-PKCS1-v1.5 in Java? I, actually, want to know how do I with java.security.Signature class. Do I have to use any 3rd party libraries?
Jin Kwon
  • 20,295
  • 14
  • 115
  • 184
3
votes
1 answer

Data flow graph generation for C programs

I need to make data flow graphs for C codes. By data flow graphs I mean graphs in which nodes in the graph represent operations like addition and multiplication, and edges represent operand (data) flow between nodes. My goal is to analyze…
aminfar
  • 2,297
  • 3
  • 27
  • 37
2
votes
0 answers

Can programs in SSA form lead to the construction of cyclic SDG?

Variables in Static Single Assignment (SSA) form transformed programs are only assigned once. This is done by making up a new version of a variable for each variable that is assigned more than once. Now, if I use the SSA transformed program to…
2
votes
1 answer

Is a functional program already in SSA form?

Recently, I've been wanting to create a small (educational) functional, optimizing compiler. For the optimizing portion, I want to use SSA. The thing is that (most, as far as I know) functional programming languages have immutable variables (by…
2
votes
1 answer

SSA - Copy Propagation and Phi functions

I've implemented a program that converts a control flow graph to minimal ssa (and I am pretty sure it is correct (see here)). Now I am trying to implement copy propagation. I've implemented it for the most part, but I am unsure what to do when the…
xilpex
  • 3,097
  • 2
  • 14
  • 45
2
votes
1 answer

How to use LLVM to convert stack-based virtual machine bytecode to SSA form

There are a number of questions on how to convert SSA representation to stack machines, but I'm interested in the inverse. Question Consider a stack-based VM with conditional/unconditional jumps, where each opcode has a fixed number of stack…
Peteris
  • 3,548
  • 4
  • 28
  • 44
2
votes
1 answer

Usage of edge-split SSA

The static single assignment (SSA) representation of code is almost but not quite canonical; there are two flavors, vanilla and edge-split in which extra nodes are inserted as necessary to cause every loop to have only one back edge. Rationale:…
rwallace
  • 31,405
  • 40
  • 123
  • 242
2
votes
1 answer

Machine Code based Control Flow Graph in LLVM

LLVM generally gives Control Flow Graphs (CFGs) for its intermediate representation (IR) language. You can also get high-level source-code-based CFGs with little effort. I want to get CFGs at the level of Machine Code. Is there any way to get…
soham
  • 1,508
  • 6
  • 30
  • 47
2
votes
1 answer

Global variables in Single Static Assignment Form

I am working on a compiler that uses SSA for a language which contains global variables. I am wondering how i should implement uses and definitions of global variables, for example how should I convert the below code? Non SSA form: x; y; main () { …
BenJacob
  • 957
  • 10
  • 31
2
votes
0 answers

Gaining a LLVM-IR in a SSA-form

I am currently building a static code analyzer and I wanted to use Clang, llvm. What I wanted as an output is a LLVM-IR in a SSA form(as a text file), when giving a c code as an input. I found this page(How to make clang compile to llvm IR) page, so…
izazu
  • 87
  • 9
2
votes
1 answer

Including atomic values in basic blocks

Converting an abstract syntax tree expression to an SSA basic block entails writing out all the operations in the expression in a linear sequence e.g. x * y + 1 gets converted to a list of operations containing the * and + in that order. Is it…
rwallace
  • 31,405
  • 40
  • 123
  • 242
2
votes
1 answer

How to deal with alias registers in data-flow analysis using SSA form? (e.g. EAX/AX/AH/AL in x86)

For exmaple: How to represent the following x86 in SSA form: xor eax, eax inc ax By introducing some pseudo functions, I come up with: eax@1 = eax@0 ^ eax@0 ax@1 = LOWORD(eax@1) al@1 = LOBYTE(ax@1) ah@1 = HIBYTE(ax@1) hax@1 = HIWORD(eax@1) ax@2…
inv
  • 4,759
  • 1
  • 17
  • 10
1
vote
1 answer

Methods to implement a register-based IR in static single assignment form

I'm writing a compiler for a register-based bytecode to an IR with static single assignment (SSA) form (specifically, from Dalvik VM bytecode to LLVM IR, but I'm hoping the question can be taken for the general topic) and am wondering the best, or…
1
vote
0 answers

Do phi nodes exist in LLVM IR before the mem2reg optimization pass?

In LLVM IR, phi nodes are a key component of SSA (Static Single Assignment) form and are used to represent control flow in a program. As far as I know the mem2reg optimization pass in LLVM is used to convert memory accesses into SSA form by…
Volodya Lombrozo
  • 2,325
  • 2
  • 16
  • 34