Analysis of path exclusions at the assembly level 7th Int'l - - PowerPoint PPT Presentation

analysis of path exclusions at the assembly level
SMART_READER_LITE
LIVE PREVIEW

Analysis of path exclusions at the assembly level 7th Int'l - - PowerPoint PPT Presentation

Analysis of path exclusions at the assembly level 7th Int'l Workshop on Worst-Case Execution Time (WCET) Analysis Ingmar Stein, Florian Martin ingmar@absint.com The Goal A Jump conditions B C are equivalent 10 100 D E F 200 110


slide-1
SLIDE 1

Analysis of path exclusions at the assembly level

7th Int'l Workshop on Worst-Case Execution Time (WCET) Analysis Ingmar Stein, Florian Martin ingmar@absint.com

slide-2
SLIDE 2

A B C D E F G 10 100 100 10

200 110

The Goal

Jump conditions are equivalent

slide-3
SLIDE 3

The Goal (2)

  • if (flag)

do_something_expensive(); /* ... */ if (flag) do_something_cheap(); else do_something_expensive();

  • Generated Code
slide-4
SLIDE 4

Overview

  • Build expressions for jump conditions
  • trivial for high-level languages, but not for

machine code

  • Compare those expressions using a solver

library (Omega)

  • Use implications to generate new ILP

constraints which exclude the infeasible paths

slide-5
SLIDE 5

Analysis

  • Forwards analysis
  • Analyses all conditional jumps where the

contents of the condition register are still unknown after the value analysis

  • Creates backward slices with the condition

register as the initial target

slide-6
SLIDE 6

Slices

  • Slice: set of program points which directly
  • r indirectly influence the values at a given

program point

  • Example:

add r5, r3, r4 cmpi cr0, 0, r5, 0 bc 0xd, cr0, 0x2c.t

slide-7
SLIDE 7

Linear Slices

  • A slice is called linear, iff the program points

in the slice can be sorted, so that each program point is dominated by its predecessor

A B C D A B C D

non-linear linear

slide-8
SLIDE 8

Slice trees

add r5, r3, r4 cmpi cr0, 0, r5, 0 bc 0xd, cr0, 0x2c.t Constant Folding: (addi r5, 0, +16) ➟ 16

bc cmpi 0xd 0x2c.t add r3 r4

slide-9
SLIDE 9

Slice trees (2)

  • Nodes: instructions
  • Leaves: registers, memory cells, immediates
slide-10
SLIDE 10

Omega

  • “Framework and algorithms for the analysis and

transformation of scientific programs” by William Pugh and the Omega Project Team

  • http://www.cs.umd.edu/projects/omega/
  • Two Components
  • Omega-Test
  • Framework
slide-11
SLIDE 11

Omega-Test

  • Presburger Arithmetic
  • First-order arithmetic over the natural

numbers

  • ∀,∃,¬,∧,∨,+,-,=,≠
  • No multiplication!
  • Decidable
slide-12
SLIDE 12

Omega-Test (2)

  • Simplifies and decides Presburger formulas
  • Exponential runtime in the worst case
  • Experimentally known to be fast enough for

small problems

slide-13
SLIDE 13

Slices ➩ Omega

  • Instructions in the slice tree are mapped to

arithmetic and comparison operators according to their semantics

bc cmpi 0xd 0x2c.t add r3 r4

Slice Omega

> + r3 r4

slide-14
SLIDE 14

Slices ➩ Omega (2)

  • Instructions with unknown semantics are

treated as symbolic functions

  • mul r3, r4, r5 ➟ mul(r3, r4, r5)
  • Operator Strength Reduction helpful for

multiplication

slide-15
SLIDE 15

Slices ➩ Omega (3)

  • Leaves
  • Immediates become integer constants
  • Registers and memory cells become free

variables

slide-16
SLIDE 16

Slices ➩ Omega (4)

  • Given Omega trees for the basic blocks A

and B

  • A ⇒ B?
  • A ⇒ ¬B?
  • ¬A ⇒ B?
slide-17
SLIDE 17

Comparing Omega trees

  • Compare Omega trees of slices with a

common start point

  • Stop slicing at the beginning of a function
slide-18
SLIDE 18

Flow Constraints

  • Relative execution counts of basic blocks
  • Part of the ILP for the path analysis
  • As AIS annotation:

FLOW EACH ProgramPoint1 / ProgramPoint2 IS MIN min MAX max

slide-19
SLIDE 19

Flow-Constraints (2)

  • A ⇒ B:

A.t / B.t ≦ 1

  • A ⇒ ¬B:

A.t / B.f ≦ 1

  • ¬A ⇒ B:

A.f / B.t ≦ 1

  • ¬A ⇒ ¬B: A.f / B.f ≦ 1
  • Symmetric

A B A.f A.t B.f B.t

slide-20
SLIDE 20

Implementation

  • Implementation of the algorithm for the

PowerPC architecture

  • Additional architectures need their own

mapping of the semantics

  • Uses the generic slicer by Marc Schlickling
  • Integrated into a special aiT version
slide-21
SLIDE 21

Evaluation

without flow constraints with flow constraints Synthetic example 3054 cycles 2290 cycles WBBC 2964 cycles 2961 cycles FCGU 1247 cycles 1221 cycles

slide-22
SLIDE 22

Future Work

  • Other Architectures
  • Non-linear slices
  • Per-context flow constraints
  • Dead code elimination
  • Information about path exclusions can be used

for other things besides flow constraints

  • May be beneficial to PAG-generated analyzers
slide-23
SLIDE 23

Summary

  • A method to find path implications in the

control flow graph

  • Application in the path analysis
  • Can improve the WCET prediction by

eliminating infeasible paths

  • May be used to improve PAG analyzers
slide-24
SLIDE 24

?