1 //===- AlphaSubtarget.cpp - Alpha Subtarget Information ---------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by Andrew Lenharth and is distributed under the
6 // University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file implements the Alpha specific subclass of TargetSubtarget.
12 //===----------------------------------------------------------------------===//
14 #include "AlphaSubtarget.h"
16 #include "llvm/Module.h"
17 #include "llvm/Support/CommandLine.h"
18 #include "llvm/Target/SubtargetFeature.h"
19 #include "llvm/Support/Debug.h"
24 AlphaFeatureCIX = 1 << 0,
25 AlphaFeatureFIX = 1 << 1,
28 /// Sorted (by key) array of values for CPU subtype.
29 static const SubtargetFeatureKV AlphaSubTypeKV[] = {
30 { "ev56" , "Select the Alpha EV56 processor", 0 },
31 { "ev6" , "Select the Alpha EV6 processor", AlphaFeatureFIX },
32 { "ev67" , "Select the Alpha EV67 processor", AlphaFeatureFIX | AlphaFeatureCIX },
33 { "generic", "Select instructions for a generic Alpha processor (EV56)", 0 },
34 { "pca56" , "Select the Alpha PCA56 processor", 0 },
37 /// Length of AlphaSubTypeKV.
38 static const unsigned AlphaSubTypeKVSize = sizeof(AlphaSubTypeKV)
39 / sizeof(SubtargetFeatureKV);
41 /// Sorted (by key) array of values for CPU features.
42 static SubtargetFeatureKV AlphaFeatureKV[] = {
43 { "CIX", "Should CIX extentions be used" , AlphaFeatureCIX },
44 { "FIX" , "Should FIX extentions be used" , AlphaFeatureFIX },
46 /// Length of AlphaFeatureKV.
47 static const unsigned AlphaFeatureKVSize = sizeof(AlphaFeatureKV)
48 / sizeof(SubtargetFeatureKV);
50 AlphaSubtarget::AlphaSubtarget(const Module &M, const std::string &FS)
51 :HasF2I(false), HasCT(false)
53 std::string CPU = "generic";
55 SubtargetFeatures::Parse(FS, CPU,
56 AlphaSubTypeKV, AlphaSubTypeKVSize,
57 AlphaFeatureKV, AlphaFeatureKVSize);
58 HasF2I = (Bits & AlphaFeatureFIX) != 0;
59 HasCT = (Bits & AlphaFeatureCIX) != 0;