blob: 92754f052285791d5bfd28bc8c96c94e25fbf133 [file] [log] [blame]
Zonr Chang2fcbd022012-01-06 21:04:31 +08001/*
2 * Copyright 2010, The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef BCC_COMPILER_OPTION_H
18#define BCC_COMPILER_OPTION_H
19
20#include "Config.h"
21
22#include "llvm/Target/TargetOptions.h"
23#include "llvm/Support/CodeGen.h"
24
25namespace bcc {
26
27typedef struct CompilerOption {
28 llvm::TargetOptions TargetOpt;
29 llvm::CodeModel::Model CodeModelOpt;
30 llvm::Reloc::Model RelocModelOpt;
31 bool LoadAfterCompile;
32
33 // Constructor setup "default configuration". The "default configuration"
34 // here means the configuration for running RenderScript (more specifically,
35 // one can declare a CompilerOption object (call default constructor) and then
36 // pass to the Compiler::compiler() without any modification for RenderScript,
37 // see Script::prepareExecutable(...))
38 CompilerOption() {
39 //-- Setup options to llvm::TargetMachine --//
40
41 // Use hardfloat ABI
42 //
43 // TODO(all): Need to detect the CPU capability and decide whether to use
44 // softfp. To use softfp, change following 2 lines to
45 //
46 // options.FloatABIType = llvm::FloatABI::Soft;
47 // options.UseSoftFloat = true;
48 TargetOpt.FloatABIType = llvm::FloatABI::Soft;
49 TargetOpt.UseSoftFloat = false;
50
51 //-- Setup relocation model --//
52 RelocModelOpt = llvm::Reloc::Static;
53
54 //-- Load the result object after successful compilation --//
55 LoadAfterCompile = true;
56 }
57} CompilerOption;
58
59} // namespace bcc
60
61#endif // BCC_COMPILER_OPTION_H