File: compile_flags.exp

package info (click to toggle)
systemtap 2.6-0.2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 21,220 kB
  • ctags: 10,944
  • sloc: cpp: 53,239; ansic: 50,615; exp: 33,694; sh: 9,906; xml: 7,665; perl: 2,089; python: 1,534; tcl: 1,236; makefile: 797; java: 148; lisp: 104; awk: 94; asm: 91; sed: 16
file content (114 lines) | stat: -rw-r--r-- 3,219 bytes parent folder | download
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# Number of different compile flags for this arch.
proc arch_compile_flags {} {
  switch -regexp $::tcl_platform(machine) {
    {^(x86_64|ppc64|s390x)$} { return 2 }
    default { return 1}
  }
}

# Additional compile flag to use for with target_compile.
# Given INDEX starts at zero and should be smaller than the number
# returned by arch_compile_flags.
proc arch_compile_flag { INDEX } {
  if { [arch_compile_flags] == 1 } {
    return ""
  }

  switch $INDEX {
    0 {
      return "additional_flags=-m64"
    }
    1 {
      switch -regexp $::tcl_platform(machine) {
        {^s390x$} { return "additional_flags=-m31" }
        default { return "additional_flags=-m32" }
      }
    }
  }
}

# Name of compile flag to use in generated files or user/test messages.
# Given INDEX starts at zero and should be smaller than the number
# returned by arch_compile_flags.
proc arch_compile_flag_name { INDEX } {
  if { [arch_compile_flags] == 1 } {
    switch -regexp $::tcl_platform(machine) {
      {^(ia64|aarch64)$} { return "m64" }
      {^s390$} { return "m31" }
      default { return "m32" }
    }
  }

  switch $INDEX {
    0 {
      return "m64"
    }
    1 {
      switch -regexp $::tcl_platform(machine) {
        {^s390x$} { return "m31" }
        default { return "m32" }
      }
    }
  }
}

# Number of bits for compile flag for use in generated files or
# user/test messages.
#
# Given INDEX starts at zero and should be smaller than the number
# returned by arch_compile_flags.
proc arch_compile_flag_bits { INDEX } {
  # Notice that even though s390/s390x is 31 bits, we'll call it 32.
  if { [arch_compile_flags] == 1 } {
    switch -regexp $::tcl_platform(machine) {
      {^(ia64|aarch64)$} { return 64 }
      default { return 32 }
    }
  }

  switch $INDEX {
    0 { return 64 }
    1 { return 32 }
  }
}

# Number of different combinations of compile flags.
proc all_compile_flags {} {
  # There are 3 sets of flags for each architecture.
  return [expr 3 * [arch_compile_flags]]
}

# Is INDEX a native (i.e. non-multiarch) configuration?
proc all_compile_flag_native_p { INDEX } {
  set arch_index [expr $INDEX % [arch_compile_flags]]
  if { $arch_index == 0 } {
    return 1
  }
  return 0
}

# Is INDEX a configuration with optimization turned on?
proc all_compile_flag_optimized_p { INDEX } {
  return [expr (($INDEX / 2) % 3) > 0]
}

# Additional compile flag to use for with target_compile.
# Given INDEX starts at zero and should be smaller than the number
# returned by all_compile_flags.
proc all_compile_flag { INDEX } {
  set opt_flags [list "" "additional_flags=-O" "additional_flags=-O2" ]
  set arch_index [expr $INDEX % [arch_compile_flags]]
  set opt_flag [lindex $opt_flags [expr ($INDEX / 2) % 3]]
  return "[arch_compile_flag $arch_index] $opt_flag"
}

# Name of compile flag to use in generated files or user/test messages.
# Given INDEX starts at zero and should be smaller than the number
# returned by arch_compile_flags.
proc all_compile_flag_name { INDEX } {
  set opt_names [list "" "-O" "-O2" ]
  set arch_index [expr $INDEX % [arch_compile_flags]]
  set opt_name [lindex $opt_names [expr ($INDEX / 2) % 3]]
  return "[arch_compile_flag_name $arch_index]$opt_name"
}