This repository has been archived by the owner on Feb 5, 2019. It is now read-only.
forked from luqmana/llvm
-
Notifications
You must be signed in to change notification settings - Fork 63
Squash of fastcomp commit 4105790f1549808c1f1daa5250b4ada5f41a5c02 #50
Merged
alexcrichton
merged 2 commits into
rust-lang:rust-llvm-2016-07-09
from
brson:fastcomp-squash
Sep 7, 2016
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -224,6 +224,7 @@ set(LLVM_ALL_TARGETS | |
ARM | ||
BPF | ||
Hexagon | ||
JSBackend # @LOCALMOD | ||
Mips | ||
MSP430 | ||
NVPTX | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
"1.36.9" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
//===-- NaCl.h - NaCl Analysis ---------------------------*- C++ -*-===// | ||
// | ||
// The LLVM Compiler Infrastructure | ||
// | ||
// This file is distributed under the University of Illinois Open Source | ||
// License. See LICENSE.TXT for details. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLVM_ANALYSIS_NACL_H | ||
#define LLVM_ANALYSIS_NACL_H | ||
|
||
#include "llvm/Support/CommandLine.h" | ||
#include "llvm/Support/ErrorHandling.h" | ||
#include "llvm/Support/raw_ostream.h" | ||
#include <string> | ||
|
||
namespace llvm { | ||
|
||
class FunctionPass; | ||
class ModulePass; | ||
extern cl::opt<bool> PNaClABIAllowDebugMetadata; | ||
|
||
class PNaClABIErrorReporter { | ||
PNaClABIErrorReporter(const PNaClABIErrorReporter&) = delete; | ||
void operator=(const PNaClABIErrorReporter&) = delete; | ||
public: | ||
PNaClABIErrorReporter() : ErrorCount(0), Errors(ErrorString), | ||
UseFatalErrors(true) {} | ||
~PNaClABIErrorReporter() {} | ||
// Return the number of verification errors from the last run. | ||
int getErrorCount() const { return ErrorCount; } | ||
// Print the error messages to O | ||
void printErrors(llvm::raw_ostream &O) { | ||
Errors.flush(); | ||
O << ErrorString; | ||
} | ||
// Increments the error count and returns an ostream to which the error | ||
// message can be streamed. | ||
raw_ostream &addError() { | ||
ErrorCount++; | ||
return Errors; | ||
} | ||
// Reset the error count and error messages. | ||
void reset() { | ||
ErrorCount = 0; | ||
Errors.flush(); | ||
ErrorString.clear(); | ||
} | ||
void setNonFatal() { | ||
UseFatalErrors = false; | ||
} | ||
void checkForFatalErrors() { | ||
if (UseFatalErrors && ErrorCount != 0) { | ||
printErrors(errs()); | ||
report_fatal_error("PNaCl ABI verification failed"); | ||
} | ||
} | ||
private: | ||
int ErrorCount; | ||
std::string ErrorString; | ||
raw_string_ostream Errors; | ||
bool UseFatalErrors; | ||
}; | ||
|
||
FunctionPass *createPNaClABIVerifyFunctionsPass( | ||
PNaClABIErrorReporter *Reporter); | ||
ModulePass *createPNaClABIVerifyModulePass(PNaClABIErrorReporter *Reporter, | ||
bool StreamingMode = false); | ||
|
||
} | ||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
//===-- llvm/IR/NaClAtomicIntrinsics.h - NaCl Atomic Intrinsics -*- C++ -*-===// | ||
// | ||
// The LLVM Compiler Infrastructure | ||
// | ||
// This file is distributed under the University of Illinois Open Source | ||
// License. See LICENSE.TXT for details. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This file describes atomic intrinsic functions that are specific to NaCl. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLVM_IR_NACL_ATOMIC_INTRINSICS_H | ||
#define LLVM_IR_NACL_ATOMIC_INTRINSICS_H | ||
|
||
#include "llvm/IR/Intrinsics.h" | ||
#include "llvm/Support/Compiler.h" | ||
#include <cstddef> | ||
|
||
namespace llvm { | ||
|
||
namespace NaCl { | ||
|
||
static const size_t NumAtomicIntrinsics = 6; | ||
static const size_t NumAtomicIntrinsicOverloadTypes = 4; | ||
static const size_t MaxAtomicIntrinsicsParameters = 5; | ||
|
||
/// Describe all the atomic intrinsics and their type signature. Most | ||
/// can be overloaded on a type. | ||
class AtomicIntrinsics { | ||
public: | ||
enum ParamType { | ||
NoP, /// No parameter. | ||
Int, /// Overloaded. | ||
Ptr, /// Overloaded. | ||
RMW, /// Atomic RMW operation type. | ||
Mem /// Memory order. | ||
}; | ||
|
||
struct AtomicIntrinsic { | ||
Type *OverloadedType; | ||
Intrinsic::ID ID; | ||
uint8_t Overloaded : 1; | ||
uint8_t NumParams : 7; | ||
uint8_t ParamType[MaxAtomicIntrinsicsParameters]; | ||
|
||
Function *getDeclaration(Module *M) const { | ||
// The atomic intrinsic can be overloaded on zero or one type, | ||
// which is needed to create the function's declaration. | ||
return Intrinsic::getDeclaration( | ||
M, ID, ArrayRef<Type *>(&OverloadedType, Overloaded ? 1 : 0)); | ||
} | ||
}; | ||
|
||
AtomicIntrinsics(LLVMContext &C); | ||
~AtomicIntrinsics() {} | ||
|
||
typedef ArrayRef<AtomicIntrinsic> View; | ||
|
||
/// Access all atomic intrinsics, which can then be iterated over. | ||
View allIntrinsicsAndOverloads() const; | ||
/// Access a particular atomic intrinsic. | ||
/// \returns 0 if no intrinsic was found. | ||
const AtomicIntrinsic *find(Intrinsic::ID ID, Type *OverloadedType) const; | ||
|
||
private: | ||
AtomicIntrinsic I[NumAtomicIntrinsics][NumAtomicIntrinsicOverloadTypes]; | ||
|
||
AtomicIntrinsics() = delete; | ||
AtomicIntrinsics(const AtomicIntrinsics &) = delete; | ||
AtomicIntrinsics &operator=(const AtomicIntrinsics &) = delete; | ||
}; | ||
|
||
/// Operations that can be represented by the @llvm.nacl.atomic.rmw | ||
/// intrinsic. | ||
/// | ||
/// Do not reorder these values: their order offers forward | ||
/// compatibility of bitcode targeted to NaCl. | ||
enum AtomicRMWOperation { | ||
AtomicInvalid = 0, // Invalid, keep first. | ||
AtomicAdd, | ||
AtomicSub, | ||
AtomicOr, | ||
AtomicAnd, | ||
AtomicXor, | ||
AtomicExchange, | ||
AtomicNum // Invalid, keep last. | ||
}; | ||
|
||
/// Memory orderings supported by C11/C++11. | ||
/// | ||
/// Do not reorder these values: their order offers forward | ||
/// compatibility of bitcode targeted to NaCl. | ||
enum MemoryOrder { | ||
MemoryOrderInvalid = 0, // Invalid, keep first. | ||
MemoryOrderRelaxed, | ||
MemoryOrderConsume, | ||
MemoryOrderAcquire, | ||
MemoryOrderRelease, | ||
MemoryOrderAcquireRelease, | ||
MemoryOrderSequentiallyConsistent, | ||
MemoryOrderNum // Invalid, keep last. | ||
}; | ||
|
||
} // End NaCl namespace | ||
|
||
} // End llvm namespace | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So just to confirm, we currently believe that these passes will only run for the emscripten target? That is, if we generate x86_64 linux code, these'll all be turned off by default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the only place those initialize* methods are called is in the asmjs backend. They can't affect normal builds.