Skip to content

Commit c18c9be

Browse files
elibenRichard Diamond
authored andcommitted
Make it compile
(cherry picked from commit 8967110) Conflicts: lib/Target/Mips/MipsISelLowering.cpp lib/Target/X86/X86FastISel.cpp lib/Target/X86/X86ISelLowering.cpp tools/llvm-extract/llvm-extract.cpp tools/lto/LTOCodeGenerator.cpp tools/opt/opt.cpp tools/pnacl-llc/pnacl-llc.cpp
1 parent 536ab9c commit c18c9be

File tree

6 files changed

+71
-5
lines changed

6 files changed

+71
-5
lines changed

lib/Linker/LinkModules.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "llvm/IR/TypeFinder.h"
2222
#include "llvm/Support/CommandLine.h"
2323
#include "llvm/Support/Debug.h"
24+
#include "llvm/Support/Path.h" // @LOCALMOD
2425
#include "llvm/Support/raw_ostream.h"
2526
#include "llvm/Transforms/Utils/Cloning.h"
2627
#include <cctype>

lib/Target/ARM/ARMInstrInfo.td

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1661,6 +1661,41 @@ multiclass AI_str1nopc<bit isByte, string opc, InstrItinClass iii,
16611661
// Instructions
16621662
//===----------------------------------------------------------------------===//
16631663

1664+
// @LOCALMOD-START
1665+
1666+
def SFI_GUARD_LOADSTORE :
1667+
PseudoInst<(outs GPR:$dst), (ins GPR:$a, pred:$p), NoItinerary, []>;
1668+
1669+
let Defs = [CPSR] in
1670+
def SFI_GUARD_LOADSTORE_TST :
1671+
PseudoInst<(outs), (ins GPR:$a), NoItinerary, []>;
1672+
1673+
// Like SFI_GUARD_LOADSTORE, but reserved for loads into SP.
1674+
def SFI_GUARD_SP_LOAD :
1675+
PseudoInst<(outs GPR:$dst), (ins GPR:$src, pred:$p), NoItinerary, []>;
1676+
1677+
def SFI_GUARD_INDIRECT_CALL :
1678+
PseudoInst<(outs GPR:$dst), (ins GPR:$a, pred:$p), NoItinerary, []>;
1679+
1680+
def SFI_GUARD_INDIRECT_JMP :
1681+
PseudoInst<(outs GPR:$dst), (ins GPR:$a, pred:$p), NoItinerary, []>;
1682+
1683+
def SFI_GUARD_CALL :
1684+
PseudoInst<(outs), (ins pred:$p), NoItinerary, []>;
1685+
1686+
// NOTE: the BX_RET instruction hardcodes lr as well
1687+
def SFI_GUARD_RETURN :
1688+
PseudoInst<(outs), (ins pred:$p), NoItinerary, []>;
1689+
1690+
def SFI_NOP_IF_AT_BUNDLE_END :
1691+
PseudoInst<(outs), (ins), NoItinerary, []>;
1692+
1693+
// Note: intention is that $src and $dst are the same register.
1694+
def SFI_DATA_MASK :
1695+
PseudoInst<(outs GPR:$dst), (ins GPR:$src, pred:$p), NoItinerary, []>;
1696+
1697+
// @LOCALMOD-END
1698+
16641699
//===----------------------------------------------------------------------===//
16651700
// Miscellaneous Instructions.
16661701
//

lib/Target/ARM/ARMSubtarget.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727

2828
using namespace llvm;
2929

30-
static cl::opt<bool>
30+
// @LOCALMOD: remove 'static' to make this flag visible elsewhere
31+
cl::opt<bool>
3132
ReserveR9("arm-reserve-r9", cl::Hidden,
3233
cl::desc("Reserve R9, making it unavailable as GPR"));
3334

lib/Target/X86/X86ISelLowering.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1909,9 +1909,6 @@ X86TargetLowering::LowerReturn(SDValue Chain,
19091909
"SRetReturnReg should have been set in LowerFormalArguments().");
19101910
SDValue Val = DAG.getCopyFromReg(Chain, dl, Reg, getPointerTy());
19111911

1912-
unsigned RetValReg
1913-
= (Subtarget->is64Bit() && !Subtarget->isTarget64BitILP32()) ?
1914-
X86::RAX : X86::EAX;
19151912
Chain = DAG.getCopyToReg(Chain, dl, RetValReg, Val, Flag);
19161913
Flag = Chain.getValue(1);
19171914

tools/opt/opt.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
#include "llvm/Analysis/LoopPass.h"
2222
#include "llvm/Analysis/RegionPass.h"
2323
#include "llvm/Bitcode/BitcodeWriterPass.h"
24+
#include "llvm/Analysis/Verifier.h"
25+
#include "llvm/Assembly/PrintModulePass.h"
26+
#include "llvm/Bitcode/ReaderWriter.h"
27+
#include "llvm/Bitcode/NaCl/NaClReaderWriter.h" // @LOCALMOD
2428
#include "llvm/CodeGen/CommandFlags.h"
2529
#include "llvm/DebugInfo.h"
2630
#include "llvm/IR/DataLayout.h"
@@ -197,6 +201,17 @@ DefaultDataLayout("default-data-layout",
197201
cl::desc("data layout string to use if not specified by module"),
198202
cl::value_desc("layout-string"), cl::init(""));
199203

204+
// @LOCALMOD-BEGIN
205+
static cl::opt<NaClFileFormat>
206+
OutputFileFormat(
207+
"bitcode-format",
208+
cl::desc("Define format of generated bitcode file:"),
209+
cl::values(
210+
clEnumValN(LLVMFormat, "llvm", "LLVM bitcode file (default)"),
211+
clEnumValN(PNaClFormat, "pnacl", "PNaCl bitcode file"),
212+
clEnumValEnd),
213+
cl::init(LLVMFormat));
214+
// @LOCALMOD-END
200215
namespace {
201216

202217
struct BreakpointPrinter : public ModulePass {
@@ -756,6 +771,23 @@ int main(int argc, char **argv) {
756771
// Now that we have all of the passes ready, run them.
757772
Passes.run(*M.get());
758773

774+
// @LOCALMOD-BEGIN
775+
// Write bitcode to the output.
776+
if (!NoOutput && !AnalyzeOnly && !OutputAssembly) {
777+
switch (OutputFileFormat) {
778+
case LLVMFormat:
779+
WriteBitcodeToFile(M.get(), Out->os());
780+
break;
781+
case PNaClFormat:
782+
NaClWriteBitcodeToFile(M.get(), Out->os());
783+
break;
784+
default:
785+
errs() << "Don't understand bitcode format for generated bitcode.\n";
786+
return 1;
787+
}
788+
}
789+
// @LOCALMOD-END
790+
759791
// Declare success.
760792
if (!NoOutput || PrintBreakpoints)
761793
Out->keep();

tools/pnacl-abicheck/pnacl-abicheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include "llvm/Pass.h"
2020
#include "llvm/Support/CommandLine.h"
2121
#include "llvm/Support/FormattedStream.h"
22-
#include "llvm/Support/IRReader.h"
22+
#include "llvm/Support/SourceMgr.h"
2323
#include <string>
2424

2525
using namespace llvm;

0 commit comments

Comments
 (0)