Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/IceTargetLoweringMIPS32.cpp

Issue 1506653002: Subzero: Add Non-SFI support for x86-32. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fill in part of the lit test Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 //===- subzero/src/IceTargetLoweringMIPS32.cpp - MIPS32 lowering ----------===// 1 //===- subzero/src/IceTargetLoweringMIPS32.cpp - MIPS32 lowering ----------===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 /// 9 ///
10 /// \file 10 /// \file
(...skipping 25 matching lines...) Expand all
36 36
37 namespace { 37 namespace {
38 38
39 // The maximum number of arguments to pass in GPR registers. 39 // The maximum number of arguments to pass in GPR registers.
40 constexpr uint32_t MIPS32_MAX_GPR_ARG = 4; 40 constexpr uint32_t MIPS32_MAX_GPR_ARG = 4;
41 41
42 } // end of anonymous namespace 42 } // end of anonymous namespace
43 43
44 TargetMIPS32::TargetMIPS32(Cfg *Func) : TargetLowering(Func) {} 44 TargetMIPS32::TargetMIPS32(Cfg *Func) : TargetLowering(Func) {}
45 45
46 void TargetMIPS32::staticInit() { 46 void TargetMIPS32::staticInit(const ClFlags &Flags) {
47 (void)Flags;
47 llvm::SmallBitVector IntegerRegisters(RegMIPS32::Reg_NUM); 48 llvm::SmallBitVector IntegerRegisters(RegMIPS32::Reg_NUM);
48 llvm::SmallBitVector I64PairRegisters(RegMIPS32::Reg_NUM); 49 llvm::SmallBitVector I64PairRegisters(RegMIPS32::Reg_NUM);
49 llvm::SmallBitVector Float32Registers(RegMIPS32::Reg_NUM); 50 llvm::SmallBitVector Float32Registers(RegMIPS32::Reg_NUM);
50 llvm::SmallBitVector Float64Registers(RegMIPS32::Reg_NUM); 51 llvm::SmallBitVector Float64Registers(RegMIPS32::Reg_NUM);
51 llvm::SmallBitVector VectorRegisters(RegMIPS32::Reg_NUM); 52 llvm::SmallBitVector VectorRegisters(RegMIPS32::Reg_NUM);
52 llvm::SmallBitVector InvalidRegisters(RegMIPS32::Reg_NUM); 53 llvm::SmallBitVector InvalidRegisters(RegMIPS32::Reg_NUM);
53 ScratchRegs.resize(RegMIPS32::Reg_NUM); 54 ScratchRegs.resize(RegMIPS32::Reg_NUM);
54 #define X(val, encode, name, scratch, preserved, stackptr, frameptr, isInt, \ 55 #define X(val, encode, name, scratch, preserved, stackptr, frameptr, isInt, \
55 isI64Pair, isFP32, isFP64, isVec128, alias_init) \ 56 isI64Pair, isFP32, isFP64, isVec128, alias_init) \
56 IntegerRegisters[RegMIPS32::val] = isInt; \ 57 IntegerRegisters[RegMIPS32::val] = isInt; \
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 void ConstantUndef::emit(GlobalContext *) const { 955 void ConstantUndef::emit(GlobalContext *) const {
955 llvm_unreachable("undef value encountered by emitter."); 956 llvm_unreachable("undef value encountered by emitter.");
956 } 957 }
957 */ 958 */
958 959
959 TargetDataMIPS32::TargetDataMIPS32(GlobalContext *Ctx) 960 TargetDataMIPS32::TargetDataMIPS32(GlobalContext *Ctx)
960 : TargetDataLowering(Ctx) {} 961 : TargetDataLowering(Ctx) {}
961 962
962 void TargetDataMIPS32::lowerGlobals(const VariableDeclarationList &Vars, 963 void TargetDataMIPS32::lowerGlobals(const VariableDeclarationList &Vars,
963 const IceString &SectionSuffix) { 964 const IceString &SectionSuffix) {
965 const bool IsPIC = Ctx->getFlags().getUseNonsfi();
964 switch (Ctx->getFlags().getOutFileType()) { 966 switch (Ctx->getFlags().getOutFileType()) {
965 case FT_Elf: { 967 case FT_Elf: {
966 ELFObjectWriter *Writer = Ctx->getObjectWriter(); 968 ELFObjectWriter *Writer = Ctx->getObjectWriter();
967 Writer->writeDataSection(Vars, llvm::ELF::R_MIPS_GLOB_DAT, SectionSuffix); 969 Writer->writeDataSection(Vars, llvm::ELF::R_MIPS_GLOB_DAT, SectionSuffix,
970 IsPIC);
968 } break; 971 } break;
969 case FT_Asm: 972 case FT_Asm:
970 case FT_Iasm: { 973 case FT_Iasm: {
971 const IceString &TranslateOnly = Ctx->getFlags().getTranslateOnly(); 974 const IceString &TranslateOnly = Ctx->getFlags().getTranslateOnly();
972 OstreamLocker L(Ctx); 975 OstreamLocker L(Ctx);
973 for (const VariableDeclaration *Var : Vars) { 976 for (const VariableDeclaration *Var : Vars) {
974 if (GlobalContext::matchSymbolName(Var->getName(), TranslateOnly)) { 977 if (GlobalContext::matchSymbolName(Var->getName(), TranslateOnly)) {
975 emitGlobal(*Var, SectionSuffix); 978 emitGlobal(*Var, SectionSuffix);
976 } 979 }
977 } 980 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 << "nomicromips\n"; 1079 << "nomicromips\n";
1077 Str << "\t.set\t" 1080 Str << "\t.set\t"
1078 << "nomips16\n"; 1081 << "nomips16\n";
1079 } 1082 }
1080 1083
1081 llvm::SmallBitVector TargetMIPS32::TypeToRegisterSet[IceType_NUM]; 1084 llvm::SmallBitVector TargetMIPS32::TypeToRegisterSet[IceType_NUM];
1082 llvm::SmallBitVector TargetMIPS32::RegisterAliases[RegMIPS32::Reg_NUM]; 1085 llvm::SmallBitVector TargetMIPS32::RegisterAliases[RegMIPS32::Reg_NUM];
1083 llvm::SmallBitVector TargetMIPS32::ScratchRegs; 1086 llvm::SmallBitVector TargetMIPS32::ScratchRegs;
1084 1087
1085 } // end of namespace Ice 1088 } // end of namespace Ice
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698