summaryrefslogtreecommitdiff
path: root/README.md
blob: 738f06504fb7e146feb6c050bb3c0d237109bce5 (plain)
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# Ampere Computing LLVM Release Notes

These are the release notes the Ampere Computing LLVM release

# Build Instructions

This section depicts the commands used top build the release

## Setup the Source

### Setup envirionment

Select a build version and select the envirionment variables according to section  [Build Tags](#buildtags) in section below

### Clone and Checkout the LLVM base rpository (modify `LLVMREPOSITORY` accordingly)

```
export LLVMREPOSITORY=git@gitlab.lan:armv8
git clone $LLVMREPOSITORY/llvm.git llvm
cd llvm
git checkout $LLVMRELEASETAG
```

### Clone and Chekout the remaining repositories

```
pushd projects
git clone https://git.llvm.org/git/compiler-rt.git compiler-rt
cd compiler-rt
git checkout $LLVMCOMPILERRTTAG
cd ..
git clone https://git.llvm.org/git/libcxx.git libcxx
cd libcxx
git checkout $LLVMLIBCXXTAG
cd ..
git clone https://git.llvm.org/git/libcxxabi.git libcxxabi
cd libcxxabi
git checkout $LLVMLIBCXXABITAG
popd
pushd tools
git clone $LLVMREPOSITORY/clang.git clang
cd clang
git checkout $LLVMRELEASETAG
popd
```

#### [optional] Only checkout the correct tags from existing checkout

If you alreade have cloned the repos you can use the following commands to update to a defferent release

```
git fetch
git checkout $LLVMRELEASETAG
pushd projects
cd compiler-rt
git fetch
git checkout $LLVMCOMPILERRTTAG
cd ..
cd libcxx
git fetch
git checkout $LLVMLIBCXXTAG
cd ..
cd libcxxabi
git fetch
git checkout $LLVMLIBCXXABITAG
popd
pushd tools
cd clang
git fetch
git checkout $LLVMRELEASETAG
popd
```

## Build the source

Follow the instructions below to build the LLVM and libraries

### Build LLVM

You might want to adjust the variable `BUILDDIR` and `INSTALL_DIR` for your build

```
export BUILDDIR=build
export INSTALL_DIR=/compilers/llvm/$LLVMRELEASETAG
export LLVMSRC=$(pwd)
mkdir -p $BUILDDIR
pushd $BUILDDIR
cmake \
      -DCMAKE_BUILD_TYPE=Release \
      -DLLVM_BINUTILS_INCDIR=/usr/include \
      -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \
      -DLLVM_TARGETS_TO_BUILD="AArch64" \
      $LLVMSRC
make -j $(($(nproc)*2))
make -j $(($(nproc)*2)) install
popd
```

## Build tcmalloc

```
git clone https://github.com/gperftools/gperftools.git
cd gperftools
git checkout $PERFTOOLSTAG
./autogen.sh
export BUILDDIR=build
export BUILDSRC=$(pwd)
export INSTALL_DIR=/compilers/llvm/$LLVMRELEASETAG
mkdir -p $BUILDDIR
pushd $BUILDDIR
export CC="$INSTALL_DIR/bin/clang -mtune=xgene"
export CXX="$INSTALL_DIR/bin/clang++ -mtune=xgene"
export CPP="$INSTALL_DIR/bin/clang-cpp -mtune=xgene"
export CXXXPP="$INSTALL_DIR/bin/clang-cpp -mtune=xgene"
$BUILDSRC/configure --prefix=$INSTALL_DIR --with-tcmalloc-pagesize=32 --enable-static
make -j $(($(nproc)*2))
make -j $(($(nproc)*2)) install
popd
```

# Using llvm

In order to use llvm follow the instructions on llvm.org. In order to
use the exgene processor model add the option `-mtune=xgene`.

# <a name="buildtags"></a> Build Tags

## Envirionment for llvm_60-amp-20180630

```
export LLVMRELEASETAG=llvm_60-amp-20180630
export LLVMCOMPILERRTTAG=9d61c78bced84866cc886f1f1111c8e51c1d52d5
export LLVMLIBCXXTAG=48a89ecb9fd90f403ad8a7b061ff1bb18f34e132
export LLVMLIBCXXABITAG=9245d481eb3e890f708ff2d7dadf2a10c04748ba
export PERFTOOLSTAG=f47a52ce85c3d8d559aaae7b7a426c359fbca225
```

# Testing

The following test have been executed:

* SPEC2006 Int: Score 399
* make check