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

Side by Side Diff: lib/Analysis/NaCl/PNaClABIVerifyFunctions.cpp

Issue 11896044: Add remaining instructions to whitelist (Closed) Base URL: http://git.chromium.org/native_client/pnacl-llvm.git@master
Patch Set: Created 7 years, 11 months 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
« no previous file with comments | « no previous file | test/NaCl/PNaClABI/instructions.ll » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- PNaClABIVerifyFunctions.cpp - Verify PNaCl ABI rules --------===// 1 //===- PNaClABIVerifyFunctions.cpp - Verify PNaCl ABI rules --------===//
2 // 2 //
3 // The LLVM Compiler Infrastructure 3 // The LLVM Compiler Infrastructure
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 // Verify function-level PNaCl ABI requirements. 10 // Verify function-level PNaCl ABI requirements.
(...skipping 24 matching lines...) Expand all
35 virtual void print(llvm::raw_ostream &O, const Module *M) const {}; 35 virtual void print(llvm::raw_ostream &O, const Module *M) const {};
36 }; 36 };
37 } // and anonymous namespace 37 } // and anonymous namespace
38 38
39 bool PNaClABIVerifyFunctions::runOnFunction(Function &F) { 39 bool PNaClABIVerifyFunctions::runOnFunction(Function &F) {
40 for (Function::const_iterator FI = F.begin(), FE = F.end(); 40 for (Function::const_iterator FI = F.begin(), FE = F.end();
41 FI != FE; ++FI) { 41 FI != FE; ++FI) {
42 for (BasicBlock::const_iterator BBI = FI->begin(), BBE = FI->end(); 42 for (BasicBlock::const_iterator BBI = FI->begin(), BBE = FI->end();
43 BBI != BBE; ++BBI) { 43 BBI != BBE; ++BBI) {
44 switch (BBI->getOpcode()) { 44 switch (BBI->getOpcode()) {
45 // Disallowed instructions. Default is to disallow.
46 default:
47 // indirectbr may interfere with streaming
48 case Instruction::IndirectBr:
49 // No vector instructions yet
50 case Instruction::ExtractElement:
51 case Instruction::InsertElement:
52 case Instruction::ShuffleVector:
53 errs() << Twine("Function ") + F.getName() +
54 " has disallowed instruction: " +
55 BBI->getOpcodeName() + "\n";
56 break;
57
45 // Terminator instructions 58 // Terminator instructions
46 case Instruction::Ret: 59 case Instruction::Ret:
47 case Instruction::Br: 60 case Instruction::Br:
48 case Instruction::Switch: 61 case Instruction::Switch:
49 case Instruction::Resume: 62 case Instruction::Resume:
50 case Instruction::Unreachable: 63 case Instruction::Unreachable:
51 // indirectbr is not allowed for now. 64 case Instruction::Invoke:
52 // invoke and call are handled separately. 65 // Binary operations
66 case Instruction::Add:
67 case Instruction::FAdd:
68 case Instruction::Sub:
69 case Instruction::FSub:
70 case Instruction::Mul:
71 case Instruction::FMul:
72 case Instruction::UDiv:
73 case Instruction::SDiv:
74 case Instruction::FDiv:
75 case Instruction::URem:
76 case Instruction::SRem:
77 case Instruction::FRem:
78 // Bitwise binary operations
79 case Instruction::Shl:
80 case Instruction::LShr:
81 case Instruction::AShr:
82 case Instruction::And:
83 case Instruction::Or:
84 case Instruction::Xor:
85 case Instruction::ExtractValue:
86 case Instruction::InsertValue:
87 // Memory instructions
88 case Instruction::Alloca:
89 case Instruction::Load:
90 case Instruction::Store:
91 case Instruction::Fence:
92 case Instruction::AtomicCmpXchg:
93 case Instruction::AtomicRMW:
94 case Instruction::GetElementPtr:
95 // Conversion operations
96 case Instruction::Trunc:
97 case Instruction::ZExt:
98 case Instruction::SExt:
99 case Instruction::FPTrunc:
100 case Instruction::FPExt:
101 case Instruction::FPToUI:
102 case Instruction::FPToSI:
103 case Instruction::UIToFP:
104 case Instruction::SIToFP:
105 case Instruction::PtrToInt:
106 case Instruction::IntToPtr:
107 case Instruction::BitCast:
108 // Other operations
109 case Instruction::ICmp:
110 case Instruction::FCmp:
111 case Instruction::PHI:
112 case Instruction::Select:
113 case Instruction::Call:
114 case Instruction::VAArg:
115 case Instruction::LandingPad:
53 break; 116 break;
54 default:
55 errs() << Twine("Function ") + F.getName() +
56 " has disallowed instruction: " +
57 BBI->getOpcodeName() + "\n";
58 } 117 }
59 } 118 }
60 } 119 }
61 return false; 120 return false;
62 } 121 }
63 122
64 char PNaClABIVerifyFunctions::ID = 0; 123 char PNaClABIVerifyFunctions::ID = 0;
65 124
66 static RegisterPass<PNaClABIVerifyFunctions> X("verify-pnaclabi-functions", 125 static RegisterPass<PNaClABIVerifyFunctions> X("verify-pnaclabi-functions",
67 "Verify functions for PNaCl", false, false); 126 "Verify functions for PNaCl", false, false);
68 127
69 FunctionPass *llvm::createPNaClABIVerifyFunctionsPass() { 128 FunctionPass *llvm::createPNaClABIVerifyFunctionsPass() {
70 return new PNaClABIVerifyFunctions(); 129 return new PNaClABIVerifyFunctions();
71 } 130 }
OLDNEW
« no previous file with comments | « no previous file | test/NaCl/PNaClABI/instructions.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698