Commit fd8ea7ce authored by Kevin Modzelewski's avatar Kevin Modzelewski

Run 'make format'

I think the new version of LLVM changed clang-format, and
it reformatted parts of the Pyston codebase.
Maybe we should pin the rev for clang-format?
parent e8120fb1
...@@ -297,8 +297,8 @@ private: ...@@ -297,8 +297,8 @@ private:
CompilerType* right = getType(node->comparators[0]); CompilerType* right = getType(node->comparators[0]);
AST_TYPE::AST_TYPE op_type = node->ops[0]; AST_TYPE::AST_TYPE op_type = node->ops[0];
if (op_type == AST_TYPE::Is || op_type == AST_TYPE::IsNot || op_type == AST_TYPE::In || op_type if (op_type == AST_TYPE::Is || op_type == AST_TYPE::IsNot || op_type == AST_TYPE::In
== AST_TYPE::NotIn) { || op_type == AST_TYPE::NotIn) {
assert(node->ops.size() == 1 && "I don't think this should happen"); assert(node->ops.size() == 1 && "I don't think this should happen");
return BOOL; return BOOL;
} }
......
...@@ -203,8 +203,8 @@ void registerCompiledPatchpoint(uint8_t* start_addr, PatchpointSetupInfo* pp, St ...@@ -203,8 +203,8 @@ void registerCompiledPatchpoint(uint8_t* start_addr, PatchpointSetupInfo* pp, St
uint8_t* rtn_addr; uint8_t* rtn_addr;
assembler::GenericRegister return_register; assembler::GenericRegister return_register;
assert(pp->getCallingConvention() == llvm::CallingConv::C || pp->getCallingConvention() assert(pp->getCallingConvention() == llvm::CallingConv::C
== llvm::CallingConv::PreserveAll); || pp->getCallingConvention() == llvm::CallingConv::PreserveAll);
if (pp->hasReturnValue()) { if (pp->hasReturnValue()) {
static const int DWARF_RAX = 0; static const int DWARF_RAX = 0;
// It's possible that the return value doesn't get used, in which case // It's possible that the return value doesn't get used, in which case
......
...@@ -38,35 +38,37 @@ const bool is_callee_save[] = { ...@@ -38,35 +38,37 @@ const bool is_callee_save[] = {
false, false, false, false, false, false, true, true, true, true, false, false, false, false, false, false, true, true, true, true,
}; };
const int DwarfRegToX86[] = { 0, // 0 const int DwarfRegToX86[] = {
2, // 1 0, // 0
1, // 2 -> rcx 2, // 1
3, // 3 -> rbx 1, // 2 -> rcx
6, // 4 3, // 3 -> rbx
7, // 5 6, // 4
5, // 6 7, // 5
4, // 7 5, // 6
8, // 8 -> r8 4, // 7
9, // 9 -> r9 8, // 8 -> r8
10, // 10 -> r10 9, // 9 -> r9
11, // 11 -> r11 10, // 10 -> r10
12, // 12 -> r12 11, // 11 -> r11
13, // 13 -> r13 12, // 12 -> r12
14, // 14 -> r14 13, // 13 -> r13
15, // 15 -> r15 14, // 14 -> r14
15, // 15 -> r15
// http://www.x86-64.org/documentation/abi.pdf#page=57
// 16 -> ReturnAddress RA (??) // http://www.x86-64.org/documentation/abi.pdf#page=57
// 17-32: xmm0-xmm15 // 16 -> ReturnAddress RA (??)
// 17-32: xmm0-xmm15
}; };
const int NUM_ARG_REGS = 6; const int NUM_ARG_REGS = 6;
const int arg_regs[] = { 7, // rdi const int arg_regs[] = {
6, // rsi 7, // rdi
2, // rdx 6, // rsi
1, // rcx 2, // rdx
8, // r8 1, // rcx
9, // r9 8, // r8
9, // r9
}; };
const uint8_t REX_B = 1, REX_X = 2, REX_R = 4, REX_W = 8; const uint8_t REX_B = 1, REX_X = 2, REX_R = 4, REX_W = 8;
...@@ -556,8 +558,8 @@ private: ...@@ -556,8 +558,8 @@ private:
} }
virtual void _emitGuard(int argnum, int64_t value, int npops, X86::ConditionCode slowpath_condition) { virtual void _emitGuard(int argnum, int64_t value, int npops, X86::ConditionCode slowpath_condition) {
assert(slowpath_condition == X86::COND_EQUAL || slowpath_condition == X86::COND_NOT_EQUAL assert(slowpath_condition == X86::COND_EQUAL
&& "not sure if the cmp operands are in the right order"); || slowpath_condition == X86::COND_NOT_EQUAL && "not sure if the cmp operands are in the right order");
assert(argnum <= X86::NUM_ARG_REGS); assert(argnum <= X86::NUM_ARG_REGS);
int argreg = convertArgnum(argnum); int argreg = convertArgnum(argnum);
...@@ -581,8 +583,8 @@ private: ...@@ -581,8 +583,8 @@ private:
virtual void _emitAttrGuard(int argnum, int offset, int64_t value, int npops, virtual void _emitAttrGuard(int argnum, int offset, int64_t value, int npops,
X86::ConditionCode slowpath_condition) { X86::ConditionCode slowpath_condition) {
assert(slowpath_condition == X86::COND_EQUAL || slowpath_condition == X86::COND_NOT_EQUAL assert(slowpath_condition == X86::COND_EQUAL
&& "not sure if the cmp operands are in the right order"); || slowpath_condition == X86::COND_NOT_EQUAL && "not sure if the cmp operands are in the right order");
assert(argnum <= X86::NUM_ARG_REGS); assert(argnum <= X86::NUM_ARG_REGS);
int argreg = convertArgnum(argnum); int argreg = convertArgnum(argnum);
......
...@@ -84,7 +84,6 @@ extern GlobalState g; ...@@ -84,7 +84,6 @@ extern GlobalState g;
void initGlobalFuncs(GlobalState& g); void initGlobalFuncs(GlobalState& g);
const LineInfo* getLineInfoFor(uint64_t inst_addr); const LineInfo* getLineInfoFor(uint64_t inst_addr);
} }
#endif #endif
...@@ -224,7 +224,8 @@ void initCodegen() { ...@@ -224,7 +224,8 @@ void initCodegen() {
// There are some parts of llvm that are only configurable through command line args, // There are some parts of llvm that are only configurable through command line args,
// so construct a fake argc/argv pair and pass it to the llvm command line machinery: // so construct a fake argc/argv pair and pass it to the llvm command line machinery:
const char* llvm_args[] = { "fake_name", "--enable-stackmap-liveness", "--enable-patchpoint-liveness", const char* llvm_args[] = {
"fake_name", "--enable-stackmap-liveness", "--enable-patchpoint-liveness",
// Enabling and debugging fast-isel: // Enabling and debugging fast-isel:
//"--fast-isel", //"--fast-isel",
...@@ -235,8 +236,8 @@ void initCodegen() { ...@@ -235,8 +236,8 @@ void initCodegen() {
//"--debug-only=regalloc", //"--debug-only=regalloc",
//"--debug-only=stackmaps", //"--debug-only=stackmaps",
#endif #endif
//"--print-after-all", //"--print-after-all",
//"--print-machineinstrs", //"--print-machineinstrs",
}; };
int num_llvm_args = sizeof(llvm_args) / sizeof(llvm_args[0]); int num_llvm_args = sizeof(llvm_args) / sizeof(llvm_args[0]);
llvm::cl::ParseCommandLineOptions(num_llvm_args, llvm_args, "<you should never see this>\n"); llvm::cl::ParseCommandLineOptions(num_llvm_args, llvm_args, "<you should never see this>\n");
......
...@@ -505,15 +505,16 @@ static void emitBBs(IRGenState* irstate, const char* bb_type, GuardList& out_gua ...@@ -505,15 +505,16 @@ static void emitBBs(IRGenState* irstate, const char* bb_type, GuardList& out_gua
} else if (block == source->cfg->getStartingBlock()) { } else if (block == source->cfg->getStartingBlock()) {
assert(entry_descriptor == NULL); assert(entry_descriptor == NULL);
// number of times a function needs to be called to be reoptimized: // number of times a function needs to be called to be reoptimized:
static const int REOPT_THRESHOLDS[] = { 10, // INTERPRETED->MINIMAL static const int REOPT_THRESHOLDS[] = {
250, // MINIMAL->MODERATE 10, // INTERPRETED->MINIMAL
10000, // MODERATE->MAXIMAL 250, // MINIMAL->MODERATE
10000, // MODERATE->MAXIMAL
}; };
assert(strcmp("opt", bb_type) == 0); assert(strcmp("opt", bb_type) == 0);
if (ENABLE_REOPT && effort < EffortLevel::MAXIMAL && source->ast != NULL && source->ast->type if (ENABLE_REOPT && effort < EffortLevel::MAXIMAL && source->ast != NULL
!= AST_TYPE::Module) { && source->ast->type != AST_TYPE::Module) {
llvm::BasicBlock* preentry_bb llvm::BasicBlock* preentry_bb
= llvm::BasicBlock::Create(g.context, "pre_entry", irstate->getLLVMFunction(), = llvm::BasicBlock::Create(g.context, "pre_entry", irstate->getLLVMFunction(),
llvm_entry_blocks[source->cfg->getStartingBlock()]); llvm_entry_blocks[source->cfg->getStartingBlock()]);
......
...@@ -946,9 +946,10 @@ private: ...@@ -946,9 +946,10 @@ private:
} }
CompilerVariable* evalExpr(AST_expr* node, ExcInfo exc_info) { CompilerVariable* evalExpr(AST_expr* node, ExcInfo exc_info) {
//printf("%d expr: %d\n", node->type, node->lineno); // printf("%d expr: %d\n", node->type, node->lineno);
if (node->lineno) { if (node->lineno) {
emitter.getBuilder()->SetCurrentDebugLocation(llvm::DebugLoc::get(node->lineno, 0, irstate->getFuncDbgInfo())); emitter.getBuilder()->SetCurrentDebugLocation(
llvm::DebugLoc::get(node->lineno, 0, irstate->getFuncDbgInfo()));
} }
CompilerVariable* rtn = NULL; CompilerVariable* rtn = NULL;
...@@ -1762,9 +1763,10 @@ private: ...@@ -1762,9 +1763,10 @@ private:
} }
void doStmt(AST* node, ExcInfo exc_info) { void doStmt(AST* node, ExcInfo exc_info) {
//printf("%d stmt: %d\n", node->type, node->lineno); // printf("%d stmt: %d\n", node->type, node->lineno);
if (node->lineno) { if (node->lineno) {
emitter.getBuilder()->SetCurrentDebugLocation(llvm::DebugLoc::get(node->lineno, 0, irstate->getFuncDbgInfo())); emitter.getBuilder()->SetCurrentDebugLocation(
llvm::DebugLoc::get(node->lineno, 0, irstate->getFuncDbgInfo()));
} }
switch (node->type) { switch (node->type) {
......
...@@ -255,7 +255,7 @@ const LineInfo* getLineInfoForInterpretedFrame(void* frame_ptr) { ...@@ -255,7 +255,7 @@ const LineInfo* getLineInfoForInterpretedFrame(void* frame_ptr) {
llvm::DISubprogram subprog(debug_loc.getScope(g.context)); llvm::DISubprogram subprog(debug_loc.getScope(g.context));
// TODO better lifetime management // TODO better lifetime management
LineInfo *rtn = new LineInfo(debug_loc.getLine(), debug_loc.getCol(), subprog.getFilename(), subprog.getName()); LineInfo* rtn = new LineInfo(debug_loc.getLine(), debug_loc.getCol(), subprog.getFilename(), subprog.getName());
line_infos.insert(it, std::make_pair(cur_instruction, rtn)); line_infos.insert(it, std::make_pair(cur_instruction, rtn));
return rtn; return rtn;
} else { } else {
......
...@@ -29,7 +29,6 @@ Box* interpretFunction(llvm::Function* f, int nargs, Box* arg1, Box* arg2, Box* ...@@ -29,7 +29,6 @@ Box* interpretFunction(llvm::Function* f, int nargs, Box* arg1, Box* arg2, Box*
void gatherInterpreterRootsForFrame(GCVisitor* visitor, void* frame_ptr); void gatherInterpreterRootsForFrame(GCVisitor* visitor, void* frame_ptr);
const LineInfo* getLineInfoForInterpretedFrame(void* frame_ptr); const LineInfo* getLineInfoForInterpretedFrame(void* frame_ptr);
} }
#endif #endif
...@@ -76,9 +76,7 @@ private: ...@@ -76,9 +76,7 @@ private:
struct LineTableRegistryEntry { struct LineTableRegistryEntry {
const uint64_t addr, size; const uint64_t addr, size;
std::vector<std::pair<uint64_t, LineInfo> > linetable; std::vector<std::pair<uint64_t, LineInfo> > linetable;
LineTableRegistryEntry(uint64_t addr, uint64_t size) : LineTableRegistryEntry(uint64_t addr, uint64_t size) : addr(addr), size(size) {}
addr(addr), size(size) {
}
}; };
std::vector<LineTableRegistryEntry> entries; std::vector<LineTableRegistryEntry> entries;
...@@ -89,7 +87,9 @@ public: ...@@ -89,7 +87,9 @@ public:
auto& entry = entries.back(); auto& entry = entries.back();
for (int i = 0; i < lines.size(); i++) { for (int i = 0; i < lines.size(); i++) {
entry.linetable.push_back(std::make_pair(lines[i].first, LineInfo(lines[i].second.Line, lines[i].second.Column, lines[i].second.FileName, lines[i].second.FunctionName))); entry.linetable.push_back(
std::make_pair(lines[i].first, LineInfo(lines[i].second.Line, lines[i].second.Column,
lines[i].second.FileName, lines[i].second.FunctionName)));
} }
} }
...@@ -135,19 +135,20 @@ public: ...@@ -135,19 +135,20 @@ public:
if (I->getSize(Size)) if (I->getSize(Size))
continue; continue;
// TODO this should be the Python name, not the C name: // TODO this should be the Python name, not the C name:
#if LLVMREV < 208921 #if LLVMREV < 208921
llvm::DILineInfoTable lines = Context->getLineInfoForAddressRange( llvm::DILineInfoTable lines = Context->getLineInfoForAddressRange(
Addr, Size, llvm::DILineInfoSpecifier::FunctionName | llvm::DILineInfoSpecifier::FileLineInfo | llvm::DILineInfoSpecifier::AbsoluteFilePath); Addr, Size, llvm::DILineInfoSpecifier::FunctionName | llvm::DILineInfoSpecifier::FileLineInfo
| llvm::DILineInfoSpecifier::AbsoluteFilePath);
#else #else
llvm::DILineInfoTable lines = Context->getLineInfoForAddressRange( llvm::DILineInfoTable lines = Context->getLineInfoForAddressRange(
Addr, Size, llvm::DILineInfoSpecifier(llvm::DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath, Addr, Size, llvm::DILineInfoSpecifier(llvm::DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath,
llvm::DILineInfoSpecifier::FunctionNameKind::LinkageName)); llvm::DILineInfoSpecifier::FunctionNameKind::LinkageName));
#endif #endif
if (VERBOSITY() >= 2) { if (VERBOSITY() >= 2) {
for (int i = 0; i < lines.size(); i++) { for (int i = 0; i < lines.size(); i++) {
printf("%s:%d, %s: %lx\n", lines[i].second.FileName.c_str(), lines[i].second.Line, printf("%s:%d, %s: %lx\n", lines[i].second.FileName.c_str(), lines[i].second.Line,
lines[i].second.FunctionName.c_str(), lines[i].first); lines[i].second.FunctionName.c_str(), lines[i].first);
} }
} }
line_table_registry.registerLineTable(Addr, Size, lines); line_table_registry.registerLineTable(Addr, Size, lines);
......
...@@ -398,11 +398,9 @@ public: ...@@ -398,11 +398,9 @@ public:
const int line, column; const int line, column;
std::string file, func; std::string file, func;
LineInfo(int line, int column, const std::string& file, const std::string& func) : LineInfo(int line, int column, const std::string& file, const std::string& func)
line(line), column(column), file(file), func(func) { : line(line), column(column), file(file), func(func) {}
}
}; };
} }
#endif #endif
...@@ -57,9 +57,10 @@ struct Block { ...@@ -57,9 +57,10 @@ struct Block {
}; };
static_assert(sizeof(Block) == BLOCK_SIZE, "bad size"); static_assert(sizeof(Block) == BLOCK_SIZE, "bad size");
constexpr const size_t sizes[] = { 16, 32, 48, 64, 80, 96, 112, 128, 160, 192, 224, 256, constexpr const size_t sizes[] = {
320, 384, 448, 512, 640, 768, 896, 1024, 1280, 1536, 1792, 2048, 16, 32, 48, 64, 80, 96, 112, 128, 160, 192, 224, 256,
// 2560, 3072, 3584, // 4096, 320, 384, 448, 512, 640, 768, 896, 1024, 1280, 1536, 1792, 2048,
// 2560, 3072, 3584, // 4096,
}; };
#define NUM_BUCKETS (sizeof(sizes) / sizeof(sizes[0])) #define NUM_BUCKETS (sizeof(sizes) / sizeof(sizes[0]))
......
...@@ -136,7 +136,7 @@ void printLastTraceback() { ...@@ -136,7 +136,7 @@ void printLastTraceback() {
size_t size; size_t size;
size_t r = getline(&buf, &size, f); size_t r = getline(&buf, &size, f);
if (r != -1) { if (r != -1) {
while (buf[r-1] == '\n' or buf[r-1] == '\r') while (buf[r - 1] == '\n' or buf[r - 1] == '\r')
r--; r--;
char* ptr = buf; char* ptr = buf;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment